findActions
Description
finds all actions of the specified action type in the specified logic phase. For example,
rrActions
= findActions(rrPhase
,actionType
)rrActions = findActions(rrPhase,"ChangeSpeedAction")
extracts an
object, rrActions
, that represents the Change Speed
action type assigned to rrPhase
.
Examples
By default, RoadRunner Scenario creates an initial phase for every actor added to a scenario. The initial
phase contains a Change Speed
action that sets the initial speed
value for the associated actor. Use the findActions
function to
extract a ChangeSpeedAction
object that represents the
Change Speed
action from the initial phase of the actor
car
. Then, use the extracted ChangeSpeedAction
object to modify the initial speed of the actor.
This example assumes that you have prior knowledge of working with RoadRunner in MATLAB®. Before proceeding, follow the steps outlined in Set Up MATLAB Environment for RoadRunner Authoring Functions to set up your scenario using MATLAB functions for scenario authoring.
Use findActions
to Extract
ChangeSpeedAction
Object
Use the initialPhaseForActor
function to extract the object for the initial
phase of the actor car
. Then, use the
findActions
function to extract the
ChangeSpeedAction
object from the actor initial phase
initPhase
.
initPhase = initialPhaseForActor(rrLogic,car);
initSpeed = findActions(initPhase,"ChangeSpeedAction");
Modify the initial speed value to specify for the actor to move at 50 m/s. Then,
run the simulation by using the simulateScenario
function.
initSpeed.Speed = 50; simulateScenario(rrApp)
Input Arguments
Phase to search, specified as an ActorActionPhase
object
or SystemActionPhase
object.
Type of action to find, specified as one of these action types:
"ChangeLaneAction"
— Specifies to search for aChange Lane
action in the specified phase. AChange Lane
action specifies for the actor to change lanes using the specified properties."ChangeSpeedAction"
— Specifies to search for aChange Speed
action in the specified phase. AChange Speed
action specifies for the actor to change speed using the specified properties."ChangeLongitudinalDistanceAction"
— Specifies to search for aChange Longitudinal Distance
action in the specified phase. AChange Longitudinal Distance
action specifies for the actor to change forward distance relative to another actor using the specified properties."ChangeLateralOffsetAction"
— Specifies to search for aChange Lateral Offset
action in the specified phase. AChange Lateral Offset
action specifies for the actor to change lateral offset using the specified properties."WaitAction"
— Specifies to search for aWait
action in the specified phase. AWait
action specifies for the simulation to wait in this phase until an associated condition ends the phase.
Example: rrActions = findActions(initPhase,"ChangeSpeedAction")
extracts the Change Speed
action from the initial phase
initPhase
.
Output Arguments
Actions extracted from the phase, returned as an array of one of these types of objects:
ChangeLaneAction
— Represents aChange Lane
action in the RoadRunner scenario logic. Specifies for the actor to change lanes using the specified properties.ChangeSpeedAction
— Represents aChange Speed
action in the RoadRunner scenario logic. Specifies for the actor to change speed using the specified properties.ChangeLongitudinalDistanceAction
— Represents aChange Longitudinal Distance
action in the RoadRunner scenario logic. Specifies for the actor to change forward distance relative to another actor using the specified properties.ChangeLateralOffsetAction
— Represents aChange Lateral Offset
action in the RoadRunner scenario logic. Specifies for the actor to change lateral offset using the specified properties.WaitAction
— Represents aWait
action in the RoadRunner scenario logic. Specifies for the simulation to wait in this phase until an associated condition ends the phase.
Each object in rrActions
represents the type and attributes of an
action for the action phase rrPhase
in RoadRunner Scenario.
Version History
Introduced in R2025a
See Also
roadrunnerAPI
| PhaseLogic
| ActorActionPhase
| addAction
| initialPhaseForActor
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.
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)