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 synthetic sensor detections to MATLAB®.

  • Generate MATLAB code of the scenario and sensors, and then programmatically modify the scenario and import it back into the app for further simulation.

  • Generate a Simulink® model from the scenario and sensors, and use the generated models to test your sensor fusion or vehicle control algorithms.

To learn more about 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. On 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. On 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','shared','drivingscenario', ...
    '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.

Create a driving scenario programmatically and import that scenario into the app. For more details on working with programmatic driving scenarios, see Create Driving Scenario Variations Programmatically.

Create a simple driving scenario by using a drivingScenario object. In this scenario, the ego vehicle travels straight on a 50-meter road segment at a constant speed of 30 meters per second. For the ego vehicle, specify a ClassID of 1. This value corresponds to the app Class ID of 1, which refers to actors of class Car. For more details on how the app defines classes, see the Class parameter description under Actors.

scenario = drivingScenario;
roadCenters = [0 0 0; 50 0 0];
road(scenario, roadCenters);

egoVehicle = vehicle(scenario,'ClassID',1,'Position',[5 0 0]);
waypoints = [5 0 0; 45 0 0];
speed = 30;
trajectory(egoVehicle,waypoints,speed);

Import the scenario into the app. Then, run the scenario or modify it. To generate a new drivingScenario object, on the app toolstrip, select Export > Export MATLAB Function, and then run the generated function.

drivingScenarioDesigner(scenario)

Import roads and lanes from an OpenDRIVE road network into the Driving Scenario Designer app. For a more detailed example, see Import OpenDRIVE Roads into Driving Scenario.

Open the Driving Scenario Designer app.

drivingScenarioDesigner

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

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

Load a driving scenario containing a sensor and generate a Simulink model from the scenario and sensor. For a more detailed example on generating Simulink models from the app, see Generate Sensor Detection Blocks Using Driving Scenario Designer.

Load a prebuilt driving scenario into the app. The scenario contains two vehicles crossing through an intersection. The ego vehicle travels north and contains a camera sensor. This sensor is configured to detect both objects and lanes.

path = fullfile(matlabroot,'toolbox','shared','drivingscenario','PrebuiltScenarios');
addpath(genpath(path)) % Add folder to path
drivingScenarioDesigner('EgoVehicleGoesStraight_VehicleFromLeftGoesStraight.mat')
rmpath(path) % Remove folder from path

Generate a Simulink model of the scenario and sensor. On the app toolstrip, select Export > Export Simulink Model. If you are prompted, save the scenario file.

The Scenario Reader block reads the road and actors from the scenario file. To update the scenario data in the model, update the scenario in the app and save the file.

The Vision Detection Generator block recreates the camera sensor defined in the app. To update the sensor in the model, update the sensor in the app, select Export > Export Sensor Simulink Model, and copy the newly generated sensor block into the model. If you updated any roads or actors while updating the sensors, then select Export > Export Simulink Model. In this case, the Scenario Reader block accurately reads the actor profile data and passes it to the sensor.

Parameters

To enable the Roads parameters, add at least one road to the scenario. Then, select a road from either the Scenario Canvas or the Road parameter. The parameter values in the Roads tab are based on the road you select.

ParameterDescription
Road

Road to modify, specified as a list of the roads in the scenario.

Name

Name of road.

Width (m)

Width of the road, in meters, specified as a decimal scalar in the range (0, 50].

If the curvature of the road is too sharp to accommodate the specified road width, the app does not generate the road.

Default: 6

Bank Angle (deg)

Side-to-side incline of the road, in degrees, specified as one of these values:

  • Decimal scalar — Applies a uniform bank angle along the entire length of the road

  • N-element vector of decimal values — Applies a different bank angle to each road center, where N is the number of road centers in the selected road

When you add an actor to a road, you do not have to change the actor position to match the bank angles specified by this parameter. The actor automatically follows the bank angles of the road.

Default: 0

Lanes

ParameterDescription
Number of lanes

Number of lanes in the road, specified as one of these values:

  • Integer, M, in the range [1, 30] — Creates an M-lane road whose default lane markings indicate that the road is one-way.

  • Two-element vector, [M N], where M and N are positive integers whose sum must be in the range [2, 30] — Creates a road with (M + N) lanes. The default lane markings of this road indicate that it is two-way. The first M lanes travel in one direction. The next N lanes travel in the opposite direction.

