Driving Scenario Designer

Design driving scenarios, configure sensors, and generate synthetic object detections

Description

The Driving Scenario Designer app enables you to design synthetic driving scenarios for testing your autonomous driving systems.

Using the app, you can:

  • Create road and actor models using a drag-and-drop interface.

  • Configure vision and radar sensors mounted on the ego vehicle, and use these sensors to simulate detections of actors and lane boundaries in the scenario.

  • Load driving scenarios representing European New Car Assessment Programme (Euro NCAP®) test protocols [1][2][3] and other prebuilt scenarios.

  • Import OpenDRIVE® roads and lanes into a driving scenario. The app supports OpenDRIVE format specification version 1.4H [4].

  • Export sensor detections to MATLAB®, or generate MATLAB code of the scenario that produced the detections.

  • Import the driving scenario into Simulink® model by using a Scenario Reader block. You can use the imported scenario to test your sensor fusion or vehicle control algorithms.

To learn more about using the app, see Driving Scenario Designer.

Open the Driving Scenario Designer App

  • MATLAB Toolstrip: On the Apps tab, under Automotive, click the app icon.

  • MATLAB command prompt: Enter drivingScenarioDesigner.

Examples

expand all

Build a driving scenario of a vehicle driving down a curved road, and export the road and vehicle models to the MATLAB workspace. For a more detailed example of building a driving scenario, see Build a Driving Scenario and Generate Synthetic Detections.

Open the Driving Scenario Designer app.

drivingScenarioDesigner

Create a curved road. From the app toolstrip, click Add Road. Click the bottom of the canvas, extend the road path to the middle of the canvas, and click the canvas again. Extend the road path to the top of the canvas, and then double-click to create the road. To make the curve more complex, click and drag the road centers (open circles), or double-click the road to add more road centers.

Add lanes to the road. In the left pane, on the Roads tab, expand the Lanes section. Set the Number of lanes to 2.

By default, the road is one-way and has solid lane markings on either side to indicate the shoulder.

Add a vehicle at one end of the road. From the app toolstrip, select Add Actor > Car. Then click the road to set the initial position of the car.

Set the driving path of the car. Right-click the car, select Add Waypoints, and add waypoints for the car to pass through. After you add the last waypoint, press Enter. The car autorotates in the direction of the first waypoint.

Adjust the speed of the car as it passes between waypoints. In the left pane, on the Actors tab, in the Path section, clear the Constant Speed check box. Then, in the Waypoints table, set the velocity, v (m/s), of the car in m/s as it enters each waypoint segment. To model more realistic conditions, increase the speed of the car for the straight segments and decrease its speed for the curved segments. For example:

Run the scenario, and adjust settings as needed. Then click Save > Roads & Actors to save the road and car models to a MAT-file.

Generate vision sensor detections from a prebuilt driving scenario of a Euro NCAP test protocol.

Load a Euro NCAP autonomous emergency braking (AEB) scenario of a collision with a pedestrian child. At collision time, the point of impact occurs 50% of the way across the width of the car.

path = fullfile(matlabroot,'toolbox','driving','drivingdata', ...
    'PrebuiltScenarios','EuroNCAP');
addpath(genpath(path)) % Add folder to path
drivingScenarioDesigner('AEB_PedestrianChild_Nearside_50width.mat')
rmpath(path) % Remove folder from path

Add a front-facing radar sensor to the ego vehicle. First click Add Radar. Then, on the Sensor Canvas, click the predefined sensor location at the front window of the car. By default, the radar is long-range.

Run the scenario. While the scenario simulation runs, inspect different aspects of the simulation by toggling between canvases and views. You can toggle between the Sensor Canvas and Scenario Canvas and between the Bird's-Eye Plot and Ego-Centric View.

Export the sensor data to the MATLAB workspace. Click Export > Export Sensor Data, enter a workspace variable name, and click OK.

Import an OpenDRIVE road network into the Driving Scenario Designer app. For a more detailed example, see Add OpenDRIVE Roads to Driving Scenario.

Open the Driving Scenario Designer app.

drivingScenarioDesigner

From the app toolstrip, select Open > OpenDRIVE Road Network. Then, from your MATLAB root folder, navigate to and open this file:

matlabroot/toolbox/driving/drivingdata/intersection.xodr
Inspect the road network by zooming in on the scenario.

Related Examples

Programmatic Use

expand all

drivingScenarioDesigner opens the Driving Scenario Designer app.

drivingScenarioDesigner(scenarioFileName) opens the app and loads the specified scenario MAT-file into the app. This file must be a scenario file saved from the app. This file can include all roads, actors, and sensors in the scenario. It can also include only the roads and actors component, or only the sensors component.

If the scenario file is not in the current folder or not in a folder on the MATLAB path, specify the full path name. For example:

drivingScenarioDesigner('C:\Desktop\myDrivingScenario.mat');

You can also load prebuilt scenario files. Before loading a prebuilt scenario, add the folder containing the scenario to the MATLAB path. For an example, see Generate Detections from Prebuilt Scenario.

Limitations

Euro NCAP Limitations

  • Scenarios of speed assistance systems (SAS) are not supported. These scenarios require the detection of speed limits from traffic signs, which the app does not support.

OpenDRIVE Limitations

  • You can import only lanes and roads. The import of road objects and traffic signals is not supported.

  • OpenDRIVE files containing large road networks can take up to several minutes to load. In addition, these road networks can cause slow interactions on the app canvas. Examples of large road networks include ones that model the roads of a city or ones with roads that are thousands of meters long.

  • Lanes with variable widths are not supported. The width is set to the highest width found within that lane. For example, if a lane has a width that varies from 2 meters to 4 meters, the app sets the lane width to 4 meters throughout.

  • Roads with multiple lane marking styles are not supported. The app applies the first found marking style to all lanes in the road. For example, if a road has Dashed and Solid lane markings, the app applies Dashed lane markings throughout.

  • Lane marking styles Bott Dots, Curbs, and Grass are not supported. Lanes with these marking styles are imported as unmarked.

More About

expand all

Tips

  • You can undo (press Ctrl+Z) and redo (press Ctrl+Y) changes you make on the scenario and sensor canvases. For example, you can use these shortcuts to delete a recently placed road center or redo the movement of a radar sensor.

  • During simulation, the default camera and radar sensors update every 100 ms (Update Interval (ms) = 100). To ensure that the app samples and displays the detections found at these intervals, the update interval must be an integer multiple of the app sample time. By default, the app samples the simulation every 10 ms (Sample Time (ms) = 10). For more details on the app sample time, see Sample Time.

Compatibility Considerations

expand all

Behavior changed in R2018b

References

[1] European New Car Assessment Programme. Euro NCAP Assessment Protocol - SA. Version 8.0.2. January 2018.

[2] European New Car Assessment Programme. Euro NCAP AEB C2C Test Protocol. Version 2.0.1. January 2018.

[3] European New Car Assessment Programme. Euro NCAP LSS Test Protocol. Version 2.0.1. January 2018.

[4] Dupuis, Marius, et al. OpenDRIVE Format Specification. Revision 1.4, Issue H, Document No. VI2014.106. Bad Aibling, Germany: VIRES Simulationstechnologie GmbH, November 4, 2015.

Introduced in R2018a