Main Content

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:

  1. Build CARLA from its source. For more information, see the Windows® build page of the Building CARLA instructions.

  2. See Downloading Plugins for instructions for downloading the latest version of the plugin.

  3. Extract the RoadRunner Plugins zip file and locate the RoadRunnerImporter, RoadRunnerCarlaIntegration, RoadRunnerRuntime, RoadRunnerDatasmith, RoadRunnerCarlaDatasmith, and RoadRunnerMaterials folders under "Unreal/Plugins".

  4. Copy the RoadRunnerImporter, RoadRunnerCarlaIntegration, RoadRunnerRuntime, RoadRunnerDatasmith ,RoadRunnerCarlaDatasmith, and RoadRunnerMaterials folders into the Plugins folder under the CarlaUE4 project directory, located at <carla>/Unreal/CarlaUE4/Plugins (next to the Carla folder).

    Plugins folder under CarlaUE4 project that contains the pasted RoadRunner folders

  5. Rebuild the plugin. First, generate the project files.

    • If you are on Windows, right-click the .uproject file and select Generate 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.

  6. The plugins shows up under Edit > Plugins. If it does not appear in that menu, check that the Enabled check box is on.

    Unreal Plugins window with RoadRunner Carla Integration and RoadRunner Importer plugins enabled

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):

  1. Open your scene in RoadRunner.

  2. Export the scene using the CARLA (.udatasmith + .xodr) option. Select File > Export > CARLA (.udatasmith, .xodr) from the menu bar.

  3. In the Export CARLA Road dialog box, set the mesh merging and tiling options, and then click Export.

  4. 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:

  1. Open your scene in RoadRunner.

  2. Export the scene using the CARLA option. Select File > Export > CARLA Filmbox (.fbx, .xodr, .rrdata.xml) from the menu bar.

  3. 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.

  4. 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:

  1. Make a copy of the BaseMap and save it to the Maps folder. Rename the new map.

    BaseMap replica created.

  2. Open the new map that you created in the previous step.

  3. Right-click in the Content Browser window in Unreal. In the menu, select Show Plugin Content.

    Content Browser

  4. Enable Datasmith FBX Importer and Datasmith Importer plugins in CARLA.

  5. 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.

    RR CARLADataprep Asset

  6. 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 the Scenes folder of a RoadRunner project.

    Imported scene in Unreal

  7. Click Execute in the Editor toolstrip to run the post-processing steps for the imported scene.

  8. Click Commit in the Editor toolstrip to commit these changes to the scene.

  9. 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

Import Options in Unreal Engine with Overwrite Materials and Import Signal Visuals selected.

  • 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

  1. 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.

  2. Select Invert Normal Maps, if needed.

    FBX Scene Import Options dialog box. On the Scene tab, Hierarchy Type and Invert Normal Maps are highlighted.

  3. Set Static Meshes > Normal Import Method to "Import Normals".

    FBX Scene Import Options dialog box. On the Static Meshes tab, the Remove Degenerates and Normal Import Method options are selected.

  4. (Optional) Uncheck Remove Degenerates, which can help for some props created in a larger scale.

  5. 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

  1. Click Play in the editor (the first time you click Play takes extra time to build the map).

    Unreal Editor Play button

  2. Run the example Python® scripts.

    Python window showing the scenario simulation. A red car drives through an interesction.Python window showing the scenario simulation. A red car drives through an interesction.