If you increase the number of lanes, the added lanes are of the width specified in the Lane Width (m) parameter. If Lane Width (m) is a vector of differing lane widths, then the added lanes are of the width specified in the last vector element.

Lane Width (m)

Width of each lane in the road, in meters, specified as one of these values:

  • Decimal scalar in the range (0, 50] — The same width applies to all lanes.

  • N-element vector of decimal values in the range (0, 50] — A different width applies to each lane, where N is the total number of lanes specified in the Number of lanes parameter.

The width of each lane must be greater than the width of the lane markings it contains. These lane markings are specified by the Marking > Width (m) parameter.

Marking

Lane marking to modify, specified as a list of lane markings in the selected road.

A road with N lanes has (N + 1) lane markings.

Marking > Type

Type of lane marking, specified as one of these values:

  • Unmarked — No lane marking

  • Solid — Solid line

  • Dashed — Dashed line

  • DoubleSolid — Two solid lines

  • DoubleDashed — Two dashed lines

  • SolidDashed — Solid line on left, dashed line on right

  • DashedSolid — Dashed line on left, solid line on right

By default, for a one-way road, the leftmost lane is solid and yellow, the rightmost lane is solid and white, and the inner lanes are dashed and white. For two-way roads, the dividing lane marking is two solid yellow lines.

Marking > Color

Color of lane marking, specified as an RGB triplet or color name.

For a custom color, specify an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0, 1]; for example, [0.4 0.6 0.7]. Alternatively, you can specify some common colors by name. This table lists the named color options and the equivalent RGB triplet values.

Color NameRGB Triplet
red[1 0 0]
green[0 1 0]
blue[0 0 1]
cyan [0 1 1]
magenta[1 0 1]
yellow[0.98 0.86 0.36]
black[0 0 0]
white[1 1 1]

For a double lane marker, the same color is used for both lines.

Marking > Strength

Saturation strength of lane marking color, specified as a decimal scalar in the range [0, 1].

  • A value of 0 corresponds to a marking whose color is fully unsaturated. The marking appears as gray.

  • A value of 1 corresponds to a marking whose color is fully saturated.

For a double lane marking, the same strength is used for both lines.

Default: 1

Marking > Width (m)

Width of lane marking, in meters, specified as a positive decimal scalar.

The width of the lane marking must be less than the width of its enclosing lane. The enclosing lane is the lane directly to the left of the lane marking.

For a double lane marker, the same width is used for both lines.

Default: 0.15

Marking > Length (m)

Length of dashes in dashed lane markings, in meters, specified as a positive decimal scalar in the range (0, 50].

For a double lane marking, the same length is used for both lines.

Default: 3

Marking > Space (m)

Length of spaces between dashes in dashed lane markings, in meters, specified as a decimal scalar in the range (0, 150].

Default: 9

Road Centers

Each row of the Road Centers table contains the x-, y-, and z-positions of a road center within the selected road. All roads must have at least two unique road center positions. When you update the cell within the table, the Scenario Canvas updates to reflect the new road center position.

ParameterDescription
x (m)x-axis position of the road center, in meters, specified as a decimal scalar.
y (m)y-axis position of the road center, in meters,specified as a decimal scalar.
z (m)

z-axis position of the road center, in meters, specified as a decimal scalar.

  • The z-axis specifies the elevation of the road. If the elevation between road centers is too abrupt, adjust these elevation values.

  • When you add an actor to a road, you do not have to change the actor position to match changes in elevation. The actor automatically follows the elevation of the road.

  • When two elevated roads form a junction, the elevation around that junction can vary widely. The exact amount of elevation depends on how close the road centers of each road are to each other. If you try to place an actor at the junction, the app might be unable to compute the precise elevation of the actor. In this case, the app cannot place the actor at that junction.

    To address this issue, in the Scenario Canvas, modify the intersecting roads by moving the road centers of each road away from each other. Alternatively, manually adjust the elevation of the actor to match the elevation of the road surface.

Default: 0

To enable the Actors parameters, add at least one actor to the scenario. Then, select an actor from either the Scenario Canvas or from the list on the Actors tab. The parameter values in the Actors tab are based on the actor you select.

ParameterDescription
Set as Ego Vehicle

Set the selected actor as the ego vehicle in the scenario.

