Export Driving Scenario to RoadRunner Scenario Simulation
RoadRunner Scenario is an interactive editor that lets you design scenarios for
simulating and testing automated driving systems. You can now use the startRoadRunnerForScenario
function or the Driving Scenario
Designer app to:
Launch the RoadRunner application with automatic import of current driving scenario elements to a RoadRunner scenario.
Export the road network and static actors in the driving scenario to RoadRunner HD Map file format.
The process of exporting a driving scenario to RoadRunner scenario generates these files:
A RoadRunner HD Map road data model representing the road network and static actors in the underlying RoadRunner scene.
A CSV file with trajectory data for each dynamic actor in the RoadRunner scenario.
Prerequisites
Exporting a driving scenario to RoadRunner scenario requires a RoadRunner installation with these products:
RoadRunner Scenario — To import trajectories of dynamic actors in the driving scenario
RoadRunner Scene Builder — To build a 3-D scene of the road network and actors in the driving scenario
- RoadRunner
Asset Library Add-On — To map the driving scenario actors to their corresponding RoadRunner assets
Mapping Driving Scenario Actors to RoadRunner Scenario
This table illustrates the default mapping between dynamic actors in driving scenario and their corresponding assets in the exported RoadRunner scenario.
Driving Scenario Class ID | Driving Scenario Actor Type | RoadRunner Asset |
---|---|---|
1 | Car | Assets/Vehicles/ADT Vehicles/SK_Sedan.fbx |
2 | Box Truck | Assets/Vehicles/ADT Vehicles/SK_BoxTruck.fbx |
3 | Bicycle | Assets/Vehicles/Cuboid.rrvehicle |
4 | Pedestrian | Assets/Characters/Citizen_Male.rrchar |
All other class IDs | All other custom dynamic actors | Assets/Vehicles/Cuboid.rrvehicle |
Note
To map actors to the right assets, you must have the RoadRunner Asset Library add-on installed. Otherwise, the actors are mapped
to the default Cuboid.rrvehicle
asset.
Export Driving Scenario to RoadRunner Scenario Using startRoadRunnerForScenario
Function
Create a driving scenario.
scenario = drivingScenario(SampleTime=0.025);
Add all the road segments.
roadCenters = [272.6 23.8 0; 51 24.2 0]; laneSpecification = lanespec([2 2],'Width',[4 3.6 3.6 3.6]); road(scenario,roadCenters,Lanes=laneSpecification,Name='Road'); roadCenters = [109.8 129.5 0; 110 -30 0]; laneSpecification = lanespec([2 2]); road(scenario,roadCenters,Lanes=laneSpecification,Name='Road1');
Add ego vehicle to the driving scenario. You can specify the
AssetPath
argument to map the ego vehicle to a specific vehicle
asset in RoadRunner. For this example, specify the ego vehicle to be a pickup
truck.
egoVehicle = vehicle(scenario,ClassID=1,Position=[115.14 -2.51 0.01],... Name='EgoVehicle',AssetPath="Assets/Vehicles/PickupTruck.fbx");
Add a trajectory to the ego vehicle by specifying waypoint and speed values.
waypoints = [115.14 -2.51 0.01; 115.07 19.06 0.01; 115.07 24.4 0.01; 115.29 47.07 0.01]; speed = [8;8;8;8]; trajectory(egoVehicle,waypoints,speed);
Add a pedestrian to the scenario and specify the trajectory. Because you have not
specified the AssetPath
argument, the pedestrian is mapped to the
default asset based on the class ID during
export.
pedestrian = actor(scenario,ClassID=4,Position=[100 35 0.1],... Velocity=[1.3 0 0],Name='Pedestrian'); waypoints=[100 35; 110 35; 120 35]; speed = [1.5 1.5 1.5]; trajectory(pedestrian,waypoints,speed);
Add a bicyclist to the scenario and specify the trajectory.
bicycle = actor(scenario,ClassID=3,Position=[83.51 30.5 0.01],Name='Bicycle'); waypoints = [83.51 28.5 0.01; 84.91 27.6 0.01; 86.82 26.17 0.01; 89.86 26.45 0.01]; speed = [5;5;5;5]; trajectory(bicycle, waypoints, speed);
Add a box truck to the scenario and specify the trajectory.
truck = vehicle(scenario,ClassID=2,... Position=[91.77 18.17 0.01],Name='Truck'); waypoints = [91.77 18.17 0.01;108.97 18.39 0.01; 119.38 18.84 0.01;130.26 18.84 0.01]; speed = [14;14;14;14]; trajectory(truck, waypoints, speed);
Plot the driving scenario.
plot(scenario)
Export the driving scenario using the startRoadRunnerForScenario
function. Specify the file name for the
exported scenario.
rrApp = startRoadRunnerForScenario(scenario,fileName="myScenario");
Export Driving Scenario to RoadRunner Scenario Using Driving Scenario Designer App
Load a Scenario in Driving Scenario Designer App
Open the Driving Scenario Designer app.
drivingScenarioDesigner
Load a prebuilt EURO NCAP driving scenario. On the app toolstrip, select Open > Prebuilt Scenario. The PrebuiltScenarios
folder opens, which includes
subfolders for all prebuilt scenarios available in the app. Double click
EuroNCAP folder, and then navigate to the
Autonomous Emergency Braking subfolder.
Select AEB_PedestrianTurning_Farside_50width_15kmh
scenario and
open it. Alternatively, you can create your own custom scenario using the
Driving Scenario Designer app or import a programmatically created
driving scenario into the app.
The AEB_PedestrianTurning_Farside_50width_15kmh
scenario
consists of a vehicle under test turning left at an intersection where a pedestrian
is walking across the same road.
Launch RoadRunner Scenario from Driving Scenario Designer App
On the app toolstrip, select Export > RoadRunner. This opens the RoadRunner Setup dialog where you can specify the RoadRunner project and installation directories. Click OK.
This launches RoadRunner Scenario with the current scene and scenario elements imported automatically from the driving scenario. You can simulate the scenario in RoadRunner and verify that the behavior matches that of the driving scenario.
Export Only Road Network and Static Actors to RoadRunner HD Map file
Instead of exporting the entire driving scenario, you can only export the road
network and static actors of a driving scenario as RoadRunner scene elements. This operation generates only a RoadRunner HD Map file. To export a programmatically authored driving scenario to
a RoadRunner HD Map file, you can use the export
function.
On the app toolstrip, select, Export > RoadRunner HD Map File. This opens the RoadRunner HD Map Export dialog. Specify the path for the exported HD Map file. You can also choose whether to export static actors or not by using the Export Static Actors checkbox.
You can visualize the HD Map using the roadrunnerHDMap
object and its plot
object function.
rrMap = roadrunnerHDMap; read(rrMap,'AEB_PedestrianTurning_Farside_50width_15kmh.rrhd') plot(rrMap)
Mapping Driving Scenario Actors to RoadRunner Scene. This table illustrates the mapping between static actors in driving scenario and their corresponding assets in the exported RoadRunner scene.
Driving Scenario Class ID | Driving Scenario Actor Type | RoadRunner Asset |
---|---|---|
1 | Car | Assets/Vehicles/ADT Vehicles/SK_Sedan.fbx |
2 | Box Truck | Assets/Vehicles/ADT Vehicles/SK_BoxTruck.fbx |
3 | Bicycle | Assets/Vehicles/Cuboid.fbx |
4 | Pedestrian | Assets/Characters/Citizen_Male.rrchar |
All other class IDs | All other custom static actors | Assets/Vehicles/Cuboid.fbx |
You must download a cuboid FBX file and place it at
Assets/Vehicles/Cuboid.fbx
to represent some static
actors.
Limitations
Dynamic Actors and Scenario Export Limitations
Exporting dynamic actors and other driving scenario elements to a RoadRunner scenario has these limitations:
The driving scenario must have at least one road.
Driving scenarios with road groups are not supported.
Dynamic actors with reverse motion are not supported.
Dynamic actors with spawn and despawn parameters are not supported.
Export operation is not supported for Mac platform and MATLAB® Online™.
Static Actors and Road Network Export Limitations
Exporting road network and static actors in a driving scenario to RoadRunner HD Map has these limitations:
A RoadRunner Scene Builder license is required to build a scene from the HD map file. Without a RoadRunner Scene Builder license, you can import the HD map file and only view the map as nodes and links
in RoadRunner. Composite Lane Specifications Roads that use composite lane specifications ( Composite lane specifications for creating roads with varying widths are
not supported Lane Markings and Lane Type For lane markings created using the For roads that form loops, multiple lane marking styles are not
supported. Parking Lot Driving scenarios containing parking lots added using the Barriers Barriers with gaps between segments created using the For barriers, setting the Static Actors Static actors such as pedestrians and bicycles are not supported. To
represent these actors in RoadRunner, you can either download a cuboid FBX and place it under
Assets/Vehicles/ or edit the map to point to their own assets. Road Groups and Road Networks Road junctions and intersections added using the Road networks created using the compositeLaneSpec
) and form loops or intersect with themselves
are not supported.laneMarking
object and lane types created using the laneType
object, only Color
name-value
argument is supported. Only white and yellow colors are supported.parkingLot
function are not supported.barrier
function with SegmentGap
name-value argument, are not supported. Such barriers will be laid out
without any gaps in the RoadRunner HD map representation.SegmentLength
,
Width
, and Height
properties
are not supported. These properties are calculated automatically based on
the asset size during import to RoadRunner.roadGroup
function are not supported.roadNetwork
function are not supported when they use road
groups.
See Also
startRoadRunnerForScenario
| export
| roadrunnerHDMap