Package lib.commands

Class AsyncSequence

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
lib.commands.AsyncSequence
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
Direct Known Subclasses:
TrajectoryCommand.AsyncPathPlannerSequence

public class AsyncSequence extends edu.wpi.first.wpilibj2.command.Command
An AsyncSequence command is composed of a list of commands that are either synchronous (passed as a normal argument) or asynchronous (wrapped with async()). At any given time when this command is running...
  • One synchronous command will be running, unless all sync commands have finished and some async commands are still running.
  • Any asynchronous commands that were earlier in the list than the current sync command will also be running, unless a later command (sync or async) has been initialized with conflicting requirements. Interruption behavior is ignored within this command.
For example, when this command runs:

 new AsyncSequence(
     async(climber.c_up()),
     c_autonPartA(),
     c_autonPartB(),
     climber.c_down()
 )
 
The climber.c_up() and c_autonPartA() commands will start at the same time, and the climber up command will continue to run through auton parts A and B. Once climber.c_down() is reached, the climber up command will be canceled since it has conflicting requirements.
  • Nested Class Summary

    Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command

    edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior
  • Constructor Summary

    Constructors
    Constructor
    Description
    AsyncSequence(edu.wpi.first.wpilibj2.command.Command... commands)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static edu.wpi.first.wpilibj2.command.Command
    async(edu.wpi.first.wpilibj2.command.Command... commands)
    Mark one or more commands as asynchronous in the arguments list of an AsyncSequence.
    void
    end(boolean interrupted)
     
    void
     
    edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior
     
    void
     
    boolean
     
    boolean
     

    Methods inherited from class edu.wpi.first.wpilibj2.command.Command

    addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, deadlineWith, finallyDo, finallyDo, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initSendable, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, schedule, setName, setSubsystem, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeout

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AsyncSequence

      public AsyncSequence(edu.wpi.first.wpilibj2.command.Command... commands)
  • Method Details

    • async

      public static edu.wpi.first.wpilibj2.command.Command async(edu.wpi.first.wpilibj2.command.Command... commands)
      Mark one or more commands as asynchronous in the arguments list of an AsyncSequence. The returned command can ONLY be passed to the AsyncSequence constructor, and cannot be scheduled on its own or added to any other type of command composition.
      See Also:
    • initialize

      public void initialize()
      Overrides:
      initialize in class edu.wpi.first.wpilibj2.command.Command
    • execute

      public void execute()
      Overrides:
      execute in class edu.wpi.first.wpilibj2.command.Command
    • end

      public void end(boolean interrupted)
      Overrides:
      end in class edu.wpi.first.wpilibj2.command.Command
    • isFinished

      public boolean isFinished()
      Overrides:
      isFinished in class edu.wpi.first.wpilibj2.command.Command
    • getInterruptionBehavior

      public edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior getInterruptionBehavior()
      Overrides:
      getInterruptionBehavior in class edu.wpi.first.wpilibj2.command.Command
    • runsWhenDisabled

      public boolean runsWhenDisabled()
      Overrides:
      runsWhenDisabled in class edu.wpi.first.wpilibj2.command.Command