getAction
Syntax
Description
action = getAction(actorSim,actionName)actionName, if present, for the actor
        represented by actorSim at the current simulation time step. If no
        action is configured at the current time step, an empty array is returned.
action = getAction(actorSim,"UserDefinedAction",UserDefinedActionName)UserDefinedActionName for the actor
        represented by actorSim.
Examples
Create sim, a
            ScenarioSimulation object
rrApp = roadrunner("C:\Project\TestHighwayRoute"); openScenario(rrApp,"myScenario1"); sim = createSimulation(rrApp);
Start the simulation.
set(sim,"SimulationCommand","Start");
Pause the simulation.
set(sim,"SimulationCommand","Pause");
Retrieve all actors from the simulation.
actorsim = get(sim,"ActorSimulation"); 
Get the first actor from the list.
actorOne = actorsim{1};
Get the lateral offset action of the first actor at the current time step.
loAction = getAction(actorOne,"LateralOffsetAction")Input Arguments
Actor from which to return action, specified as an ActorSimulation object.
Actor action to be returned, specified as one of these values:
- "PathAction"
- "SpeedAction"
- "LaneChangeAction"
- "LateralOffsetAction"
- "ChangeParameterAction"
- "LongitudinalDistanceAction"
- "UserDefinedAction"
Data Types: string | char
Name of the user-defined action to be returned, specified as a character vector or string scalar.
Data Types: string | char
Output Arguments
Action of specified actor at current time step, returned as a
              struct. The type of structure depends on the input argument
              actionName.
| Value of actionName | Value of action | 
|---|---|
| "PathAction" | PathActionstructure | 
| "SpeedAction" | SpeedActionstructure | 
| "LaneChangeAction" | LaneChangeActionstructure | 
| "LateralOffsetAction" | LateralOffsetActionstructure | 
| "ChangeParameterAction" | ChangeParameterActionstructure | 
| "LongitudinalDistanceAction" | LongitudinalDistanceActionstructure | 
| "UserDefinedAction" | UserDefinedActionstructure | 
More About
The PathAction structure contains information about a path change
        action, if any, for the specified actor at the current time step. This table describes the
        fields of the PathAction structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| PathTarget | Actor target path, returned as a struct. | 
This table describes the PathTarget structure of the
          PathAction structure. 
| Field Name | Description | 
|---|---|
| Path | Set of 3-D coordinates representing the target path, returned as an N-by-3 array where N = NumPoints. Each column value in the first row is the x-, y- and z- coordinate, respectively, of the first point in the target path, and so on. | 
| NumPoints | Total number of points in the target path, returned as a positive integer. | 
| HasTimings | Indication of target path containing timing information, returned as a Boolean value. | 
| PathPointTiming | Timing information for each point of the path, returned as an N-by-1 structure array where N = NumPoints. | 
This table describes the fields of each structure in the
          PathPointTiming structure array of the PathTarget
        structure within the PathAction structure.
| Field Name | Description | 
|---|---|
| Time | Time of arrival of the actor at this point, relative to the time at the starting point of the path. Returned in seconds. | 
| Speed | Speed of actor at the time of arrival, returned in meters per second. | 
| WaitTime | Waiting time period of actor at arrival, returned in seconds. If this value is non-zero, then the actor is at rest. | 
The SpeedAction structure contains information about a speed change
        action, if any, for the specified actor at the current time step. This table describes the
        fields of the SpeedAction structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| SpeedTarget | Target speed after speed change, returned as a struct. | 
| TransitionDynamics | Transition dynamics for the speed change, specified as a struct. The fields of the structure are described inTransitionDynamicsstructure. | 
This table describes the SpeedTarget structure of the
          SpeedAction structure.
| Field Name | Description | 
|---|---|
| SpeedValue | Target speed value, returned as a double. | 
| SpeedComparison | Comparison type of current speed with the target speed, returned as an
                    enumeration variable of the  The value of  
 
 | 
| RefActorID | Identifier of reference actor, if any, returned as a positive integer | 
| RefSamplingMode | Speed sampling mode of reference actor, if any, returned as an
                    enumeration variable of the  The value of
                       
 
 | 
The LaneChangeAction structure contains information about a lane
        change action, if any, for the specified actor at the current time step. This table
        describes the fields of the LaneChangeAction structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| LaneChangeTarget | Target lane after lane change, returned as a struct. | 
| TransitionDynamics | Dynamics of the transition to the lane change, returned as a struct. The fields of the structure are described inTransitionDynamicsstructure. | 
This table describes the fields of the LaneChangeTarget structure of
        the LaneChangeAction structure. 
| Field Name | Description | 
|---|---|
| LaneValue | Number of lanes to change before reaching the target lane, returned as an int32value. | 
| LaneComparison | Direction of the lane change, returned as an enumeration variable of
                    the  The
                    value of  
 
 | 