When you add sensors to your scenario, the app adds them to the ego vehicle. In addition, the Ego-Centric View and Bird's-Eye Plot windows display simulations from the perspective of the ego vehicle.

Only actors who have vehicle classes, such as Car or Truck, can be set as the ego vehicle. For more details on actor classes, see the Class parameter description.

Name

Name of actor.

Class

Class of actor, specified as the list of classes to which you can change the selected actor.

You can change the class of vehicle actors only to other vehicle classes, such as Car and Truck. Similarly, you can change the class of nonvehicle actors only to other nonvehicle classes, such as Pedestrian, Bicycle, and Barrier.

The list of vehicle and nonvehicle classes appear in the app toolstrip, in the Add Actor > Vehicles and Add Actor > Other sections, respectively.

Actors created in the app have default set of dimensions, radar cross-section patterns, and other properties based on their Class ID value. The table shows the default Class ID values and actor classes.

Class IDActor Class
1Car
2Truck
3Bicycle
4Pedestrian
5Barrier

To modify actor classes or create new actor classes, on the app toolstrip, select Add Actor > Edit Actor Classes or Add Actor > New Actor Class, respectively.

Actor Properties

Actor properties include the position and orientation of an actor.

ParameterDescription
Length (m)

Length of actor, in meters, specified as a decimal scalar in the range (0, 60].

For vehicles, the length must be greater than (Front Overhang + Rear Overhang).

Width (m)

Width of actor, in meters, specified as a decimal scalar in the range (0, 20].

Height (m)

Height of actor, in meters, specified as a decimal scalar in the range (0, 20].

Front Overhang

Distance between the front axle and front bumper, in meters, specified as a decimal scalar.

The front overhang must be less than (Length (m)Rear Overhang).

This parameter applies to vehicles only.

Default: 0.9

Rear Overhang

Distance between the rear axle and rear bumper, in meters, specified as a decimal scalar.

The rear overhang must be less than (Length (m)Front Overhang).

This parameter applies to vehicles only.

Default: 1

Roll

Orientation angle of the actor about its x-axis, in degrees, specified as a decimal scalar.

Roll is clockwise-positive when looking in the forward direction of the x-axis, which points forward from the actor.

When you export the MATLAB function of the driving scenario and run that function, the roll angles of actors in the output scenario are wrapped to the range [–180, 180].

Default: 0

Pitch

Orientation angle of the actor about its y-axis, in degrees, specified as a decimal scalar.

Pitch is clockwise-positive when looking in the forward direction of the y-axis, which points to the left of the actor.

When you export the MATLAB function of the driving scenario and run that function, the pitch angles of actors in the output scenario are wrapped to the range [–180, 180].

Default: 0

Yaw

Orientation angle of the actor about its z-axis, in degrees, specified as a decimal scalar.

Yaw is clockwise-positive when looking in the forward direction of the z-axis, which points up from the ground. However, the Scenario Canvas has a bird's-eye-view perspective that looks in the reverse direction of the z-axis. Therefore, when viewing actors on this canvas, Yaw is counterclockwise-positive.

When you export the MATLAB function of the driving scenario and run that function, the yaw angles of actors in the output scenario are wrapped to the range [–180, 180].

Default: 0

Radar Cross Section

Use these parameters to manually specify the radar cross-section (RCS) of an actor. Alternatively, to import an RCS from a file or from the MATLAB workspace, expand this parameter section and click Import.

ParameterDescription
Azimuth Angles (deg)

Horizontal reflection pattern of actor, in degrees, specified as a vector of monotonically increasing decimal values in the range [–180, 180].

Default: [-180 180]

Elevation Angles (deg)

Vertical reflection pattern of actor, in degrees, specified as a vector of monotonically increasing decimal values in the range [–90, 90].

Default: [-90 90]

Pattern (dBsm)

RCS pattern, in decibels per square meter, specified as a Q-by-P table of decimal values. RCS is a function of the azimuth and elevation angles, where:

  • Q is the number of elevation angles specified by the Elevation Angles (deg) parameter.

  • P is the number of azimuth angles specified by the Azimuth Angles (deg) parameter.

Trajectory

Manually set or modify the positions and velocities of actors at their specified waypoints.

ParameterDescription
Constant Speed (m/s)

Select this parameter to set a constant speed for the actor through all of its waypoints. Specify this constant speed as a positive decimal scalar in meters per second.

