getAction
Syntax
Description
gets the specified action 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.
gets the user-defined action named action
= getAction(actorSim
,"UserDefinedAction",UserDefinedActionName
)UserDefinedActionName
for the actor
represented by actorSim
.
Examples
Get Lateral Offset Action of Actor
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
actorSim
— Actor
ActorSimulation
object
Actor from which to return action, specified as an ActorSimulation
object.
actionName
— Actor action
"PathAction"
| "SpeedAction"
| "LaneChangeAction"
| "LateralOffsetAction"
| "ChangeParameterAction"
| "LongitudinalDistanceAction"
| "UserDefinedAction"
Actor action to be returned, specified as one of these values:
"PathAction"
"SpeedAction"
"LaneChangeAction"
"LateralOffsetAction"
"ChangeParameterAction"
"LongitudinalDistanceAction"
"UserDefinedAction"
Data Types: string
| char
UserDefinedActionName
— Name of user-defined action
character vector | string scalar
Name of the user-defined action to be returned, specified as a character vector or string scalar.
Data Types: string
| char
Output Arguments
action
— Action
struct
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" | PathAction structure |
"SpeedAction" | SpeedAction structure |
"LaneChangeAction" | LaneChangeAction structure |
"LateralOffsetAction" | LateralOffsetAction structure |
"ChangeParameterAction" | ChangeParameterAction structure |
"LongitudinalDistanceAction" | LongitudinalDistanceAction structure |
"UserDefinedAction" | UserDefinedAction structure |
More About
PathAction
structure
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 in ActorAction structure. |
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. |
SpeedAction
structure
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 in ActorAction structure. |
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 in TransitionDynamics structure. |
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
|
LaneChangeAction
structure
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 in ActorAction structure. |
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 in TransitionDynamics structure. |
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
int32 value. |
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. |
LateralOffsetAction
structure
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 in ActorAction structure. |
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 in TransitionDynamics structure. |
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
|
ChangeParameterAction
structure
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 in ActorAction structure. |
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
EnumParameterType enumeration class.The value of
|
LongitudinalDistanceAction
structure
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 in ActorAction structure. |
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 . |
UserDefinedAction
structure
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 in ActorAction structure. |
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. |
ActorAction
structure
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
|
TransitionDynamics
structure
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-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)