varySceneProperties
Syntax
Description
varySceneProperties(
adds property variations for the road variations
,roadID
,Name=Value
)roadID
to the
variationProperties
object variations
by using one
or more name-value arguments.
varySceneProperties(
adds property variations for the lane variations
,roadID
,laneID
,Name=Value
)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.
Examples
Vary Scene Properties to Generate Scenario Variants
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
variations
— Variation properties
variationProperties
object
Variation properties, specified as a variationProperties
object.
roadID
— ID of road
positive integer
ID of the road, specified as a positive integer.
Data Types: int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
laneID
— ID of lane
positive integer
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
— Width of road or lane
positive scalar
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)
For the second syntax, the Width
name-value argument
specifies the lane width. For
example,
varySceneProperties(variation,1,2,Width=10)
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
LaneType
— Type of lane
"driving"
| "parking"
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")
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")
Example: LaneType="parking"
specifies a variant lane with a lane
type of parking.
Data Types: char
| string
Marking
— Lane marking of road
"solid"
| "dashed"
| "doublesolid"
| "doubledashed"
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")
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")
Example: Marking="solid"
specifies the type of marking as solid
for the sides of the specified lane or road.
Data Types: char
| string
MarkingColor
— Marking color of lane or road boundaries
"white"
| "yellow"
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")
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")
Example: MarkingColor="white"
specifies the marking color for
the sides of the specified lane or road as white.
Data Types: char
| string
MarkingWidth
— Marking width of lane or road boundaries
positive scalar | two-element numeric row vector
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)
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)
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
MarkingSide
— Marking side of lane or road boundaries
"both"
(default) | "left"
| "right"
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")
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")
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)