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
plotSim3dPlot driving scenario in Unreal Engine viewer (Since R2024a)
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 (Since R2020b)
getRoadRunnerHDMapGet RoadRunner HD Map from Driving Scenario in MATLAB (Since R2023a)
addSensorsAdd sensors to specific host vehicle (Since R2023a)
startRoadRunnerForScenarioCreate and launch RoadRunner scenario from driving scenario (Since R2024a)

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 (Since R2021a)
getReferencePositionGet reference position of vehicle (Since R2024b)
stateInertial ground-truth state of actor (Since R2021a)
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 (Since R2021a)
chasePlotEgo-centric projective perspective plot
targetMeshesMesh vertices and faces relative to specific actor (Since R2020b)
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 (Since R2020a)

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 (Since R2020a)
driving.scenario.RoadGroupStore specifications for road junction or intersection (Since R2021a)
roadGroupAdd road junction or intersection to driving scenario (Since R2021a)

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 (Since R2021a)
laneSpecConnectorDefine road segment connector specifications (Since R2021a)

Parking Lots

parkingLotAdd parking lot to driving scenario (Since R2021b)
parkingSpaceDefine parking space for parking lot (Since R2021b)
insertParkingSpacesInsert parking spaces into parking lot (Since R2021b)
parkingLaneMarkingVerticesParking lane marking vertices and faces in driving scenario (Since R2021b)
drivingRadarDataGeneratorGenerate radar sensor detections or track reports from driving scenario or RoadRunner Scenario (Since R2021a)
visionDetectionGeneratorGenerate vision detections for driving scenario or RoadRunner Scenario
lidarPointCloudGeneratorGenerate lidar point cloud data for driving scenario or RoadRunner Scenario (Since R2020a)
insSensorInertial navigation system and GNSS/GPS simulation model (Since R2021a)
ultrasonicDetectionGeneratorGenerate ultrasonic range detections in driving scenario or RoadRunner Scenario (Since R2022a)
addSensorsAdd sensors to specific host vehicle (Since R2023a)

Mesh Creation

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

Prebuilt Meshes

driving.scenario.bicycleMeshMesh representation of bicycle in driving scenario (Since R2020a)
driving.scenario.carMeshMesh representation of car in driving scenario (Since R2020a)
driving.scenario.pedestrianMeshMesh representation of pedestrian in driving scenario (Since R2020a)
driving.scenario.truckMeshMesh representation of truck in driving scenario (Since R2020a)
driving.scenario.jerseyBarrierMeshMesh representation of Jersey barrier in driving scenario (Since R2021a)
driving.scenario.guardrailMeshMesh representation of guardrail in driving scenario (Since R2021a)

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 (Since R2020b)
pathPlotterPath plotter for bird's-eye plot
pointCloudPlotterPoint cloud plotter for bird's-eye plot (Since R2020a)
outlinePlotterOutline plotter for bird's-eye plot
rangeDetectionPlotterRange detection plotter for bird's-eye plot (Since R2022a)

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 (Since R2021b)
plotMeshDisplay object meshes on bird's-eye plot (Since R2020b)
plotOutlineDisplay object outlines on bird's-eye plot
plotBarrierOutlineDisplay barrier outlines on bird's-eye plot (Since R2021a)
plotPathDisplay actor paths on bird’s-eye plot
plotPointCloudDisplay generated point cloud on bird's-eye plot (Since R2020a)
plotRangeDetectionDisplay range detections on bird's-eye plot (Since R2022a)
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

Sensors

Featured Examples