WPILibC++ 2023.4.3-108-ge5452e3
|
A command that allows the user to pass in functions for each of the basic command methods through the constructor. More...
#include <frc2/command/FunctionalCommand.h>
Public Member Functions | |
FunctionalCommand (std::function< void()> onInit, std::function< void()> onExecute, std::function< void(bool)> onEnd, std::function< bool()> isFinished, std::initializer_list< Subsystem * > requirements) | |
Creates a new FunctionalCommand. More... | |
FunctionalCommand (std::function< void()> onInit, std::function< void()> onExecute, std::function< void(bool)> onEnd, std::function< bool()> isFinished, std::span< Subsystem *const > requirements={}) | |
Creates a new FunctionalCommand. More... | |
FunctionalCommand (FunctionalCommand &&other)=default | |
FunctionalCommand (const FunctionalCommand &other)=default | |
void | Initialize () override |
void | Execute () override |
void | End (bool interrupted) override |
bool | IsFinished () override |
Public Member Functions inherited from frc2::CommandHelper< CommandBase, FunctionalCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Additional Inherited Members | |
Protected Member Functions inherited from frc2::CommandHelper< CommandBase, FunctionalCommand > | |
std::unique_ptr< Command > | TransferOwnership () &&override |
A command that allows the user to pass in functions for each of the basic command methods through the constructor.
Useful for inline definitions of complex commands - note, however, that if a command is beyond a certain complexity it is usually better practice to write a proper class for it than to inline it.
This class is provided by the NewCommands VendorDep
frc2::FunctionalCommand::FunctionalCommand | ( | std::function< void()> | onInit, |
std::function< void()> | onExecute, | ||
std::function< void(bool)> | onEnd, | ||
std::function< bool()> | isFinished, | ||
std::initializer_list< Subsystem * > | requirements | ||
) |
Creates a new FunctionalCommand.
onInit | the function to run on command initialization |
onExecute | the function to run on command execution |
onEnd | the function to run on command end |
isFinished | the function that determines whether the command has finished |
requirements | the subsystems required by this command |
frc2::FunctionalCommand::FunctionalCommand | ( | std::function< void()> | onInit, |
std::function< void()> | onExecute, | ||
std::function< void(bool)> | onEnd, | ||
std::function< bool()> | isFinished, | ||
std::span< Subsystem *const > | requirements = {} |
||
) |
Creates a new FunctionalCommand.
onInit | the function to run on command initialization |
onExecute | the function to run on command execution |
onEnd | the function to run on command end |
isFinished | the function that determines whether the command has finished |
requirements | the subsystems required by this command |
|
default |
|
default |
|
override |
|
override |
|
override |
|
override |