Main Content

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 and cuboid versions of the prebuilt scenes used in the 3D simulation environment.

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.

Vehicle and bicycle collision at intersection

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.

Vehicle and pedestrian side-by-side in same lane

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.

Vehicles crossing at intersection

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.

Vehicles crossing at intersection

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.

Two vehicles in roundabout with a pedestrian crossing the road leading up to the roundabout

Simulation 3D

These scenarios are cuboid versions of several of the prebuilt scenes available in the 3D simulation environment. You can add vehicles and trajectories to these scenarios. Then, you can include these vehicles and trajectories in your Simulink® model to simulate them in the 3D environment. This environment is rendered using the Unreal Engine® from Epic Games®. For more details on these scenarios, see Cuboid Versions of 3D Simulation Scenes in Driving Scenario Designer.

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.

Vehicle turning from the left at an intersection to pull in front of another 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.

Vehicle turning from the right at an intersection to pull in front of another 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.

Vehicle turning left at an intersection as the other vehicle continues straight

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.

Vehicle turning right at an intersection as the other vehicle continues straight

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.

Vehicle turning left at an intersection as a pedestrian crosses the road from left to right

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.

Vehicle turning left at an intersection as a pedestrian crosses the road from top to bottom

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.

Vehicle turning left at an intersection as another vehicle travels straight

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.

One vehicle turns right at an intersection and the other goes straight

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.

One vehicle makes a U-turn at an intersection and the other goes straight through the intersection

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.

A vehicle makes a U-turn at an intersection while a pedestrian crosses the road

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.

One vehicle makes a U-turn at an intersection and the other goes straight through the intersection

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.

One vehicle makes a U-turn at an intersection,another vehicle turns left at the intersection, and another vehicle goes straight through the intersection

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.

One vehicle makes a U-turn at an intersection and other vehicle turns left at the intersection

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.

One vehicle makes a U-turn at an intersection and other vehicle turns right at the intersection

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 Sensor Data

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.

Bird's-eye plot of a prebuilt scenario with three vehicles. The camera sensor coverage area on the ego vehicle is shown in light blue, the object detections are shown as blue circles, and the lane detections are in red

Export the sensor data.

  • To export sensor data 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 sensor data such as the actor poses, object detections, and lane detections at each time step.

  • To export a MATLAB function that generates the scenario and its sensor data, select Export > Export MATLAB Function. This function returns the sensor data as a structure, the scenario as a drivingScenario object, and the sensor models as 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, where scenario is the name of the exported object.
drivingScenarioDesigner(scenario)
To reopen sensors, use this syntax, where sensors is a sensor object or a cell array of such objects.
drivingScenarioDesigner(scenario,sensors)
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 that you created in the app to a Simulink model, generate a model containing your scenario and sensors by selecting Export > Export Simulink Model. In the model, the generated Scenario Reader block reads the scenario and the generated sensor blocks define the sensors.

See Also

Apps

Blocks

Objects

Related Topics