WPILibC++ 2025.2.1
|
Defers Command construction to runtime. More...
#include <frc2/command/DeferredCommand.h>
Public Member Functions | |
DeferredCommand (wpi::unique_function< CommandPtr()> supplier, Requirements requirements) | |
Creates a new DeferredCommand that directly runs the supplied command when initialized, and ends when it ends. | |
DeferredCommand (DeferredCommand &&other)=default | |
void | Initialize () override |
void | Execute () override |
void | End (bool interrupted) override |
bool | IsFinished () override |
void | InitSendable (wpi::SendableBuilder &builder) override |
Public Member Functions inherited from frc2::CommandHelper< Command, DeferredCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Defers Command construction to runtime.
Runs the command returned by a supplier when this command is initialized, and ends when it ends. Useful for performing runtime tasks before creating a new command. If this command is interrupted, it will cancel the command.
Note that the supplier must create a new Command each call. For selecting one of a preallocated set of commands, use SelectCommand.
This class is provided by the NewCommands VendorDep
frc2::DeferredCommand::DeferredCommand | ( | wpi::unique_function< CommandPtr()> | supplier, |
Requirements | requirements ) |
Creates a new DeferredCommand that directly runs the supplied command when initialized, and ends when it ends.
Useful for lazily creating commands when the DeferredCommand is initialized, such as if the supplied command depends on runtime state. The supplier will be called each time this command is initialized. The supplier must create a new Command each call.
supplier | The command supplier |
requirements | The command requirements. |
|
default |
|
override |
|
override |
|
override |
|
override |
|
override |