Main Content

varySceneProperties

Add variations to scene properties

Since R2024b

Description

varySceneProperties(variations,roadID,Name=Value) adds property variations for the road roadID to the variationProperties object variations by using one or more name-value arguments.

example

varySceneProperties(variations,roadID,laneID,Name=Value) adds property variations for the lane laneID on the road roadID to the variationProperties object variations by using one or more name-value arguments. For example, varySceneProperties(variation,1,2,Width=10) specifies a variant lane width of 10 meters for the lane with lane ID 2 on the road with road ID 1.

Note

This function requires the Automated Driving Toolbox™ Test Suite for Euro NCAP® Protocols support package. You can install the Automated Driving Toolbox Test Suite for Euro NCAP Protocols support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

Examples

collapse all

Load a driving scenario into the workspace.

load("scenarioWithSingleActor.mat")

Create a scenario descriptor from the input seed scenario.

seedScenarioDescriptor = getScenarioDescriptor(scenario,Simulator="DrivingScenario");

Create a variationProperties object.

variation1 = variationProperties;

Add scene property variations to a road by specifying the road ID, width of the road, and marking color of the road boundaries.

roadID = 1;
varySceneProperties(variation1,roadID,Width=30,MarkingColor="yellow")

Using the seed scenario descriptor and the scene variation, generate a scenario variant descriptor.

scenarioVariantDescriptor1 = generateVariants(seedScenarioDescriptor,variation1);

Generate a variant scenario, as a drivingScenario object, from the scenario variant descriptor object.

scenarioVariant1 = getScenario(scenarioVariantDescriptor1,Simulator="DrivingScenario");

Create another variationProperties object.

variation2 = variationProperties;

Add scene property variations to a lane by specifying the road ID, lane ID, width of the lane, lane marking, and marking color of the lane boundaries.

roadID = 1;
laneID = 2;
varySceneProperties(variation2,roadID,laneID,Width=10,Marking="solid",MarkingColor="white")

Using the seed scenario descriptor and the scene variation, generate another scenario variant descriptor.

scenarioVariantDescriptor2 = generateVariants(seedScenarioDescriptor,variation2);

Generate another variant scenario, as a drivingScenario object, from the scenario variant descriptor object.

scenarioVariant2 = getScenario(scenarioVariantDescriptor2,Simulator="DrivingScenario");

Create a custom figure window to plot the seed scenario and the scenario variants.

figScene = figure;
set(figScene,Position=[200 200 900 300])
hCarViewPanel1 = uipanel(figScene,Position=[0 0 0.33 1],Title="Input Seed Scenario");
hCarPlot1 = axes(hCarViewPanel1);
hCarViewPanel2 = uipanel(figScene,Position=[0.34 0 0.33 1],Title='Generated Scenario Variant1');
hCarPlot2 = axes(hCarViewPanel2);
hCarViewPanel3 = uipanel(figScene,Position=[0.68 0 0.33 1],Title='Generated Scenario Variant2');
hCarPlot3 = axes(hCarViewPanel3);

Plot the seed scenario and its variants. Observe the scene variation in the generated scenario variants.

plot(scenario,Waypoints="on",Parent=hCarPlot1)
plot(scenarioVariant1,Waypoints="on",Parent=hCarPlot2)
plot(scenarioVariant2,Waypoints="on",Parent=hCarPlot3)

Input Arguments

collapse all

Variation properties, specified as a variationProperties object.

ID of the road, specified as a positive integer.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

ID of the lane, specified as a positive integer.

Data Types: int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: varySceneProperties(variation,1,2,Width=10) specifies a variant lane width of 10 meters for the lane with lane ID 2 on the road with road ID 1.

Width of the road or lane, specified as a positive scalar. Units are in meters.

For the first syntax, the Width name-value argument specifies the road width. For example,

varySceneProperties(variation,1,Width=10)
specifies a variant road width of 10 meters for the road with road ID 1.

For the second syntax, the Width name-value argument specifies the lane width. For example,

