Main Content

getScenarioDescriptor

Extract properties from input scenario to generate scenario variants

Description

example

D = getScenarioDescriptor(scenario,Simulator=simulator) extracts the properties of an input scenario and stores these properties in a ScenarioDescriptor object, D, for scenario variant generation. simulator specifies the simulator used by the input scenario scenario.

Note

This function requires the Scenario Variant Generator for Automated Driving Toolbox™ support package. You can install Scenario Variant Generator for Automated Driving Toolbox from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Examples

collapse all

Create a driving scenario.

scenario = drivingScenario;

Add a road segment to the scenario.

roadCenters = [41 6; 7 6];
laneSpecification = lanespec([2 2]);
road(scenario,roadCenters, ...
    Lanes=laneSpecification,Name="Road");

Create a trajectory by adding an ego vehicle, waypoints, and speed information to the scenario.

egoVehicle = vehicle(scenario, ...
    ClassID=1, ...
    Position=[13 4 0], ...
    Mesh=driving.scenario.carMesh, ...
    Name="Car");
waypoints = [13 4 0;
             30 4 0;
             41 4 0];
speed = 30;
trajectory(egoVehicle,waypoints,speed)

Create a scenarioDescriptor object, and display it.

scenarioDescriptor = getScenarioDescriptor(scenario,Simulator="DrivingScenario")
scenarioDescriptor = 
  ScenarioDescriptor with properties:

    status: "DescriptorCreated"

Recreate the scenario as a drivingScenario object.

scenarioDS = getScenario(scenarioDescriptor,Simulator="DrivingScenario");

Input Arguments

collapse all

Seed scenario, specified as a drivingScenario object.

Simulator name of the seed scenario, specified as "DrivingScenario". Currently, this function supports only the MATLAB® driving scenario simulator.

Data Types: char | string

Output Arguments

collapse all

Scenario descriptor, returned as a ScenarioDescriptor object. The status property of the descriptor object D indicates "DescriptorCreated" whether the object has been successfully created.

The ScenarioDescriptor object stores scene, actor, and vehicle information extracted from a seed scenario. You can use these scene information to generate scenario variants to perform safety assessments for various automated driving applications.

Tips

  • To get a scenario from a ScenarioDescriptor object, use the getScenario function.

Version History

Introduced in R2022b