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.


expand all


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, ASAM OpenSCENARIO or RoadRunner HD Map file
getRoadRunnerHDMapGet RoadRunner HD Map from Driving Scenario in MATLAB
addSensorsAdd sensors to specific host vehicle


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 host vehicle
driving.scenario.targetsToEgoConvert target poses from scenario to ego coordinates
driving.scenario.targetsToScenarioConvert target poses from ego to scenario coordinates


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


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
ultrasonicDetectionGeneratorGenerate ultrasonic range detections in driving scenario
addSensorsAdd sensors to specific host vehicle

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
rangeDetectionPlotterRange detection 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
plotRangeDetectionDisplay range detections 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


Driving Scenarios