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.
Create a new project in RoadRunner.
In the dialog box, click New Scene, then New Project, and create or select an empty folder,
, to save your project in.ProjectFolder
Select Yes to include the asset library.
Click File > Open Scene, and select
.ProjectFolder
/Scenes/ScenarioBasic.rrsceneSwitch to scenario editing mode. In the top-right corner of RoadRunner, select Scene Editing, then Scenario Editing.
Create a new scenario. Select File > New Scenario.
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.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.
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:
Platform —
External
Platform Name —
CARLA
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
on Windows® systems, and
RoadrunnerInstall
\bin\win64\Tools\CARLA\examples
on Linux® systems.RoadRunnerInstall
/bin/glnxa64/Tools/CARLA/examples
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.
Check and update the actor mapping file
,
where RoadrunnerInstall
\bin\win64\Tools\CARLA\examples\actors.json
is your
RoadRunner installation directory, to include your vehicles. By default, the
RoadrunnerInstall
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
CARLA Cosimulation Workflow | Run Cosimulations with CARLA | Set Up CARLA for Cosimulation