variationProperties
Description
The variationProperties object stores scenario property
variations, such as actor, collision, scene, and Euro NCAP® test bench properties, to use to create scenario variants.
Creation
Description
creates an
empty variations = variationPropertiesvariationProperties object, variations.
Note
This object requires the Automated Driving Toolbox™ Test Suite for Euro NCAP® Protocols support package. You can install Automated Driving Toolbox Test Suite for Euro NCAP Protocols from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
Properties
Actor variation properties, specified as a structure. The structure contains these fields:
ActorID— ID of the actor, specified as a positive integer.Speed— Speed of the actor, specified as a scalar or an M-element row vector. M is the number of waypoints. Units are in meters per second.Dimension— Dimensions of the actor, specified as a structure with fieldsLength,Width,Height,RearOverhang, andFrontOverhang. Units are in meters.Waypoints— Waypoints of the actor, specified as an M-by-3 matrix. M is the number of waypoints. Each row represents the actor position in the form [x y z]. Units are in meters.Yaw— Yaw angle of the actor, specified as an M-element column vector. M is the number of waypoints. Units are in radians.By default, the fields of the
ActorVariationPropertiesstructure are empty arrays,[].
Note
To set the fields of the ActorVariationProperties structure,
you must use the varyActorProperties object function.
Collision variation properties, specified as a structure. The structure contains these fields:
Actor1ID— ID of the first colliding actor in the pair, specified as a positive integer.Actor2ID— ID of the second colliding actor in the pair, specified as a positive integer.Actor1CollisionFraction— Point of collision relative to the collision side of the first actor, specified as a scalar in the range [0, 1]. For more information, see Collision Fraction.Actor1CollisionSide— Side of the first actor at which the collision occurs, specified as"Front","Left","Back", or"Right".Actor2CollisionFraction— Point of collision relative to the collision side of the second actor, specified as a scalar in the range [0, 1]. For more information, see Collision Fraction.Actor2CollisionSide— Side of the second actor at which the collision occurs, specified as"Front","Left","Back", or"Right".VariationType— Parameter to change to generate variant with collision, specified as"WaitTime","EntryTime", or"Waypoints".
Note
To set the fields of the CollisionVariationProperties
structure, you must use the varyCollisionProperties object function.
Scene variation properties, specified as a structure. The structure contains these fields:
RoadID— ID of the road, specified as a positive integer.LaneID— ID of the lane, specified as a positive integer.Width— Width of the road or lane, specified as a positive scalar. Units are in meters.LaneType— Type of the lane, specified as"driving"or"parking".Marking— Lane markings of the road, specified as"solid","dashed","doublesolid", or"doubledashed".MarkingColor— Marking color of the lane or road boundaries, specified as"white"or"yellow".MarkingWidth— Marking width of the road or lane boundaries, specified as a positive scalar or a two-element numeric row vector. Units are in meters.
By default, the fields of the SceneVariationProperties
structure are empty arrays, [].
Note
To set the fields of the SceneVariationProperties structure,
you must use the varySceneProperties object function.
Euro NCAP test bench variation properties, specified as a structure. The structure contains these fields:
StartTestTime— Time to start safety assessment test. Units are in seconds.EndTestTime— Time to end safety assessment test. Units are in seconds.HandoverTime— Time to hand-over of control for Euro NCAP safety assessment testing, specified as a scalar. Units are in seconds.
By default, the fields of the TestVariationProperties structure
are empty arrays, [].
Note
To set the fields of the TestVariationProperties structure,
you must use the varyTestProperties object function.
Object Functions
varyActorProperties | Add variations to actor properties |
varyCollisionProperties | Add variations to collision properties |
varySceneProperties | Add variations to scene properties |
varyTestProperties | Add variations to Euro NCAP test bench properties |
Examples
Create an empty variationProperties object.
variation = variationProperties;
Display empty actor properties.
disp(variation.ActorVariationProperties)
ActorID: []
Speed: []
Dimension: []
Waypoints: []
Yaw: []
Add speed and waypoint variations to the actor with an ActorID of 1.
waypoints = [0 0 0; 10 0 0]; varyActorProperties(variation,1,Speed=10,Waypoints=waypoints);
Display the actor property variations.
disp(variation.ActorVariationProperties)
ActorID: 1
Speed: 10
Dimension: []
Waypoints: [2×3 double]
Yaw: []
Load a driving scenario into the workspace.
load("scenarioWithSingleActor.mat")Create a scenario descriptor from the input seed scenario.
seedScenarioDescriptor = getScenarioDescriptor(sc,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")ans =
variationProperties with properties:
ActorVariationProperties: [1×1 struct]
CollisionVariationProperties: []
SceneVariationProperties: [1×1 struct]
TestVariationProperties: [1×1 struct]
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")
ans =
variationProperties with properties:
ActorVariationProperties: [1×1 struct]
CollisionVariationProperties: []
SceneVariationProperties: [1×1 struct]
TestVariationProperties: [1×1 struct]
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(sc,Waypoints="on",Parent=hCarPlot1) plot(scenarioVariant1,Waypoints="on",Parent=hCarPlot2) plot(scenarioVariant2,Waypoints="on",Parent=hCarPlot3)

Tips
To apply actor property variations and collision variations to your seed scenario, use the
generateVariantsfunction.
Version History
Introduced in R2023aThe variationProperties object contains these additional properties:
SceneVariationPropertiesTestVariationProperties
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)