Contenuto principale

RemoveActorAction

Specify Remove Actor action

Since R2026a

    Description

    The RemoveActorAction object represents a Remove Actor action in the RoadRunner scenario logic. The Remove Actor action specifies for RoadRunner Scenario to remove the associated actor from the scenario during simulation run time. The associated actor is the actor specified by the Actor property of the ActorActionPhase object in the Phase property of the RemoveActorAction object. Specifying RemoveActorAction as the action type when adding an action to your scenario adds a Remove Actor action to the specified phase in the scenario logic. You can use the RemoveActorAction object to programmatically modify the attributes of the corresponding Remove Actor action by changing the property values of the object.

    Creation

    The addAction function adds an action of the specified type as a child to the specified phase. Specify the actionType argument as "RemoveActorAction" to create a RemoveActorAction object associated with the specified phase.

    Properties

    expand all

    Name of the action, specified as a string scalar or character vector.

    Note

    You can specify the Name property of RemoveActorAction in MATLAB®, but RoadRunner Scenario does not display the Name property of actions in the user interface.

    Phase containing the action, specified as an ActorActionPhase object. RoadRunner Scenario uses the Actor property of this ActorActionPhase object to determine the actor to remove.

    Examples

    collapse all

    Specify for RoadRunner Scenario to remove the actor car from a scenario after 5 seconds of simulation time.

    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 RemoveActorAction Object to Scenario Logic

    Use addPhaseInSerial to add a new actor action phase, newPhase, in serial after the initial phase and assign the new phase to the actor car. Then, use addAction to specify the action of the new phase as "RemoveActorAction". The newPhase object represents the newly created actor action phase in the scenario logic, and removeAct represents the Remove Actor action assigned to newPhase.

    newPhase = addPhaseInSerial(rrLogic,initPhase,"ActorActionPhase",Insertion="after");
    newPhase.Actor = car
    removeAct = addAction(newPhase,"RemoveActorAction");

    To specify the duration of the simulation before the Remove Actor action executes, use setEndCondition to add a Duration condition to the initial phase initPhase. Then, set the Duration property of the condition simTime to 5 seconds.

    simTime = setEndCondition(initPhase,"DurationCondition");
    simTime.Duration = 5;
    

    Run the simulation by using the simulateScenario function. The simulation runs for 5 seconds before the Remove Actor action executes and removes the actor car.

    simulateScenario(rrApp)

    Version History

    Introduced in R2026a