Generate Synthetic Detections from a Prebuilt Driving Scenario

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. You can generate synthetic vision and radar detections from these prebuilt scenarios. You can then use these detections to test your vehicle controllers or sensor fusion algorithms.

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 Generate Synthetic Detections from a Euro NCAP Scenario.

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. The pedestrian travels at a slower pace than the ego vehicle.

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 and crosses through the intersection first.

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 passes a truck 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 crosses 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 crosses 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 lane goes straight and crosses the path of the U-turn.

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 and goes in front of the ego vehicle.

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 behind the 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.

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, from 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 the detections to the MATLAB workspace, from the app toolstrip, click Export > Export Sensor Data. Name the workspace variable and click OK.

  • To export a MATLAB function that generates the scenario and its detections, click Export > Export MATLAB Function. The scenario is a drivingScenario object. The sensor detections are generated by visionDetectionGenerator and radarDetectionGenerator System objects. To adjust the parameters of the scenario, you can update the code in the exported function directly. To generate new detections, call the exported function.

Save Scenario

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

You can reopen this scenario file from within the app or by using this syntax at the MATLAB command prompt:

drivingScenarioDesigner(scenarioFileName)

If you are developing a driving algorithm in Simulink®, you can use a Scenario Reader block to read the roads and actors from this file into your model. However, because the block does not support reading in sensor data, the sensor you created is ignored. You must instead create the sensors within your model, using blocks such as Radar Detection Generator and Vision Detection Generator.

See Also

Apps

Classes

Related Topics