varySceneProperties(variation,1,2,Width=10)
specifies a variant lane width of 10 meters for the lane with lane ID 2 on the road with road ID 1.

Example: Width=10 specifies a variant lane or road width of 10 meters.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Type of the lane, specified as "driving" or "parking".

For the first syntax, the LaneType name-value argument specifies the type of lane for all lanes on the specified road. For example,

varySceneProperties(variation,1,LaneType="parking")
specifies all the lanes on the road with road ID 1 as parking lanes.

For the second syntax, the LaneType name-value argument specifies the type of lane for the specified lane on the specified road. For example,

varySceneProperties(variation,1,2,LaneType="parking")
specifies the lane with lane ID 2 on the road with road ID 1 as parking lane.

Example: LaneType="parking" specifies a variant lane with a lane type of parking.

Data Types: char | string

Lane markings of the road, specified as "solid", "dashed", "doublesolid", or "doubledashed".

For the first syntax, the Marking name-value argument specifies the type of marking for the sides of the specified road. For example,

varySceneProperties(variation,1,Marking="solid")
specifies the type of marking as solid for the sides of the road with road ID 1.

For the second syntax, the Marking name-value argument specifies the type of marking for the sides of the specified lane. For example,

varySceneProperties(variation,1,2,Marking="solid")
specifies the type of marking as solid for the sides of the lane with lane ID 2 on the road with road ID 1.

Example: Marking="solid" specifies the type of marking as solid for the sides of the specified lane or road.

Data Types: char | string

Marking color of the lane or road boundaries, specified as "white" or "yellow".

For the first syntax, the MarkingColor name-value argument specifies the marking color for the sides of the specified road. For example,

varySceneProperties(variation,1,MarkingColor="white")
specifies the marking color as white for the sides of the road with road ID 1.

For the second syntax, the MarkingColor name-value argument specifies the marking color for the sides of the specified lane on the specified road. For example,

varySceneProperties(variation,1,2,MarkingColor="white")
specifies the marking color as white for the sides of the lane with lane ID 2 on the road with road ID 1.

Example: MarkingColor="white" specifies the marking color for the sides of the specified lane or road as white.

Data Types: char | string

Marking width of the lane or road boundaries, specified as a positive scalar or a two-element numeric row vector. Units are in meters.

If you specify a scalar, the variationProperties object stores the marking width for both the boundaries of the specified road or lane. If you specify a two-element numeric row vector of the form [a b], the variationProperties object stores the marking widths a and b for the left and right boundaries of the specified lane or road, respectively. For more information on the direction of roads and lanes, see Draw Direction of Road and Numbering of Lanes.

For the first syntax, the MarkingWidth name-value argument specifies the marking width of the road boundaries. For example,

varySceneProperties(variation,1,MarkingWidth=3)
specifies a variant marking width of 3 meters for the sides of the road with road ID 1.

For the second syntax, the MarkingWidth name-value argument specifies the marking width of the specified lane boundaries on the specified road. For example,

varySceneProperties(variation,1,2,MarkingWidth=3)
specifies a variant marking width of 3 meters for the sides of the lane with lane ID 2 on the road with road ID 1.

Example: MarkingWidth=3 specifies a variant marking width of 3 meters for sides of the specified lane or road.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Marking side of the lane or road boundaries, specified as "both", "left", or "right". For more information on the direction of roads and lanes, see Draw Direction of Road and Numbering of Lanes.

For the first syntax, the MarkingSide name-value argument specifies the side of the specified road that applies the marking. For example,

varySceneProperties(variation,1,MarkingSide="left")
specifies that the left side of the road with road ID 1 that applies marking.

For the second syntax, the MarkingSide name-value argument specifies the side of the specified lane on the specified road that applies the marking. For example,

varySceneProperties(variation,1,2,MarkingSide="left")
specifies that the left side of the lane with lane ID 2 on the road with road ID 1 that applies marking.

Example: MarkingSide="left" specifies that the left side of the specified road or lane that applies marking.

Data Types: char | string

Version History

Introduced in R2024b