| RefActorID | Identifier of reference actor, returned as a positive integer. | 
The LateralOffsetAction structure contains information about lateral
        offset, if any, of the specified actor at the current time step. This table describes the
        fields of the LateralOffsetAction structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| LateralOffsetTarget | Lateral offset relative to the current path of specified actor, returned as a struct. | 
| TransitionDynamics | Transition dynamics for the lateral offset change, specified as a struct. The fields of the structure are described inTransitionDynamicsstructure. | 
This table describes the LateralOffsetTarget structure of the
          LateralOffsetAction structure.
| Field Name | Description | 
|---|---|
| OffsetValue | Target lateral offset relative to the current path, returned as a
                    scalar of data type  
 | 
The ChangeParameterAction structure contains information about a
        change in the custom behavior parameters, if any, of the specified actor at the current time
        step. This table describes the fields of the ChangeParameterAction
        structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| Parameter | Information about the changed user-specified behavior parameter, returned as
                  a struct. | 
This table describes the Parameter structure of the
          ChangeParameterAction structure.
| Field Name | Description | 
|---|---|
| Name | Name of the changed user-specified behavior parameter, returned as a string. | 
| Value | New value of the user-specified behavior parameter, returned as a string. | 
| Type | Type of parameter, returned as an enumeration variable of the EnumParameterTypeenumeration class.The value of
                       
 
 | 
The LongitudinalDistanceAction structure contains information about
        changes, if any, in the longitudinal distance of the specified actor at the current time
        step. The longitudinal distance between two actors can be measured either as a space
        distance or a time distance. This table describes the fields of the
          LongitudinalDistanceAction structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of the specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| DistanceTarget | Information about the longitudinal distance to the reference actor, returned
                  as a struct. | 
| ReferenceSamplingMode | Phase interval at which the target longitudinal distance is achieved,
                    returned as an enumeration variable of the
                       The value of  
 
 | 
| DynamicConstraints | Dynamic constraints for the longitudinal distance change, returned as a struct. | 
This table describes the DistanceTarget structure of the
          LongitudinalDistanceAction structure.
| Field Name | Description | 
|---|---|
| RefActorID | Identifier of reference actor, returned as a positive integer. | 
| DistanceDimensionType | Type of distance to reference actor, returned as an enumeration
                    variable of the  The value of  
 
 | 
| DistanceType | Specification of longitudinal distance as either time distance or space
                    distance, returned as an enumeration variable of the
                       The value
                    of  
 
 | 
| ActorCoordinateSystemType | Coordinate system in which to measure required longitudinal distance,
                    returned as an enumeration variable of the
                       The value of  
 
 | 
| Value | Longitudinal distance, returned as a double. | 
| PositionComparison | Relative position to reference actor, returned as an enumeration
                    variable of the  The value of  
 
 | 
| MeasureFrom | Longitudinal distance is either measured between the closest points on
                    two actors' bounding boxes or between the origin point of both actors. Returned
                    as an enumeration variable of the  The value of  
 
 | 
This table describes the DynamicConstraints structure of the
          LongitudinalDistanceAction structure.
| Field Name | Description | 
|---|---|
| UnlimitedDynamics | Presence of dynamic constraints, returned as a Boolean value. | 
| MaxSpeed | Maximum speed that an actor can attain while approaching target longitudinal
                  distance to reference actor, returned as a double. | 
| MaxAcceleration | Maximum acceleration that an actor can attain while approaching target
                  longitudinal distance to reference actor, returned as a double. | 
| MaxDeceleration | Maximum deceleration that an actor can attain while approaching target
                  longitudinal distance to reference actor, returned as a double. | 
The UserDefinedAction structure contains information about a
        user-defined action, if any, for the specified actor at the current time step. This table
        describes the fields of the UserDefinedAction structure.
| Field Name | Description | 
|---|---|
| ActorAction | Information about the current action of the specified actor, returned as a struct. The fields of the structure are described inActorActionstructure. | 
| Name | Action name, returned as a string. | 
| Parameters | Custom parameters of the user-defined action, returned as a struct. This structure contains the name and value of each
                  custom parameter. | 
This table describes the fields of the ActorAction structure.
| Field Name | Description | 
|---|---|
| ActorID | Identifier of actor performing the action, returned as a positive integer. | 
| PhaseInterval | Phase interval to which the action is applied, returned as an
                    enumeration variable of the  The value of  
 
 | 
| ActionType | Action type, returned as an enumeration variable of the
                       The value of
                       
 
 | 
This table describes the fields of the TransitionDynamics structure. 
| Field Name | Description | 
|---|---|
| Dimension | Transition metric measuring the action change, returned as an
                    enumeration variable of the  The value of  
 
 | 
| Shape | Shape of the transition curve, returned as an enumeration variable of
                    the  The
                    value of  
 
 | 
| Value | Value of the chosen transition metric, returned as a double. | 
Version History
Introduced in R2022a
See Also
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)