39 template <std::derived_from<Command> Command1,
40 std::derived_from<Command> Command2>
42 std::function<
bool()> condition)
44 std::forward<Command1>(onTrue)),
45 std::make_unique<
std::decay_t<Command2>>(
46 std::forward<Command2>(onFalse)),
57 std::unique_ptr<Command>&& onFalse,
58 std::function<
bool()> condition);
69 void End(
bool interrupted)
override;
80 std::unique_ptr<Command> m_onTrue;
81 std::unique_ptr<Command> m_onFalse;
82 std::function<bool()> m_condition;
83 Command* m_selectedCommand{
nullptr};
84 bool m_runsWhenDisabled =
true;
CRTP implementation to allow polymorphic decorator functions in Command.
Definition: CommandHelper.h:25
A state machine representing a complete action to be performed by the robot.
Definition: Command.h:44
A command composition that runs one of two commands, depending on the value of the given condition wh...
Definition: ConditionalCommand.h:30
ConditionalCommand(std::unique_ptr< Command > &&onTrue, std::unique_ptr< Command > &&onFalse, std::function< bool()> condition)
Creates a new ConditionalCommand.
ConditionalCommand(const ConditionalCommand &other)=delete
bool RunsWhenDisabled() const override
void InitSendable(wpi::SendableBuilder &builder) override
bool IsFinished() override
void Initialize() override
ConditionalCommand(Command1 &&onTrue, Command2 &&onFalse, std::function< bool()> condition)
Creates a new ConditionalCommand.
Definition: ConditionalCommand.h:41
ConditionalCommand(ConditionalCommand &&other)=default
void End(bool interrupted) override
InterruptionBehavior GetInterruptionBehavior() const override
Definition: SendableBuilder.h:18
Definition: ProfiledPIDCommand.h:18
Definition: BFloat16.h:88