remove
Syntax
Description
remove(
removes the specified
condition object from the current scenario.rrCondition
)
Examples
By default, RoadRunner Scenario automatically adds a Collision
condition to the
scenario Fail Conditions when you create a new scenario. This
Collision
condition specifies for RoadRunner Scenario to fail the simulation if any actor collides with any other actor.
Use the remove
function to remove the default
Collision
condition from your scenario logic to specify for the
simulation to continue after an actor collides with another 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.
Add Second Actor to Scenario
Add a second vehicle actor, staticCar
, to the scenario and
anchor it to the "ScenarioStart"
scene anchor.
staticCar = addActor(scnro,mySedan,[0 0 0]); StaticPoint = findSceneAnchor(scnro,"ScenarioStart"); staticCarPoint = staticCar.InitialPoint; anchorToPoint(staticCarPoint,StaticPoint,PosePreservation="reset-pose")
Specify the Name
property of the new actor, so you can more
easily distinguish the two actors in the scenario logic. Name
staticCar
as "StaticCar"
. Then, set the
ForwardOffset
property of staticCar
to
30
m, so it does not overlap the position of
car
on the road.
staticCar.Name = "StaticCar";
staticCar.InitialPoint.ForwardOffset = 30;
Use initialPhaseForActor
to extract the object for the initial phase of
staticCar
. Then, use the findActions
function to extract the ChangeSpeedAction
object from that phase
and change the Speed
property of the action to 0
m/s.
staticCarPhase = initialPhaseForActor(rrLogic,staticCar);
staticCarAction = findActions(staticCarPhase,"ChangeSpeedAction");
staticCarAction.Speed = 0;
Remove Scenario Fail Condition
Retrieve the existing CollisionCondition
object for the
scenario collisionCondition
by extracting the
FailCondition
property of the RootPhase
property of the scenario phase logic object rrLogic
.
collisionCondition = rrLogic.RootPhase.FailCondition;
Use the remove
function to remove the fail condition
collisionCondition
, enabling the simulation to continue after
car
collides with staticCar
.
remove(collisionCondition)
Run the simulation by using the simulateScenario
function.
simulateScenario(rrApp)
Input Arguments
Condition object to remove, specified as one of these objects:
ActorSpeedCondition
— Represents anActor Speed
condition in the RoadRunner scenario logic that specifies for the associated phase to end when an actor reaches the specified speed.DurationCondition
— Represents aDuration
condition in the RoadRunner scenario logic that specifies for the associated phase to end after the specified amount of time elapses.CollisionCondition
— Represents aCollision
condition in the RoadRunner scenario logic that specifies for the associated phase to end when one actor collides with another actor.PhaseStateCondition
— Represents aPhase State
condition in the RoadRunner scenario logic that specifies for the associated phase to end when the referenced phase reaches the specified state.DistanceToActorCondition
— Represents aDistance To Actor
condition in the RoadRunner scenario logic that specifies for the associated phase to end when an actor is a certain distance away from a reference actor.DistanceToPointCondition
— Represents aDistance To Point
condition in the RoadRunner scenario logic that specifies for the associated phase to end when an actor is a certain distance away from a specified point.LongitudinalDistanceToActorCondition
— Represents aLongitudinal Distance To Actor
condition in the RoadRunner scenario logic that specifies for the associated phase to end when an actor reaches a certain longitudinal distance from another actor.
Version History
Introduced in R2025a
See Also
roadrunnerAPI
| Scenario
| validate
| setFailCondition
| setEndCondition
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)