Main Content

Export Scenes and Visualizations to CARLA

To run cosimulations with CARLA, you must first export your RoadRunner scene data. This topic covers two different workflows for exporting a scene for CARLA cosimulation:

Export RoadRunner Scene to OpenDRIVE

Exporting your scene data to the OpenDRIVE® format, enables you to quickly view cosimulations with the default CARLA renderer.

  1. Open your scene in RoadRunner.

  2. From the menu, select File > Export > ASAM OpenDRIVE (.xodr).

  3. In the export dialog box, change the file path to the Scenes folder of your RoadRunner project.

Build CARLA From Source

Building CARLA from its source captures all of the detail from your RoadRunner scene, including traffic signal, collision, and material data, enabling more accurate cosimulation. This export workflow extends the workflow described in Export to CARLA to show an equivalent visualization in RoadRunner Scenario and CARLA.

Export Scene from RoadRunner Scenario

  1. Open your scene in RoadRunner.

  2. Export the scene using the CARLA option. From the menu, select File > Export > CARLA Filmbox (.fbx, .xodr, .rrdata.xml).

  3. In the Export CARLA dialog box, set the mesh tiling on the Filmbox tab and the OpenDRIVE options on the OpenDRIVE tab.

  4. Click Export.

Build and Add Plugins to CARLA

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

    Note

    The git command clones the CARLA source code to C:\CarlaRepository\carla, and Unreal Engine® to C:\UnrealInstall\UnrealEngine. CarlaRepository is the location of the cloned the CARLA repository, and UnrealInstall is the Unreal Engine installation folder.

  2. Copy the CARLA RoadRunner plugins to the folder C:\CarlaRepository\carla\Unreal\CarlaUE4\Plugins.

  3. Update the Microsoft® Visual Studio® project. Right-click the project file C:\CarlaRepository\carla\Unreal\CarlaUE4\CarlaUE4.uproject and select Switch Unreal Engine Version.

Add Maps and Rebuild CARLA

  1. Start Unreal® and open the Unreal project file, CarlaUE4.uproject.

  2. Using the Content Browser, create new RoadRunner\Maps and RoadRunner\Static folders.

  3. Drag all the files exported from RoadRunner to RoadRunner\Static, and follow the instructions in the import wizard.

  4. Save ScenarioBasic.umap to the RoadRunner\Maps folder.

  5. In Project Settings, under Project > Packaging, add the map to the packaging list.

    Project Packaging List

  6. Close the Unreal Editor and save the assets when prompted.

  7. Build the CARLA executable and package the new map to C:\CarlaRepository\carla\Build\UE4Carla\N_N_NN-dirty\WindowsNoEditor.

  8. Set a Windows® environment variable, CARLA_ROOT, to C:\CarlaRepository\carla\Build\UE4Carla\N_N_NN-dirty\WindowsNoEditor.

    To do this, open Windows Settings and click System > About > Advanced System Settings. In the System Properties window, click Environment Variables and, in the System Variables panel, click New. Set Variable name to CARLA_ROOT and Variable value to C:\CarlaRepository\carla\Build\UE4Carla\N_N_NN-dirty\WindowsNoEditor.

  9. Update the platform settings in C:\Users\username\AppData\Roaming\MathWorks\RoadRunner\R20NNa\Scenario\Config\SimulationConfiguration.xml, where username is your Windows user profile name and R20NNa is the currently installed version of RoadRunner, such as R2023a, to these values.

<TimeOutValues>
<Event name="SimulationStartEvent" value="30000"/>
...
</TimeOutValues>
...       
<Platform name="CARLA"> 
 <ExecutablePath>C:\CarlaRepository\carla\Build\UE4Carla\N_N_NN-dirty\WindowsNoEditor\CarlaUE4.exe</ExecutablePath>
 <StartTimeOut>60000</StartTimeOut>
</Platform>

The scene is now available in the CARLA simulation engine.

See Also

|

External Websites