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 Laneaction in the specified phase. AChange Laneaction specifies for the actor to change lanes using the specified properties."ChangeSpeedAction"— Specifies to search for aChange Speedaction in the specified phase. AChange Speedaction specifies for the actor to change speed using the specified properties."ChangeLongitudinalDistanceAction"— Specifies to search for aChange Longitudinal Distanceaction in the specified phase. AChange Longitudinal Distanceaction specifies for the actor to change forward distance relative to another actor using the specified properties."ChangeLateralOffsetAction"— Specifies to search for aChange Lateral Offsetaction in the specified phase. AChange Lateral Offsetaction specifies for the actor to change lateral offset using the specified properties."WaitAction"— Specifies to search for aWaitaction in the specified phase. AWaitaction 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 Laneaction in the RoadRunner scenario logic. Specifies for the actor to change lanes using the specified properties.ChangeSpeedAction— Represents aChange Speedaction in the RoadRunner scenario logic. Specifies for the actor to change speed using the specified properties.ChangeLongitudinalDistanceAction— Represents aChange Longitudinal Distanceaction 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 Offsetaction in the RoadRunner scenario logic. Specifies for the actor to change lateral offset using the specified properties.WaitAction— Represents aWaitaction 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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)