38 template <
class T1,
class T2,
40 std::is_base_of_v<Command, std::remove_reference_t<T1>>>,
42 std::is_base_of_v<Command, std::remove_reference_t<T2>>>>
45 std::forward<T1>(onTrue)),
47 std::forward<T2>(onFalse)),
58 std::unique_ptr<Command>&& onFalse,
59 std::function<
bool()> condition);
70 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:26
A state machine representing a complete action to be performed by the robot.
Definition: Command.h:47
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(T1 &&onTrue, T2 &&onFalse, std::function< bool()> condition)
Creates a new ConditionalCommand.
Definition: ConditionalCommand.h:43
ConditionalCommand(const ConditionalCommand &other)=delete
bool RunsWhenDisabled() const override
Whether the given command should run when the robot is disabled.
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
bool IsFinished() override
Whether the command has finished.
void Initialize() override
The initial subroutine of a command.
ConditionalCommand(ConditionalCommand &&other)=default
void End(bool interrupted) override
The action to take when the command ends.
void Execute() override
The main body of a command.
Definition: SendableBuilder.h:18
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:298
typename std::remove_reference< T >::type remove_reference_t
Definition: core.h:303
Definition: InstantCommand.h:14
Definition: StdDeque.h:50