Class SequentialGroup

java.lang.Object
org.wpilib.commands3.SequentialGroup
All Implemented Interfaces:
Command

public final class SequentialGroup extends Object implements Command
A sequence of commands that run one after another. Each successive command only starts after its predecessor completes execution. The priority of a sequence is equal to the highest priority of any of its commands. If all commands in the sequence are able to run while the robot is disabled, then the sequence itself will be allowed to run while the robot is disabled.

The sequence will own all mechanisms required by all commands in the sequence for the entire duration of the sequence. This means that a mechanism owned by one command in the sequence, but not by a later one, will be uncommanded while that later command executes.

  • Method Details

    • run

      public void run(Coroutine coroutine)
      Description copied from interface: Command
      Runs the command. Commands that need to periodically run until a goal state is reached should simply run a while loop like while (!atGoal()) { ... } and call Coroutine.yield() at the end of the loop.

      Warning: any loops in a command must call coroutine.yield(). Failure to do so will prevent anything else in your robot code from running. Commands are opt-in collaborative constructs; don't be greedy!

      Specified by:
      run in interface Command
      Parameters:
      coroutine - the coroutine backing the command's execution
    • name

      public String name()
      Description copied from interface: Command
      The name of the command.
      Specified by:
      name in interface Command
      Returns:
      the name of the command
    • requirements

      Description copied from interface: Command
      The mechanisms required by the command. This is used by the scheduler to determine if two commands conflict with each other. No mechanism may be required by more than one running command at a time.
      Specified by:
      requirements in interface Command
      Returns:
      the set of mechanisms required by the command
    • priority

      public int priority()
      Description copied from interface: Command
      The priority of the command. If a command is scheduled that conflicts with another running or pending command, their priority values are compared to determine which should run. If the scheduled command is lower priority than the running command, then it will not be scheduled and the running command will continue to run. If it is the same or higher priority, then the running command will be canceled and the scheduled command will start to run.
      Specified by:
      priority in interface Command
      Returns:
      the priority of the command
    • toString

      public String toString()
      Overrides:
      toString in class Object