WPILibC++ 2023.4.3-108-ge5452e3
|
A command composition that runs one of two commands, depending on the value of the given condition when this command is initialized. More...
#include <frc2/command/ConditionalCommand.h>
Public Member Functions | |
template<std::derived_from< Command > Command1, std::derived_from< Command > Command2> | |
ConditionalCommand (Command1 &&onTrue, Command2 &&onFalse, std::function< bool()> condition) | |
Creates a new ConditionalCommand. More... | |
ConditionalCommand (std::unique_ptr< Command > &&onTrue, std::unique_ptr< Command > &&onFalse, std::function< bool()> condition) | |
Creates a new ConditionalCommand. More... | |
ConditionalCommand (ConditionalCommand &&other)=default | |
ConditionalCommand (const ConditionalCommand &other)=delete | |
void | Initialize () override |
void | Execute () override |
void | End (bool interrupted) override |
bool | IsFinished () override |
bool | RunsWhenDisabled () const override |
InterruptionBehavior | GetInterruptionBehavior () const override |
void | InitSendable (wpi::SendableBuilder &builder) override |
Public Member Functions inherited from frc2::CommandHelper< CommandBase, ConditionalCommand > | |
CommandHelper ()=default | |
CommandPtr | ToPtr () &&override |
Additional Inherited Members | |
Protected Member Functions inherited from frc2::CommandHelper< CommandBase, ConditionalCommand > | |
std::unique_ptr< Command > | TransferOwnership () &&override |
A command composition that runs one of two commands, depending on the value of the given condition when this command is initialized.
The rules for command compositions apply: command instances that are passed to it are owned by the composition and cannot be added to any other composition or scheduled individually, and the composition requires all subsystems its components require.
This class is provided by the NewCommands VendorDep
|
inline |
Creates a new ConditionalCommand.
onTrue | the command to run if the condition is true |
onFalse | the command to run if the condition is false |
condition | the condition to determine which command to run |
frc2::ConditionalCommand::ConditionalCommand | ( | std::unique_ptr< Command > && | onTrue, |
std::unique_ptr< Command > && | onFalse, | ||
std::function< bool()> | condition | ||
) |
Creates a new ConditionalCommand.
onTrue | the command to run if the condition is true |
onFalse | the command to run if the condition is false |
condition | the condition to determine which command to run |
|
default |
|
delete |
|
override |
|
override |
|
override |
|
override |
|
override |
|
override |
|
override |