![]() |
WPILibC++ 2025.3.2
|
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, Requirements requirements={}) | |
| Creates a new FunctionalCommand. | |
| 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< Command, FunctionalCommand > | |
| CommandHelper ()=default | |
| CommandPtr | ToPtr () &&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, | ||
| Requirements | 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 |