WPILibC++ 2023.4.3-108-ge5452e3
|
A command that runs a given runnable when it is initialized, and another runnable when it ends. More...
#include <frc2/command/StartEndCommand.h>
Public Member Functions | |
StartEndCommand (std::function< void()> onInit, std::function< void()> onEnd, std::initializer_list< Subsystem * > requirements) | |
Creates a new StartEndCommand. More... | |
StartEndCommand (std::function< void()> onInit, std::function< void()> onEnd, std::span< Subsystem *const > requirements={}) | |
Creates a new StartEndCommand. More... | |
StartEndCommand (StartEndCommand &&other)=default | |
StartEndCommand (const StartEndCommand &other)=default | |
Public Member Functions inherited from frc2::CommandHelper< FunctionalCommand, StartEndCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Additional Inherited Members | |
Protected Member Functions inherited from frc2::CommandHelper< FunctionalCommand, StartEndCommand > | |
std::unique_ptr< Command > | TransferOwnership () &&override |
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() or Command.Until() to give it one.
This class is provided by the NewCommands VendorDep
frc2::StartEndCommand::StartEndCommand | ( | std::function< void()> | onInit, |
std::function< void()> | onEnd, | ||
std::initializer_list< 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 |
frc2::StartEndCommand::StartEndCommand | ( | std::function< void()> | onInit, |
std::function< void()> | onEnd, | ||
std::span< Subsystem *const > | 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 |
|
default |
|
default |