If you clear this parameter, use the Waypoints table to specify the velocity of the actor at each waypoint.

Default: 30

Waypoints

Actor waypoints, specified as a table.

Each table row contains the position and velocity information of a waypoint. Table columns are as follows:

  • x (m) — World coordinate x-position of each waypoint, in meters.

  • y (m) — World coordinate y-position of each waypoint, in meters.

  • z (m) — World coordinate z-position of each waypoint, in meters.

  • v (m/s) — Vehicle velocity, in meters per second, at each waypoint. This column applies only when you disable the Constant Speed (m/s) parameter.

To access these parameters, add at least one camera sensor to the scenario by following these steps:

  1. on the app toolstrip, click Add Camera.

  2. From the Sensors tab, select the sensor from the list. The parameter values in this tab are based on the sensor you select.

ParameterDescription
EnabledEnable or disable the selected sensor. Select this parameter to capture sensor data during simulation and visualize that data in the Bird's-Eye Plot pane.
NameName of sensor.
Update Interval (ms)

Frequency at which the sensor updates, in milliseconds, specified as an integer multiple of the app sample time defined under Settings, in the Sample Time (ms) parameter.

The default Update Interval (ms) value of 100 is an integer multiple of the default Sample Time (ms) parameter value of 10. Having the update interval be a multiple of the sample time ensures that the app samples and displays the detections found at these intervals during simulation.

If you update the app sample time such that a sensor is no longer a multiple of the app sample time, the app prompts you with the option to automatically update the Update Interval (ms) parameter to the closest integer multiple.

Default: 100

TypeType of sensor, specified as either Radar for radar sensors or Vision for camera sensors.

Sensor Placement

ParameterDescription
X (m)

X-axis position of the sensor in the vehicle coordinate system, in meters, specified as a decimal scalar.

The X-axis points forward from the vehicle. The origin is located at the center of the vehicle's rear axle.

Y (m)

Y-axis position of the sensor in the vehicle coordinate system, in meters, specified as a decimal scalar.

The Y-axis points to the left of the vehicle. The origin is located at the center of the vehicle's rear axle.

Height (m)

Height of the sensor above the ground, in meters, specified as a positive decimal scalar.

Default: 1.1

Roll

Orientation angle of the sensor about its X-axis, in degrees, specified as a decimal scalar.

Roll is clockwise-positive when looking in the forward direction of the X-axis, which points forward from the sensor.

Default: 0

Pitch

Orientation angle of the sensor about its Y-axis, in degrees, specified as a decimal scalar.

Pitch is clockwise-positive when looking in the forward direction of the Y-axis, which points to the left of the sensor.

Default: 1

Yaw

Orientation angle of the sensor about its Z-axis, in degrees, specified as a decimal scalar.

Yaw is clockwise-positive when looking in the forward direction of the Z-axis, which points up from the ground. However, the Sensor Canvas has a bird's-eye-view perspective that looks in the reverse direction of the Z-axis. Therefore, when viewing sensor coverage areas on this canvas, Yaw is counterclockwise-positive.

Camera Settings

ParameterDescription
Focal Length X

Horizontal point at which the camera is in focus, in pixels, specified as a positive decimal scalar.

The default focal length changes depending on where you place the sensor on the ego vehicle.

Focal Length Y

Vertical point at which the camera is in focus, in pixels, specified as a positive decimal scalar.

The default focal length changes depending on where you place the sensor on the ego vehicle.

Image Width

Horizontal camera resolution, in pixels, specified as a positive integer.

Default: 640

Image Height

Vertical camera resolution, in pixels, specified as a positive integer.

Default: 480

Principal Point X

Horizontal image center, in pixels, specified as a positive decimal scalar.

Default: 320

Principal Point Y

Vertical image center, in pixels, specified as a positive decimal scalar.

Default: 240

Detection Parameters

To view all camera detection parameters in the app, expand the Sensor Limits, Lane Settings, and Accuracy & Noise Settings sections.

ParameterDescription
Detection Type

Type of detections reported by camera, specified as one of these values:

  • Objects — Report object detections only.

  • Objects & Lanes — Report object and lane boundary detections.

  • Lanes — Report lane boundary detections only.

Default: Objects

Detection Probability

Probability that the camera detects an object, specified as a decimal scalar in the range (0, 1].

Default: 0.9

False Positives Per Image

