Main Content

getScenario

Get scenario object from scenario descriptor object

Description

example

scenario = getScenario(D,Simulator=simulator) returns a scenario object that supports the specified simulator simulator from the given ScenarioDescriptor object D.

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

Scenario variant descriptor, specified as a ScenarioDescriptor object. The ScenarioDescriptor object stores scene, actor, and vehicle information extracted from a seed scenario, and uses this information to generate the scenario variants. You can use these scenario variants to perform safety assessments for various automated driving applications.

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

Data Types: char | string

Output Arguments

collapse all

Scenario for the simulator, returned as a drivingScenario object.

Version History

Introduced in R2022b