Export to CARLA
CARLA Export Overview
RoadRunner can export scenes to the CARLA simulator. The CARLA export provides two options:
CARLA: Exports an Unreal® Datasmith (
.udatasmith
) file and an ASAM OpenDRIVE® (.xodr
) file.CARLA Filmbox : Exports a Filmbox (
.fbx
) file, an XML for some metadata, and an ASAM OpenDRIVE (.xodr
) file. The XML file holds data for materials in the scene.
On the CARLA or Unreal side, a plugin is provided to help import the exported scene from RoadRunner.
For the scene exported using the CARLA plugin, the plugin provided on the Unreal side handles the following:
Setting up materials
Material data is read in from the Datasmith (
.udatasmith
) file and maps the data into a new instance of one of the base materials included with the plugin.Transparent materials will choose between the translucent and masked blend modes based on the transparency of the diffuse color.
Adjusting the colliders in the imported static meshes
During import, newly created static mesh assets have their "Collision Complexity" option set to "Use Complex Collision As Simple".
Setting up the traffic signal visuals
Traffic signal logic is hooked up to the simulator.
Software requirements
CARLA 0.9.13
For the scene exported using the CARLA Filmbox plugin, the plugin provided on the Unreal side helps to import the FBX® file by using the information stored in the XML file. The plugin handles the following:
Setting up materials
Material data is read in from the XML file and maps the data into a new instance of one of the base materials included with the plugin.
Certain materials will instantiate from one of the CARLA materials.
Transparent materials will choose between the translucent and masked blend modes based on the transparency of the diffuse color.
Adjusting the colliders in the imported static meshes
During import, newly created static mesh assets have their "Collision Complexity" option set to "Use Complex Collision As Simple".
Setting up the traffic signal visuals
Traffic signal logic is not hooked up to the simulator.
Software requirements
CARLA 0.9.13
Installing the Plugins
Follow the instructions in this section to install the Unreal plugin:
Build CARLA from its source. For more information, see the Windows® build page of the Building CARLA instructions.
See Downloading Plugins for instructions for downloading the latest version of the plugin.
Extract the RoadRunner Plugins zip file and locate the
RoadRunnerImporter
,RoadRunnerCarlaIntegration
,RoadRunnerRuntime
,RoadRunnerDatasmith
,RoadRunnerCarlaDatasmith
, andRoadRunnerMaterials
folders under "Unreal/Plugins".Copy the
RoadRunnerImporter
,RoadRunnerCarlaIntegration
,RoadRunnerRuntime
,RoadRunnerDatasmith
,RoadRunnerCarlaDatasmith
, andRoadRunnerMaterials
folders into thePlugins
folder under theCarlaUE4
project directory, located at<carla>/Unreal/CarlaUE4/Plugins
(next to theCarla
folder).Rebuild the plugin. First, generate the project files.
If you are on Windows, right-click the
.uproject
file and selectGenerate Visual Studio project files
.If you are on Linux®, run this code at the command line:
$UE4_ROOT/GenerateProjectFiles.sh -project="<CarlaFolderPath>/Unreal/CarlaUE4/CarlaUE4.uproject" -game -engine
Set
UE4_ROOT
to your Unreal Engine® install directory.
Then, open the project and build the plugins. If you are on Windows, run "make launch" in x64 Native Tools Command Prompt for VS 2019 to compile the plugin and launch the editor.
The plugins shows up under Edit > Plugins. If it does not appear in that menu, check that the Enabled check box is on.
Plugin Contents
RoadRunnerImporter module:
Overrides the default FBX importer when the metadata file is present
Option to overwrite default materials with new materials using the metadata file
Import signal data and timing
RoadRunnerRuntime module:
Contains component to control traffic signal visuals
RoadRunnerCarlaIntegration module:
Creates a new map and imports the FBX into the level
Moves static mesh assets based on segmentation type
Creates materials instantiated from CARLA materials for weather effects
Generates the routes from the ASAM OpenDRIVE file
RoadRunnerMaterials plugin:
Base materials to create instances from
RoadRunnerDatasmith plugin:
Dataprep asset that handles metadata post-processing
Imports signal data and timing
RoadRunnerCARLADatasmith plugin:
Imports RoadRunner scenes into CARLA, automatically setting up traffic signals.
Exporting from RoadRunner to CARLA
Export Using CARLA Plugin
CARLA plugin (.udatasmith
+ .xodr
). is the
recommended method to export to CARLA. Exporting a RoadRunner scene to CARLA using CARLA (.udatasmith
+ .xodr
) plugin enables
you to export ASAM OpenDRIVE data along with the Datasmith file and also adds the metadata to Datasmith export. The metadata stores signalization and ASAM OpenDRIVE IDs. The CARLA export option reduces the import time for significantly large scenes into
CARLA.
Follow these steps to export a scene from RoadRunner to Unreal using CARLA (.udatasmith
+ .xodr
):
Open your scene in RoadRunner.
Export the scene using the CARLA (
.udatasmith
+.xodr
) option. Select File > Export > CARLA (.udatasmith, .xodr) from the menu bar.In the Export CARLA Road dialog box, set the mesh merging and tiling options, and then click Export.
Select Browse to open the File dialog box and set the exported file's name and path. The Datasmith file exports to the specified folder.
You can split the mesh by segmentation type. Meshes have
<segmentation type>
Node
appended to their names.If the Export To Tiles option is selected, meshes are split per tile. Props are grouped by the tile they are in.
By default, only one file is exported. Tiles are stored in separate nodes.
If Export Individual Tiles is enabled, each tile are stored in its own Datasmith file.
Export Using CARLA Filmbox
If you want to use export using the older pipeline, use the CARLA plugin (.fbx
+ .rrdata.xml
+
.xodr
) option. Follow the steps below to export a scene from
RoadRunner to CARLA using the CARLA
Filmbox plugin (.fbx
+ .rrdata.xml
+
.xodr
) option:
Open your scene in RoadRunner.
Export the scene using the CARLA option. Select File > Export > CARLA Filmbox (.fbx, .xodr, .rrdata.xml) from the menu bar.
In the Export CARLA dialog box, set the mesh tiling on the FBX tab and the ASAM OpenDRIVE options on the OpenDRIVE tab as needed. Then, click Export.
Browse to open the file dialog box to set the exported file's name and path. The FBX, textures, XML, and ASAM OpenDRIVE files are exported to the same folder.
The mesh can be split by segmentation type. Meshes have "<segmentation type>Node" appended to their names.
If the Export To Tiles option is selected, meshes are split per tile and props are grouped by the tile they are in.
By default, only one file is exported. Tiles are stored in separate nodes.
If Export Individual Tiles is enabled, each tile is stored in its own FBX file.
Note
The plugin does not fully support the Export Individual Tiles option.
Importing into CARLA
Import to CARLA
Follow these steps to import the scene into CARLA if you exported the RoadRunner scene using CARLA (.udatasmith
+ .xodr
) option:
Make a copy of the BaseMap and save it to the
Maps
folder. Rename the new map.Open the new map that you created in the previous step.
Right-click in the Content Browser window in Unreal. In the menu, select Show Plugin Content.
Enable Datasmith FBX Importer and Datasmith Importer plugins in CARLA.
Click RoadRunner CARLADatasmith Content. Double-click the RRCARLADataprep Asset. This opens a new editor which handles importing with Datasmith and all the post processing steps.
Click the Import button to import a scene into Unreal. For example, this image loads the
FourWaySignal
scene file, which is one of the scenes present in theScenes
folder of a RoadRunner project.Click Execute in the Editor toolstrip to run the post-processing steps for the imported scene.
Click Commit in the Editor toolstrip to commit these changes to the scene.
The scene is now imported and ready to simulate on.
Import to CARLA (Filmbox)
Follow these steps if you used the CARLA Filmbox plugin while exporting the RoadRunner scene.
Drag the file into the Content Browser.
Use the "Import" button and select the FBX file.
The plugin checks if there is a RoadRunner XML file associated with the imported file, and imports as normal if a corresponding XML file is not found.
Selecting File > Import Into Level does not use the exported RoadRunner XML and uses the Unreal importer instead.
When the RoadRunner Import Options Dialog Box Opens
Overwrite Materials
Overrides the default material importing. Instances from CARLA materials for roads and foliage.
Needs to be unchecked if you want to set the materials to "Use Existing" in the next dialog box.
Import Signal Visuals
Only functional when the "Create one Blueprint asset" option is selected in the next dialog box.
Note
The Importing Signal Visuals option does not have any effect on the traffic simulation.
When the FBX Scene Import Options Dialog Box Opens
Set Scene > Hierarchy Type to "Create One Blueprint Asset" (selected by default).
Note
Only the "Create one Blueprint asset" import option works with materials, signals, and transparency sorting. The "Create one Actor with Components" and "Create Level Actors" options import only materials.
Select Invert Normal Maps, if needed.
Set Static Meshes > Normal Import Method to "Import Normals".
(Optional) Uncheck Remove Degenerates, which can help for some props created in a larger scale.
Click Import.
About Importing Traffic Signals into Unreal. If traffic signals were set up in RoadRunner, they are imported into Unreal as RoadRunnerTrafficJunction components. These controllers are automatically created during import and included in the created blueprint.
The RoadRunnerTrafficJunction component handles the logic for switching between signal states. UUIDs are used to match to specific game objects in the scene.
FBX Details. The FBX file will automatically split the mesh by segmentation and transparency sorting layer due to the following:
Segmentation: CARLA determines segmentation by static mesh assets.
Transparency sorting: Unreal stores the "Translucency Sort Priority" value on the static mesh component.
Testing the map
Click Play in the editor (the first time you click Play takes extra time to build the map).
Run the example Python® scripts.