Number of false positives reported per update interval, specified as a nonnegative decimal scalar. This value must be less than or equal to the maximum number of detections specified in the Limit # of Detections parameter.

Default: 0.1

Limit # of Detections

Select this parameter to limit the number of simultaneous object detections that the sensor reports. Specify Limit # of Detections as a positive integer less than 263.

To enable this parameter, set the Detection Type parameter to Objects or Objects & Lanes.

Default: off

Detection Coordinates

Coordinate system of output detection locations, specified as one of these values:

  • Ego Cartesian — The app outputs detections in the coordinate system of the ego vehicle.

  • Sensor Cartesian — The app outputs detections in the coordinate system of the sensor.

Default: Ego Cartesian

Sensor Limits

ParameterDescription
Max Speed (m/s)

Fastest relative speed at which the camera can detect objects, in meters per second, specified as a nonnegative decimal scalar.

Default: 50

Max Range (m)

Farthest distance at which the camera can detect objects, in meters, specified as a positive decimal scalar.

Default: 150

Max Allowed Occlusion

Maximum percentage of object that can be blocked while still being detected, specified as a decimal scalar in the range [0, 1).

Default: 0.5

Min Object Image Width

Minimum horizontal size of objects that the camera can detect, in pixels, specified as positive decimal scalar.

Default: 15

Min Object Image Height

Minimum vertical size of objects that the camera can detect, in pixels, specified as positive decimal scalar.

Default: 15

Lane Settings

ParameterDescription
Lane Update Interval (ms)

Frequency at which the sensor updates lane detections, in milliseconds, specified as a decimal scalar.

Default: 100

Min Lane Image Width

Minimum horizontal size of objects that the sensor can detect, in pixels, specified as a decimal scalar.

To enable this parameter, set the Detection Type parameter to Lanes or Objects & Lanes.

Default: 3

Min Lane Image Height

Minimum vertical size of objects that the sensor can detect, in pixels, specified as a decimal scalar.

To enable this parameter, set the Detection Type parameter to Lanes or Objects & Lanes.

Default: 20

Boundary Accuracy

Accuracy with which the sensor places a lane boundary, in pixels, specified as a decimal scalar.

To enable this parameter, set the Detection Type parameter to Lanes or Objects & Lanes.

Default: 3

Limit # of Lanes

Select this parameter to limit the number of lane detections that the sensor reports. Specify Limit # of Lanes as a positive integer.

To enable this parameter, set the Detection Type parameter to Lanes or Objects & Lanes.

Default: off

Accuracy & Noise Settings

ParameterDescription
Bounding Box Accuracy

Positional noise used for fitting bounding boxes to targets, in pixels, specified as a positive decimal scalar.

Default: 5

Process Noise Intensity (m/s^2)

Noise intensity used for smoothing position and velocity measurements, in meters per second squared, specified as a positive decimal scalar.

Default: 5

Has Noise

Select this parameter to enable adding noise to sensor measurements.

Default: off

To access these parameters, add at least one radar sensor to the scenario.

  1. On the app toolstrip, click Add Radar.

  2. On the Sensors tab, select the sensor from the list. The parameter values changes based on the sensor you select.

ParameterDescription
EnabledEnable or disable the selected sensor. Select this parameter to capture sensor data during simulation and visualize that data in the Bird's-Eye Plot pane.
NameName of sensor.
Update Interval (ms)

Frequency at which the sensor updates, in milliseconds, specified as an integer multiple of the app sample time defined under Settings, in the Sample Time (ms) parameter.

The default Update Interval (ms) value of 100 is an integer multiple of the default Sample Time (ms) parameter value of 10. Having the update interval be a multiple of the sample time ensures that the app samples and displays the detections found at these intervals during simulation.

If you update the app sample time such that a sensor is no longer a multiple of the app sample time, the app prompts you with the option to automatically update the Update Interval (ms) parameter to the closest integer multiple.

Default: 100

TypeType of sensor, specified as either Radar for radar sensors or Vision for camera sensors.

Sensor Placement

ParameterDescription
X (m)

X-axis position of the sensor in the vehicle coordinate system, in meters, specified as a decimal scalar.

The X-axis points forward from the vehicle. The origin is located at the center of the vehicle's rear axle.

Y (m)

Y-axis position of the sensor in the vehicle coordinate system, in meters, specified as a decimal scalar.

