Class BaseParallelDeadlineGroup
java.lang.Object
org.wpilib.command2.Command
xbot.common.command.BaseCommand
xbot.common.command.BaseParallelDeadlineGroup
- All Implemented Interfaces:
AutoCloseable, org.wpilib.telemetry.TelemetryLoggable, org.wpilib.tunable.ComplexTunable, TunablePrefixProvider
A command composition that runs a set of commands in parallel, ending only when a specific
command (the "deadline") ends, interrupting all other commands that are still running at that
point.
The rules for command compositions apply: command instances that are passed to it cannot be added to any other composition or scheduled individually, and the composition requires all subsystems its components require.
This class is provided by the NewCommands VendorDep
-
Nested Class Summary
Nested classes/interfaces inherited from class org.wpilib.command2.Command
org.wpilib.command2.Command.InterruptionBehavior -
Field Summary
Fields inherited from class BaseCommand
aKitLog, log, monitor, runningAlert -
Constructor Summary
ConstructorsConstructorDescriptionBaseParallelDeadlineGroup(org.wpilib.command2.Command deadline, org.wpilib.command2.Command... otherCommands) Creates a new ParallelDeadlineGroup. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddCommands(org.wpilib.command2.Command... commands) Adds the given commands to the group.final voidend(boolean interrupted) final voidexecute()org.wpilib.command2.Command.InterruptionBehaviorfinal voidfinal booleanbooleanfinal voidsetDeadline(org.wpilib.command2.Command deadline) Sets the deadline to the given command.Methods inherited from class BaseCommand
close, getPrefix, publishToTunables, publishToTunables, setRunsWhenDisabledMethods inherited from class org.wpilib.command2.Command
addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, finallyDo, finallyDo, getName, getRequirements, getTelemetryType, getTunableType, handleInterrupt, hasRequirement, ignoringDisable, isScheduled, logTo, onlyIf, onlyWhile, publishTunable, raceWith, repeatedly, setName, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeoutMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wpilib.tunable.ComplexTunable
publishChildTunable, publishChildTunable, removeChildTunable, setChildTunableChanged, updateTunable
-
Constructor Details
-
BaseParallelDeadlineGroup
public BaseParallelDeadlineGroup(org.wpilib.command2.Command deadline, org.wpilib.command2.Command... otherCommands) Creates a new ParallelDeadlineGroup. The given commands, including the deadline, will be executed simultaneously. The composition will finish when the deadline finishes, interrupting all other still-running commands. If the composition is interrupted, only the commands still running will be interrupted.- Parameters:
deadline- the command that determines when the composition endsotherCommands- the other commands to be executed- Throws:
IllegalArgumentException- if the deadline command is also in the otherCommands argument
-
-
Method Details
-
setDeadline
public final void setDeadline(org.wpilib.command2.Command deadline) Sets the deadline to the given command. The deadline is added to the group if it is not already contained.- Parameters:
deadline- the command that determines when the group ends- Throws:
IllegalArgumentException- if the deadline command is already in the composition
-
addCommands
public final void addCommands(org.wpilib.command2.Command... commands) Adds the given commands to the group.- Parameters:
commands- Commands to add to the group.
-
initialize
public final void initialize()- Overrides:
initializein classBaseCommand
-
execute
public final void execute()- Overrides:
executein classorg.wpilib.command2.Command
-
end
public final void end(boolean interrupted) - Overrides:
endin classBaseCommand
-
isFinished
public final boolean isFinished()- Overrides:
isFinishedin classorg.wpilib.command2.Command
-
runsWhenDisabled
public boolean runsWhenDisabled()- Overrides:
runsWhenDisabledin classBaseCommand
-
getInterruptionBehavior
public org.wpilib.command2.Command.InterruptionBehavior getInterruptionBehavior()- Overrides:
getInterruptionBehaviorin classorg.wpilib.command2.Command
-