38 template <std::derived_from<Command> Command1,
39 std::derived_from<Command> Command2>
41 std::function<
bool()> condition)
43 std::forward<Command1>(onTrue)),
45 std::forward<Command2>(onFalse)),
56 std::unique_ptr<Command>&& onFalse,
57 std::function<
bool()> condition);
68 void End(
bool interrupted)
override;
79 std::unique_ptr<Command> m_onTrue;
80 std::unique_ptr<Command> m_onFalse;
81 std::function<bool()> m_condition;
82 Command* m_selectedCommand{
nullptr};
83 bool m_runsWhenDisabled =
true;
CRTP implementation to allow polymorphic decorator functions in Command.
Definition: CommandHelper.h:27
A state machine representing a complete action to be performed by the robot.
Definition: Command.h:41
A command composition that runs one of two commands, depending on the value of the given condition wh...
Definition: ConditionalCommand.h:29
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:40
ConditionalCommand(ConditionalCommand &&other)=default
void End(bool interrupted) override
InterruptionBehavior GetInterruptionBehavior() const override
Helper class for building Sendable dashboard representations.
Definition: SendableBuilder.h:21
Definition: TrapezoidProfileSubsystem.h:12
typename std::decay< T >::type decay_t
Definition: expected:231