The Y-axis points to the left of the vehicle. The origin is located at the center of the vehicle's rear axle.

Height (m)

Height of the sensor above the ground, in meters, specified as a positive decimal scalar.

Default: 1.1

Roll

Orientation angle of the sensor about its X-axis, in degrees, specified as a decimal scalar.

Roll is clockwise-positive when looking in the forward direction of the X-axis, which points forward from the sensor.

Default: 0

Pitch

Orientation angle of the sensor about its Y-axis, in degrees, specified as a decimal scalar.

Pitch is clockwise-positive when looking in the forward direction of the Y-axis, which points to the left of the sensor.

Default: 1

Yaw

Orientation angle of the sensor about its Z-axis, in degrees, specified as a decimal scalar.

Yaw is clockwise-positive when looking in the forward direction of the Z-axis, which points up from the ground. However, the Sensor Canvas has a bird's-eye-view perspective that looks in the reverse direction of the Z-axis. Therefore, when viewing sensor coverage areas on this canvas, Yaw is counterclockwise-positive.

Detection Parameters

To view all radar detection parameters in the app, expand the Advanced Parameters and Accuracy & Noise Settings sections.

ParameterDescription
Detection Probability

Probability that the radar detects an object, specified as a decimal scalar in the range (0, 1].

Default: 0.9

False Alarm Rate

Probability of a false detection per resolution rate, specified as a decimal scalar in the range [1e-07, 1e-03].

Default: 1e-06

Field of View Azimuth

Horizontal field of view of radar, in degrees, specified as a positive decimal scalar.

Default: 20

Field of View Elevation

Vertical field of view of radar, in degrees, specified as a positive decimal scalar.

Default: 5

Max Range (m)

Farthest distance at which the radar can detect objects, in meters, specified as a positive decimal scalar.

Default: 150

Range Rate Min, Range Rate Max

Select this parameter to set minimum and maximum range rate limits for the radar. Specify Range Rate Min and Range Rate Max as decimal scalars, in meters per second, where Range Rate Min is less than Range Rate Max.

Default (Min): -100

Default (Max): 100

Has Elevation

Select this parameter to enable the radar to measure the elevation of objects. This parameter enables the elevation parameters in the Accuracy & Noise Settings section.

Default: off

Has Occlusion

Select this parameter to enable the radar to model occlusion.

Default: on

Advanced Parameters

ParameterDescription
Reference Range

Reference range for a given probability of detection, in meters, specified as a positive decimal scalar.

The reference range is the range at which the radar detects a target of the size specified by Reference RCS, given the probability of detection specified by Detection Probability.

Default: 100

Reference RCS

Reference RCS for a given probability of detection, in decibels per square meter, specified as a nonnegative decimal scalar.

The reference RCS is the target size at which the radar detects a target, given the reference range specified by Reference Range and the probability of detection specified by Detection Probability.

Default: 0

Limit # of Detections

Select this parameter to limit the number of simultaneous detections that the sensor reports. Specify Limit # of Detections as a positive integer less than 263.

Default: off

Detection Coordinates

Coordinate system of output detection locations, specified as one of these values:

  • Ego Cartesian — The app outputs detections in the coordinate system of the ego vehicle.

  • Sensor Cartesian — The app outputs detections in the coordinate system of the sensor.

Default: Ego Cartesian

Accuracy & Noise Settings

ParameterDescription
Azimuth Resolution

Minimum separation in azimuth angle at which the radar can distinguish between two targets, in degrees, specified as a positive decimal scalar.

The azimuth resolution is typically the 3 dB downpoint in the azimuth angle beamwidth of the radar.

Default: 4

Azimuth Bias Fraction

Maximum azimuth accuracy of the radar, specified as a nonnegative decimal scalar.

The azimuth bias is expressed as a fraction of the azimuth resolution specified by the Azimuth Resolution parameter. Units are dimensionless.

Default: 0.1

Elevation Resolution

Minimum separation in elevation angle at which the radar can distinguish between two targets, in degrees, specified as a positive decimal scalar.

The elevation resolution is typically the 3 dB downpoint in the elevation angle beamwidth of the radar.

To enable this parameter, in the Detection Parameters section, select the Has Elevation parameter.

Default: 10

Elevation Bias Fraction

Maximum elevation accuracy of the radar, specified as a nonnegative decimal scalar.

