Main Content

varyActorProperties

Add variations to actor properties

Since R2023a

Description

example

varyActorProperties(variations,actorID,Name=Value) adds property variations for the actor actorID to the variationProperties object variations by using one or more name-value arguments. For example, Speed=10 specifies a variant actor speed of 10 meters per second.

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 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: []

Create an empty variationProperties object.

variation = variationProperties;

Display empty actor properties.

disp(variation.ActorVariationProperties)
      ActorID: []
        Speed: []
    Dimension: []
    Waypoints: []
          Yaw: []

Add a speed variation to the actor with an ActorID of 1.

varyActorProperties(variation,1,Speed=10);

Add a waypoint variation to the actor with an ActorID of 2.

waypoint = [0 0 0; 10 0 0];
varyActorProperties(variation,2,Waypoints=waypoint);

Display the actor property variations.

disp(variation.ActorVariationProperties)
  1×2 struct array with fields:

    ActorID
    Speed
    Dimension
    Waypoints
    Yaw

Input Arguments

collapse all

Variation properties, specified as a variationProperties object.

ID of the actor, specified as a positive integer.

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: varyActorProperties(variation,1,Speed=10) specifies a variant actor speed of 10 meters per second.

Dimensions of the actor, specified as a structure with fields Length, Width, and Height. Units are in meters.

Example: Dimension=struct("Length",7,"Width",2,"Height",4) specifies actor dimension variations.

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. For more information on how to use this argument, see Limitations.

Example: waypoints=[0 0 0; 10 0 0; 20 0 0] specifies three actor waypoints.

Speed of the actor, specified as a scalar or an P-element vector. Units are in meters per second.

If you specify it as a scalar, the same speed is applicable to all the specified waypoints. If you specify it as a vector, these instances are applicable.

InstancesDescription

The number of speed values P is equal to the number of waypoints M.

Each speed value is applicable to its respective waypoint.

The number of speed values P is smaller than the number of waypoints M.

P speed values are applicable to initial P waypoints. The generateVariant function applies the Pth speed value to the rest (M-P) waypoints while generating the scenario variants.

The number of speed values P is greater than the number of waypoints M.

Initial M speed values are applicable to M waypoints. The generateVariant function ignores the rest (P-M) speed values while generating the scenario variants.

Example: Speed=10 specifies a variant actor speed of 10 meters per second.

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. For more information on how to use this argument, see Limitations.

Example: waypoints=[0 0 0; 10 0 0; 20 0 0] specifies three variant actor waypoints.

Variant speed of the actor, specified as a scalar or a P-element vector. Units are in meters per second.

If you specify a scalar, the function applies the same speed to all the waypoints of the actor. If you specify a vector, the behavior of the function changes based on the relative number of waypoints.

Relative Number of WaypointsDescription

The number of speed values P equals the number of waypoints M.

Each speed value applies to its respective waypoint.

The number of speed values P is less than the number of waypoints M.

The first P speed values apply to the initial P waypoints. The generateVariant function then applies the final speed value to the remaining (MP) waypoints while generating the scenario variants.

The number of speed values P is greater than the number of waypoints M.

The first M speed values apply to their respective M waypoints. The generateVariant function ignores the remaining (PM) speed values while generating the scenario variants.

Example: Speed=10 specifies a variant actor speed of 10 meters per second.

Yaw angle of the actor, specified as an M-element vector. M is the number of waypoints for the actor. Units are in radians.

Example: Yaw=[1 1 1] specifies variant yaw angles of an actor for three waypoints.

Limitations

  • To apply actor waypoint variations, you must specify actor speed variations.

  • To apply actor yaw angle variations, you must specify actor waypoint and actor speed variations.

Tips

  • To apply actor property variations to your seed scenario, use the generateVariants function.

Version History

Introduced in R2023a