Main Content

Programmatic Scenario Authoring

Programmatically create driving scenarios by using a drivingScenario object

The drivingScenario object enables you to author driving scenarios from the MATLAB® command line. Use this object to design complex road networks or parking lots and specify actors and their trajectories. You can then generate synthetic data from these scenarios by using sensor models and visualize this data on a bird's-eye plot.

The flexible interface of the drivingScenario object enables you to create variations of a scenario for rapidly testing driving algorithms under various conditions. For more details, see Create Driving Scenario Variations Programmatically.

Functions

expand all

Scenarios

drivingScenarioCreate driving scenario
advanceAdvance driving scenario simulation by one time step
plotPlot driving scenario
recordRun driving scenario and record actor states
restartRestart driving scenario simulation from beginning
updatePlotsUpdate driving scenario plots
exportExport driving scenario to ASAM OpenDRIVE or ASAM OpenSCENARIO file

Actors

actorAdd actor to driving scenario
vehicleAdd vehicle to driving scenario
trajectoryCreate actor or vehicle trajectory in driving scenario
smoothTrajectoryCreate smooth, jerk-limited actor trajectory in driving scenario
stateInertial ground-truth state of actor
actorPosesPositions, velocities, and orientations of actors in driving scenario
actorProfilesPhysical and radar characteristics of actors in driving scenario
barrierAdd a barrier to a driving scenario
chasePlotEgo-centric projective perspective plot
targetMeshesMesh vertices and faces relative to specific actor
targetOutlinesOutlines of targets viewed by actor
targetPosesTarget positions and orientations relative to ego vehicle
driving.scenario.targetsToEgoConvert target poses from scenario to ego coordinates
driving.scenario.targetsToScenarioConvert target poses from ego to scenario coordinates

Roads

roadAdd road to driving scenario or road group
roadNetworkAdd road network to driving scenario
roadBoundariesGet road boundaries
driving.scenario.roadBoundariesToEgoConvert road boundaries to ego vehicle coordinates
roadMeshMesh representation of roads near actor
driving.scenario.RoadGroupStore specifications for road junction or intersection
roadGroupAdd road junction or intersection to driving scenario

Lanes

lanespecCreate road lane specifications
laneTypeCreate road lane type object
laneMarkingCreate road lane marking object
laneMarkingVerticesLane marking vertices and faces in driving scenario
currentLaneGet current lane of actor
laneBoundariesGet lane boundaries of actor lane
clothoidLaneBoundaryClothoid-shaped lane boundary model
computeBoundaryModelCompute lane boundary points from clothoid lane boundary model
compositeLaneSpecCreate multiple lane specifications for road
laneSpecConnectorDefine road segment connector specifications

Parking Lots

parkingLotAdd parking lot to driving scenario
parkingSpaceDefine parking space for parking lot
insertParkingSpacesInsert parking spaces into parking lot
parkingLaneMarkingVerticesParking lane marking vertices and faces in driving scenario
drivingRadarDataGeneratorGenerate radar sensor detections and tracks from driving scenario
visionDetectionGeneratorGenerate vision detections for driving scenario
lidarPointCloudGeneratorGenerate lidar point cloud data for driving scenario
insSensorInertial navigation system and GNSS/GPS simulation model

Mesh Creation

extendedObjectMeshMesh representation of extended object
translateTranslate mesh along coordinate axes
rotateRotate mesh about coordinate axes
scaleScale mesh in each dimension
applyTransformApply forward transformation to mesh vertices
joinJoin two object meshes
scaleToFitAuto-scale object mesh to match specified cuboid dimensions
showDisplay the mesh as a patch on the current axes

Prebuilt Meshes

driving.scenario.bicycleMeshMesh representation of bicycle in driving scenario
driving.scenario.carMeshMesh representation of car in driving scenario
driving.scenario.pedestrianMeshMesh representation of pedestrian in driving scenario
driving.scenario.truckMeshMesh representation of truck in driving scenario
driving.scenario.jerseyBarrierMeshMesh representation of Jersey barrier in driving scenario
driving.scenario.guardrailMeshMesh representation of guardrail in driving scenario

Plotter Creation

birdsEyePlotPlot detections, tracks, and sensor coverages around vehicle
coverageAreaPlotterCoverage area plotter for bird's-eye plot
detectionPlotterDetection plotter for bird's-eye plot
trackPlotterTrack plotter for bird's-eye plot
laneBoundaryPlotterLane boundary plotter for bird's-eye plot
laneMarkingPlotterLane marking plotter for bird's-eye plot
meshPlotterMesh plotter for bird's-eye plot
pathPlotterPath plotter for bird's-eye plot
pointCloudPlotterPoint cloud plotter for bird's-eye plot
outlinePlotterOutline plotter for bird's-eye plot

Plotter Display

plotCoverageAreaDisplay sensor coverage area on bird's-eye plot
plotDetectionDisplay object detections on bird's-eye plot
plotLaneBoundaryDisplay lane boundaries on bird’s-eye plot
plotLaneMarkingDisplay lane markings on bird’s-eye plot
plotParkingLaneMarkingDisplay parking lane markings on bird’s-eye plot
plotMeshDisplay object meshes on bird's-eye plot
plotOutlineDisplay object outlines on bird's-eye plot
plotBarrierOutlineDisplay barrier outlines on bird's-eye plot
plotPathDisplay actor paths on bird’s-eye plot
plotPointCloudDisplay generated point cloud on bird's-eye plot
plotTrackDisplay object tracks on bird's-eye plot

Plotter Utilities

findPlotterFind plotters associated with bird’s-eye plot
clearDataClear data from specific plotter of bird’s-eye plot
clearPlotterDataClear data from bird’s-eye plot

Topics

Driving Scenarios

Create Driving Scenario Programmatically

Programmatically create ground truth driving scenarios for synthetic sensor data and tracking algorithms.

Define Road Layouts Programmatically

Programmatically create road junctions and combine these junctions to create more complicated road networks.

Simulate Vehicle Parking Maneuver in Driving Scenario

Simulate a parking maneuver and generate sensor detections in a large parking lot using a cuboid driving scenario.

Create Actor and Vehicle Trajectories Programmatically

Programmatically create actor and vehicle trajectories for a driving scenario.

Create Driving Scenario Variations Programmatically

Programmatically create variations of a driving scenario that was built using the Driving Scenario Designer app.

Visualize Sensor Coverage, Detections, and Tracks

Configure and use a bird's-eye plot to display sensor coverage, detections, and tracking results around the ego vehicle.

Automate Control of Intelligent Vehicles by Using Stateflow Charts

Model a highway scenario with intelligent vehicles that are controlled by decision logic defined by a Stateflow® chart.

Sensors

Model Radar Sensor Detections

Model and simulate the output of an automotive radar sensor for various driving scenarios.

Radar Signal Simulation and Processing for Automated Driving

Model the hardware, signal processing, and propagation environment of a radar for a driving scenario.

Simulate Radar Ghosts Due to Multipath Return

Generate ghost targets that occur when signal energy is reflected off another target before returning to the radar.

Model Vision Sensor Detections

Model and simulate the output of an automotive vision sensor for various driving scenarios.

Simulate Inertial Sensor Readings from a Driving Scenario (Navigation Toolbox)

Generate synthetic sensor data from IMU, GPS, and wheel encoders using driving scenario generation tools from Automated Driving Toolbox™.

Featured Examples