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 Speedcondition in the RoadRunner scenario logic that specifies for the associated phase to end when an actor reaches the specified speed.DurationCondition— Represents aDurationcondition in the RoadRunner scenario logic that specifies for the associated phase to end after the specified amount of time elapses.CollisionCondition— Represents aCollisioncondition in the RoadRunner scenario logic that specifies for the associated phase to end when one actor collides with another actor.PhaseStateCondition— Represents aPhase Statecondition 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 Actorcondition 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 Pointcondition 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 Actorcondition 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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)