We wanted to share our experience working with CARLA and how it helped bring a long-term solution for custom map importing. To import a custom map into CARLA, you must understand the documentation and follow the steps (even though there are some challenges we faced along the way). In the following, we like to share these learnings and experiences.
As explained in a previous blog post, RoadRunner is a map editor made by MathWorks specially tailored to the creation of road networks.
Ideal Setup Up for RoadRunner and CARLA
When we started using CARLA and RoadRunner together, we weren’t aware of the compatibility requirements for RoadRunner to work with CARLA. While the latest CARLA documentation does not warn users of incompatibilities with RoadRunner, the RoadRunner documentation states that it is only compatible with the source version of CARLA 0.9.5 (at the time of writing, the latest stable version of CARLA was 0.9.13). Furthermore, MathWorks recommended using Ubuntu 18.04 for RoadRunner and CARLA projects.
We’ve used Ubuntu 20.04 and CARLA 0.9.13 for all steps described in this tutorial. We propose solutions for importing a RoadRunner map successfully into the CARLA UE4 editor under these circumstances.
There are two available variants of CARLA: the packaged version, which includes a binary to start the CARLA server, or the source version, which requires the Unreal Engine 4 editor as a dependency. The source version doesn’t have a binary to start the server directly. Instead, it comes with a binary to start the Unreal editor from where the server can be started. The packaged variant is about 16 GB in size; however, the source variant requires at least 150 GB (the CARLA documentation cites other numbers, but it is very inconsistent with them). Arguably, the packaged version is the preferred version, but we had a lot of trouble importing maps into it, as seen in this post. Therefore, our advice is to use the source version of CARLA.
For both of these variants, Docker images exist. However, the image must be built for the source version, and to our knowledge, it is not available as a download.
Summarized we have the following installation methods:
- Packaged CARLA
- Convenient but not recommended for including custom maps
- Installation instructions for Debian
- Installation instructions for Windows
- Docker container of packaged CARLA
- Convenient but not recommended for including custom maps
- Installation instructions
- The instructions for it are a bit outdated. The latest image is in fact version 0.9.13.
- Docker container which contains the Unreal editor
- The CARLA documentation uses this image to package custom maps for use in the packaged CARLA version
- Apart from that use case, it is better to directly build CARLA from the source
- Installation instructions
- Compile from source
- Highly recommended for including custom maps
- Includes the Unreal editor
- Installation instructions for Linux
- Installation instructions for Windows
Creating a Custom Map with RoadRunner
Creating a custom map in RoadRunner is straightforward and can be quickly learned from reading the extensive documentation available from MathWorks. Here, we will provide tips for avoiding problems with the map export.
First, ensure that you’re aware that Unreal Engine 4 supports asset placement later on, which can come in handy when you eventually import the map into your project. RoadRunner is an excellent tool for building a road network in conjunction with an OpenDrive map. However, the UE4 editor is a fantastic tool for editing terrain and adding buildings and decorations next to the roads. Some of the building assets from RoadRunner threw warnings when we imported them into UE4, so we decided to remove them and add buildings in the UE4 editor.
Second, make sure there are no geometry errors on your map. RoadRunner can help you detect and display geometry issues. You can follow the official instructions on how to visualize the problems. There were several cases where line markings merged, especially as they are not just textures but made of geometry. RoadRunner could experience issues with them and produce visual artifacts when they join together. Although not the ideal solution, we had to either remove a line marking from the area with a problem or shift a dashed line in that area to make sure the geometry was correct.
Lastly, it is essential to visualize the OpenDrive map and check for errors. In our case, most OpenDrive errors stem from complex junctions and highway ramps. The default lane connections usually were faulty for highway ramps and could easily be fixed with the junction tool.
Importing RoadRunner Maps to UE4 Map Editor
Suppose we just created a map in RoadRunner and want to export the map to CARLA. There are two different strategies. Either we follow the CARLA documentation on how to import a RoadRunner map and make it directly consumable for the packaged CARLA version, or we follow the RoadRunner documentation on how to import the map into the CARLA UE4 editor.
We have not been able to import a map using the packaged version of CARLA 0.9.13 with RoadRunner 2022 successfully. We followed the instructions of the CARLA documentation on how to import a custom RoadRunner map into the packaged version of CARLA. However, we encountered two significant problems with the custom map: the traffic signs we placed were missing in CARLA, and the foliage showed rendering problems.
We solved this issue by switching to the source version of CARLA, which includes the UE4 editor. Directly using the UE4 editor to import the RoadRunner map gives us better feedback on what is happening during the import process. Moreover, the official RoadRunner documentation proposes to use the approach to import assets into UE4. The installation steps are the following:
- Build the CARLA UE4 editor and CARLA by following these instructions.
- Install the UE4 RoadRunner plugins
The next step involves exporting from RoadRunner. For that, two options are provided: an export to CARLA and an export to Unreal engine. Although it is advised only to use the “Export to CARLA” option, we experienced issues with both options without recognizing an obvious pattern. For example, we followed the described process on two Ubuntu 20.04 machines. The “Export to CARLA” option worked on one computer, and the “Export to Unreal Engine” option worked on the other computer. Choosing the wrong choice would lead to a crash of the UE4 editor when importing the map.
Besides this oddity, import the map into UE4 as specified by the RoadRunner documentation. Next, create a folder with the name “OpenDrive” next to the map file and place the OpenDrive file (.xodr) in it. In our case, the maps were imported into “ExportedMaps.” Now, you can press play in the UE4 editor, which starts the CARLA server, and now you can explore your custom map in CARLA.
Summary
There are several installation variants for CARLA and different methods for importing custom maps. Furthermore, the process can change depending on the CARLA version you are using at that particular time. Our experiences with the different variants of CARLA 0.9.13 suggest that the easiest way to import a custom map is to use a source variant and follow the steps made by RoadRunner.