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 behavioris ignored within this command.
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic edu.wpi.first.wpilibj2.command.Commandasync(edu.wpi.first.wpilibj2.command.Command... commands) Mark one or more commands as asynchronous in the arguments list of anAsyncSequence.voidend(boolean interrupted) voidexecute()edu.wpi.first.wpilibj2.command.Command.InterruptionBehaviorvoidbooleanbooleanMethods 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
-
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 anAsyncSequence. 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:
initializein classedu.wpi.first.wpilibj2.command.Command
-
execute
public void execute()- Overrides:
executein classedu.wpi.first.wpilibj2.command.Command
-
end
public void end(boolean interrupted) - Overrides:
endin classedu.wpi.first.wpilibj2.command.Command
-
isFinished
public boolean isFinished()- Overrides:
isFinishedin classedu.wpi.first.wpilibj2.command.Command
-
getInterruptionBehavior
public edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior getInterruptionBehavior()- Overrides:
getInterruptionBehaviorin classedu.wpi.first.wpilibj2.command.Command
-
runsWhenDisabled
public boolean runsWhenDisabled()- Overrides:
runsWhenDisabledin classedu.wpi.first.wpilibj2.command.Command
-