The elevation bias is expressed as a fraction of the elevation resolution specified by the Elevation Resolution parameter. Units are dimensionless.

To enable this parameter, under Detection Parameters, select the Has Elevation parameter.

Default: 0.1

Range Resolution

Minimum range separation at which the radar can distinguish between two targets, in meters, specified as a positive decimal scalar.

Default: 2.5

Range Bias Fraction

Maximum range accuracy of the radar, specified as a nonnegative decimal scalar.

The range bias is expressed as a fraction of the range resolution specified in the Range Resolution parameter. Units are dimensionless.

Default: 0.05

Range Rate Resolution

Minimum range rate separation at which the radar can distinguish between two targets, in meters per second, specified as a positive decimal scalar.

To enable this parameter, in the Detection Parameters section, select the Range Rate Min, Range Rate Max parameter and set the range rate values.

Default: 0.5

Range Rate Bias Fraction

Maximum range rate accuracy of the radar, specified as a nonnegative decimal scalar.

The range rate bias is expressed as a fraction of the range rate resolution specified in the Range Rate Resolution parameter. Units are dimensionless.

To enable this parameter, under the Detection Parameters section, select the Range Rate Min, Range Rate Max parameter and set the range rate values.

Default: 0.05

Has Noise

Select this parameter to enable adding noise to sensor measurements.

Default: off

Has False Alarms

Select this parameter to enable false alarms in sensor detections.

Default: off

To access these parameters, on the app toolstrip, click Settings.

Simulation Settings

ParameterDescription
Sample Time (ms)

Frequency at which the simulation updates, in milliseconds.

Increase the sample time to speed up simulation. This increase has no effect on actor speeds, even though actors can appear to go faster during simulation. The actor positions are just being sampled and displayed on the app at less frequent intervals, resulting in faster, choppier animations. Decreasing the sample time results in smoother animations, but the actors appear to move slower, and the simulation takes longer.

The sample time does not correlate to the actual time. For example, if the app samples every 0.1 seconds (Sample Time (ms) = 100) and runs for 10 seconds, the amount of elapsed actual time might be less than the 10 seconds of elapsed simulation time. Any apparent synchronization between the sample time and actual time is coincidental.

Default: 10

Stop Condition

Stop condition of simulation, specified as one of these values:

  • First actor stops — Simulation stops when the first actor reaches the end of its trajectory.

  • Set time — Simulation stops at the time specified by the Stop Time (s) parameter.

Default: Set time

Stop Time (s)

Stop time of simulation, in seconds, specified as a positive decimal scalar.

To enable this parameter, set the Stop Condition parameter to Set time.

Default: 0.1

Use RNG Seed

Select this parameter to use a random number generator (RNG) seed to reproduce the same results for each simulation. Specify the RNG seed as a nonnegative integer less than 232.

Default: off

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.

drivingScenarioDesigner(scenario) opens the app and loads the specified drivingScenario object into the app. The ClassID properties of actors in this object must correspond to these default Class ID parameter values in the app:

  • 1 — Car

  • 2 — Truck

  • 3 — Bicycle

  • 4 — Pedestrian

  • 5 — Barrier

When you create actors in the app, the actors with these Class ID values have a default set of dimensions, radar cross-section patterns, and other properties. The camera and radar sensors process detections differently depending on type of actor specified by the Class ID values.

When importing drivingScenario objects into the app, the behavior of the app depends on the ClassID of the actors in that scenario.

  • If an actor has a ClassID of 0, the app returns an error. In drivingScenario objects, a ClassID of 0 is reserved for an object of an unknown or unassigned class. The app does not recognize or use this value. Assign these actors one of the app Class ID values and import the drivingScenario object again.

  • If an actor has a nonzero ClassID that does not correspond to a Class ID value, the app returns an error. Either change the ClassID of the actor or add a new actor class to the app. On the app toolstrip, select Add Actor > New Actor Class.

  • If an actor has properties that differ significantly from the properties of its corresponding Class ID actor, the app returns a warning. The ActorID property referenced in the warning corresponds to the ID value of an actor in the list at the top of the Actors tab. The ID value precedes the actor name. To address this warning, consider updating the actor properties or its ClassID value. Alternatively, consider adding a new actor class to the app.

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, lane type information, 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 lane type information specified as driving, border, restricted, shoulder, and parking are supported. Lanes with any other lane type information are imported as border lanes.

  • 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.

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.

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