Prebuilt Driving Scenarios in Driving Scenario Designer

The Driving Scenario Designer app provides a library of prebuilt scenarios representing common driving maneuvers. The app also includes scenarios representing European New Car Assessment Programme (Euro NCAP®) test protocols.

Choose a Prebuilt Scenario

To get started, open the Driving Scenario Designer app. At the MATLAB® command prompt, enter drivingScenarioDesigner.

In the app, the prebuilt scenarios are stored as MAT-files and organized into folders. To open a prebuilt scenario file, from the app toolstrip, select Open > Prebuilt Scenario. Then select a prebuilt scenario from one of the folders.

Euro NCAP

These scenarios represent Euro NCAP test protocols. The app includes scenarios for testing autonomous emergency braking, emergency lane keeping, and lane keep assist systems. For more details, see Euro NCAP Driving Scenarios in Driving Scenario Designer.

Intersections

These scenarios involve common traffic patterns at four-way intersections and roundabouts.

File NameDescription
EgoVehicleGoesStraight_BicycleFromLeftGoesStraight_Collision.mat

The ego vehicle travels north and goes straight through an intersection. A bicycle coming from the left side of the intersection goes straight and collides with the ego vehicle.

EgoVehicleGoesStraight_PedestrianToRightGoesStraight.mat

The ego vehicle travels north and goes straight through an intersection. A pedestrian in the lane to the right of the ego vehicle also travels north and goes straight through the intersection.

EgoVehicleGoesStraight_VehicleFromLeftGoesStraight.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle coming from the left side of the intersection also goes straight. The ego vehicle crosses in front of the other vehicle.

EgoVehicleGoesStraight_VehicleFromRightGoesStraight.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle coming from the right side of the intersection also goes straight and crosses through the intersection first.

Roundabout.mat

The ego vehicle travels north and crosses the path of a pedestrian while entering a roundabout. The ego vehicle then crosses the path of another vehicle as both vehicles drive through the roundabout.

Turns

These scenarios involve turns at four-way intersections.

File NameDescription
EgoVehicleGoesStraight_VehicleFromLeftTurnsLeft.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle coming from the left side of the intersection turns left and ends up in front of the ego vehicle.

EgoVehicleGoesStraight_VehicleFromRightTurnsRight.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle coming from the right side of the intersection turns right and ends up in front of the ego vehicle.

EgoVehicleGoesStraight_VehicleInFrontTurnsLeft.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle in front of the ego vehicle turns left at the intersection.

EgoVehicleGoesStraight_VehicleInFrontTurnsRight.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle in front of the ego vehicle turns right at the intersection.

EgoVehicleTurnsLeft_PedestrianFromLeftGoesStraight.mat

The ego vehicle travels north and turns left at an intersection. A pedestrian coming from the left side of the intersection goes straight. The ego vehicle completes its turn before the pedestrian finishes crossing the intersection.

EgoVehicleTurnsLeft_PedestrianInOppLaneGoesStraight.mat

The ego vehicle travels north and turns left at an intersection. A pedestrian in the opposite lane goes straight through the intersection. The ego vehicle completes its turn before the pedestrian finishes crossing the intersection.

EgoVehicleTurnsLeft_VehicleInFrontGoesStraight.mat

The ego vehicle travels north and turns left at an intersection. A vehicle in front of the ego vehicle goes straight through the intersection.

EgoVehicleTurnsRight_VehicleInFrontGoesStraight.mat

The ego vehicle travels north and turns right at an intersection. A vehicle in front of the ego vehicle goes straight through the intersection.

U-Turns

These scenarios involve U-turns at four-way intersections.

File NameDescription
EgoVehicleGoesStraight_VehicleInOppLaneMakesUTurn.mat

The ego vehicle travels north and goes straight through an intersection. A vehicle in the opposite lane makes a U-turn. The ego vehicle ends up behind the vehicle.

EgoVehicleMakesUTurn_PedestrianFromRightGoesStraight.mat

The ego vehicle travels north and makes a U-turn at an intersection. A pedestrian coming from the right side of the intersection goes straight and crosses the path of the U-turn.

EgoVehicleMakesUTurn_VehicleInOppLaneGoesStraight.mat

The ego vehicle travels north and makes a U-turn at an intersection. A vehicle traveling south in the opposite direction goes straight and ends up behind the ego vehicle.

EgoVehicleTurnsLeft_Vehicle1MakesUTurn_Vehicle2GoesStraight.mat

The ego vehicle travels north and turns left at an intersection. A vehicle in front of the ego vehicle makes a U-turn at the intersection. A second vehicle, a truck, comes from the right side of the intersection. The ego vehicle ends up in the lane next to the truck.

EgoVehicleTurnsLeft_VehicleFromLeftMakesUTurn.mat

The ego vehicle travels north and turns left at an intersection. A vehicle coming from the left side of the intersection makes a U-turn. The ego vehicle ends up in the lane next to the other vehicle.

EgoVehicleTurnsRight_VehicleFromRightMakesUTurn.mat

The ego vehicle travels north and turns right at an intersection. A vehicle coming from the right side of the intersection makes a U-turn. The ego vehicle ends up behind the vehicle, in an adjacent lane.

Modify Scenario

After you choose a scenario, you can modify the parameters of the roads and actors. For example, from the Actors tab on the left, you can change the position or velocity of the ego vehicle or other actors. From the Roads tab, you can change the width of the lanes or the type of lane markings.

You can also add or modify sensors. For example, from the Sensors tab, you can change the detection parameters or the positions of the sensors. By default, in Euro NCAP scenarios, the ego vehicle does not contain sensors. All other prebuilt scenarios have at least one front-facing camera or radar sensor, set to detect lanes and objects.

Generate Synthetic Detections

To generate detections from the sensors, on the app toolstrip, click Run. As the scenario runs, the Ego-Centric View displays the scenario from the perspective of the ego vehicle. The Bird’s-Eye Plot displays the detections.

Export the detections.

  • To export detections to the MATLAB workspace, on the app toolstrip, select Export > Export Sensor Data. Name the workspace variable and click OK. The app saves the sensor data as a structure containing the actor poses, object detections, and lane detections at each time step.

  • To export a MATLAB function that generates the scenario and its detections, select Export > Export MATLAB Function. This function returns the sensor detections as a structure, the scenario as a drivingScenario object, and the sensor models as visionDetectionGenerator and radarDetectionGenerator System objects. By modifying this function, you can create variations of the original scenario. For an example of this process, see Create Driving Scenario Variations Programmatically.

Save Scenario

Because prebuilt scenarios are read-only, save a copy of the driving scenario to a new folder. To save the scenario file, on the app toolstrip, select Save > Scenario File As.

You can reopen this scenario file from the app. Alternatively, at the MATLAB command prompt, you can use this syntax.

drivingScenarioDesigner(scenarioFileName)
You can also reopen the scenario by using the exported drivingScenario object. At the MATLAB command prompt, use this syntax.
drivingScenarioDesigner(scenario)
If you are developing a driving algorithm in Simulink®, you can use a Scenario Reader block to read roads and actors from the scenario file or drivingScenario object into your model. This block does not directly read sensor data. To add sensors created in the app to a Simulink model, you can generate a model containing your scenario and sensors by selecting Export > Export Simulink Model. In this model, a Scenario Reader block reads the scenario and Radar Detection Generator and Vision Detection Generator blocks model the sensors.

See Also

Apps

Objects

Related Topics