getAction
Get actions associated with actor
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
Simulink.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
Simulink.ActorSimulation
object
Actor from which to return action, specified as a
Simulink.ActorSimulation
object.
Example: action = getAction(actorSim,'PathAction')
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
UserDefinedActionName
— Name of user-defined action
character vector
| string
Name of the user-defined action to be returned, specified as a character vector or string.
Output Arguments
action
— Action
struct
Action of specified actor at current time step, returned as a
struct
.
The output is a PathAction
, SpeedAction
,
LaneChangeAction
, LateralOffsetAction
,
ChangeParameterAction
, or
LongitudinalDistanceAction
structure depending on the input
argument Action
.
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 . |
LaneChangeTarget | Target lane after lane change, returned as a
struct . |
TransitionDynamics | Dynamics of the transition to the lane change, returned as a
struct . |
This table describes the fields of the ActorAction
structure of
the LaneChangeAction
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 EnumPhaseInterval enumeration
class.The value of
|
ActionType | Action type, returned as an enumeration variable of the
The value
of
|
Note
The ActorAction
structure is also contained in other action
output structures.
PathAction
SpeedAction
LateralOffsetAction
ChangeParameterAction
LongitudinalDistanceAction
UserDefinedAction
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. |
This table describes the fields of the TransitionDynamics
structure of the LaneChangeAction
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 . |
Note
The TransitionDynamics
structure is also contained in other
action output structures.
SpeedAction
LateralOffsetAction
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 . |
PathTarget | Actor target path, returned as a struct . |
The fields of the ActorAction
structure are described in the
table under LaneChangeAction
structure.
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 . |
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 ActorAction
structure are described in the
table under LaneChangeAction
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
|
The fields of the ActorAction
structure are described in the
table under LaneChangeAction
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 . |
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 ActorAction
structure are described in the
table under LaneChangeAction
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
double .
|
The fields of the TransitionDynamics
structure are described in
the table under LaneChangeAction
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 . |
Parameter | Information about the changed user-specified behavior parameter, returned
as a struct . |
The fields of the ActorAction
structure are described in the
table under LaneChangeAction
structure.
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. |
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 . |
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 . |
The fields of the ActorAction
structure are described in the
table under LaneChangeAction
structure.
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 . |
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. |
The fields of the ActorAction
structure are described in the
table under LaneChangeAction
structure.
Version History
Introduced in R2022a
See Also
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
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)