Main Content

Configure RoadRunner Scenario Model

This section shows how to configure a RoadRunner Scenario model where CARLA controls the ego vehicle and RoadRunner Scenario controls the target vehicles.

Note

Before performing this configuration, you must complete the setup steps defined in Set Up CARLA for Cosimulation.

Set Up RoadRunner Scenario Model with Vehicles

Start RoadRunner Scenario.

  1. Create a new project in RoadRunner.

  2. In the dialog box, click New Scene, then New Project, and create or select an empty folder, ProjectFolder, to save your project in.

  3. Select Yes to include the asset library.

  4. Click File > Open Scene, and select ProjectFolder/Scenes/ScenarioBasic.rrscene.

    Scene containing multiple intersections

  5. Switch to scenario editing mode. In the top-right corner of RoadRunner, select Scene Editing, then Scenario Editing.

    Scene and Scenario toggle button

  6. Create a new scenario. Select File > New Scenario.

  7. Place a target vehicle for RoadRunner Scenario to control. From the Library Browser, select the Sedan vehicle asset and drag it to a road in the scene. With the target vehicle selected in the scene, create a path by right-clicking on the roads to specify waypoints.

    Adding Sedan to RoadRunner scene

  8. Place the ego vehicle for CARLA to control. From the Library Browser, select the Compact car vehicle asset and drag it to a road in the scene. With the ego vehicle selected in the scene, create a path by right-clicking on the roads to specify waypoints. In this example, the compact car follows the same path as the sedan.

    Adding compact car to RoadRunner scene

Add CARLA Behavior to Ego Vehicle

In the Library Browser, create a new folder named Behavior in the Vehicles folder. Add a new CARLA behavior by right-clicking in the folder and selecting New > Behavior. Specify the name of the behavior asset as CARLA Behavior. With CARLA Behavior.rrbehavior selected, in the Attributes pane, set these Behavior attributes:

  • PlatformExternal

  • Platform NameCARLA

  • Model location../examples/CarlaEgoVehicle1.py

You can use the CarlaEgoVehicle1.py file, included with RoadRunner Scenario, as an example for creating ego vehicle behavior, including speed, path, and set parameters actions, using a CARLA Python® API. For more information on the CARLA Python APIs, see Navigating through waypoints in the CARLA documentation.

Note

Two additional scripts, CarlaEgoVehicle2.py and CarlaTargetVehicle1.py, provide sample code for the behaviors of an ego vehicle actor with path-following and a target vehicle actor, respectively. By default, these scripts are located at RoadrunnerInstall\bin\win64\Tools\CARLA\examples on Windows® systems, and RoadRunnerInstall/bin/glnxa64/Tools/CARLA/examples on Linux® systems.

Create and specify CARLA behavior asset

Select the compact car. Assign the CARLA behavior by, in the Attributes pane, dragging the CARLA Behavior.rrbehavior asset to the Vehicle > Behavior field. You can optionally rename the CARLA ego vehicle.

Assign CARLA behavior to ego vehicle

Check and update the actor mapping file RoadrunnerInstall\bin\win64\Tools\CARLA\examples\actors.json, where RoadrunnerInstall is your RoadRunner installation directory, to include your vehicles. By default, the actors.json file includes the sedan, compact, and SUV vehicles. This file serves as a map between the vehicle visualization in RoadRunner Scenario and the simulation in CARLA.

{
	"Assets/Developer/Vehicles/CompactCar.fbx_rrx": "vehicle.mini.cooper_s", 
	"Assets/Developer/Vehicles/CompactCar.fbx": "vehicle.mini.cooper_s", 
	"Assets/Vehicles/CompactCar.fbx_rrx": "vehicle.mini.cooper_s", 
	"Assets/Vehicles/CompactCar.fbx": "vehicle.mini.cooper_s", 
	"Assets/Developer/Vehicles/Sedan.fbx_rrx": "vehicle.lincoln.mkz_2020", 
	"Assets/Developer/Vehicles/Sedan.fbx": "vehicle.lincoln.mkz_2020",
	"Assets/Vehicles/Sedan.fbx_rrx": "vehicle.lincoln.mkz_2020", 
	"Assets/Vehicles/Sedan.fbx": "vehicle.lincoln.mkz_2020", 
	"Assets/Developer/Vehicles/Suv.fbx_rrx": "vehicle.nissan.patrol",
	"Assets/Developer/Vehicles/Suv.fbx": "vehicle.nissan.patrol",
	"Assets/Vehicles/Suv.fbx_rrx": "vehicle.nissan.patrol",
	"Assets/Vehicles/Suv.fbx": "vehicle.nissan.patrol"
}

Note

On Linux systems, the actors.json file is located at RoadRunnerInstall/bin/glnxa64/Tools/CARLA/examples/actors.json

For information on how to run these cosimulations, see Run Cosimulations with CARLA.

See Also

| |