RobotCore
Robot Core Documentation
|
Public Member Functions | |
StartEndCommand (Runnable onInit, Runnable onEnd, Subsystem... requirements) | |
void | initialize () |
void | end (boolean interrupted) |
Public Member Functions inherited from edu.wpi.first.wpilibj2.command.CommandBase | |
final void | addRequirements (Subsystem... requirements) |
Set< Subsystem > | getRequirements () |
Public Member Functions inherited from edu.wpi.first.wpilibj2.command.Command | |
default void | execute () |
default boolean | isFinished () |
default ParallelRaceGroup | withTimeout (double seconds) |
default ParallelRaceGroup | withInterrupt (BooleanSupplier condition) |
default SequentialCommandGroup | beforeStarting (Runnable toRun, Subsystem... requirements) |
default SequentialCommandGroup | andThen (Runnable toRun, Subsystem... requirements) |
default SequentialCommandGroup | andThen (Command... next) |
default ParallelDeadlineGroup | deadlineWith (Command... parallel) |
default ParallelCommandGroup | alongWith (Command... parallel) |
default ParallelRaceGroup | raceWith (Command... parallel) |
default PerpetualCommand | perpetually () |
default ProxyScheduleCommand | asProxy () |
default void | schedule (boolean interruptible) |
default void | schedule () |
default void | cancel () |
default boolean | isScheduled () |
default boolean | hasRequirement (Subsystem requirement) |
default boolean | runsWhenDisabled () |
default String | getName () |
Protected Attributes | |
final Runnable | m_onInit |
final Runnable | m_onEnd |
Protected Attributes inherited from edu.wpi.first.wpilibj2.command.CommandBase | |
Set< Subsystem > | m_requirements = new HashSet<>() |
A command that runs a given runnable when it is initialized, and another runnable when it ends. Useful for running and then stopping a motor, or extending and then retracting a solenoid. Has no end condition as-is; either subclass it or use Command#withTimeout(double) or Command#withInterrupt(BooleanSupplier) to give it one.
edu.wpi.first.wpilibj2.command.StartEndCommand.StartEndCommand | ( | Runnable | onInit, |
Runnable | onEnd, | ||
Subsystem... | requirements | ||
) |
Creates a new StartEndCommand. Will run the given runnables when the command starts and when it ends.
onInit | the Runnable to run on command init |
onEnd | the Runnable to run on command end |
requirements | the subsystems required by this command |
void edu.wpi.first.wpilibj2.command.StartEndCommand.end | ( | boolean | interrupted | ) |
The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.
Do not schedule commands here that share requirements with this command. Use andThen(Command...) instead.
interrupted | whether the command was interrupted/canceled |
Implements edu.wpi.first.wpilibj2.command.Command.
void edu.wpi.first.wpilibj2.command.StartEndCommand.initialize | ( | ) |
The initial subroutine of a command. Called once when the command is initially scheduled.
Implements edu.wpi.first.wpilibj2.command.Command.