78 template <std::derived_from<Command> T>
81 this, std::forward<T>(defaultCommand));
A state machine representing a complete action to be performed by the robot.
Definition Command.hpp:41
A wrapper around std::unique_ptr<Command> so commands have move-only semantics.
Definition CommandPtr.hpp:28
void SetDefaultCommand(Subsystem *subsystem, T &&defaultCommand)
Sets the default command for a subsystem.
Definition CommandScheduler.hpp:214
static CommandScheduler & GetInstance()
Returns the Scheduler instance.
A robot subsystem.
Definition Subsystem.hpp:42
CommandPtr RunOnce(std::function< void()> action)
Constructs a command that runs an action once and finishes.
CommandPtr StartEnd(std::function< void()> start, std::function< void()> end)
Constructs a command that runs an action once and another action when the command is interrupted.
CommandPtr Run(std::function< void()> action)
Constructs a command that runs an action every iteration until interrupted.
void SetDefaultCommand(CommandPtr &&defaultCommand)
Sets the default Command of the subsystem.
CommandPtr Idle()
Constructs a command that does nothing until interrupted.
virtual void Periodic()
This method is called periodically by the CommandScheduler.
Command * GetCurrentCommand() const
Returns the command currently running on this subsystem.
CommandPtr Defer(wpi::util::unique_function< CommandPtr()> supplier)
Constructs a DeferredCommand with the provided supplier.
CommandPtr StartRun(std::function< void()> start, std::function< void()> run)
Constructs a command that runs an action once, and then runs an action every iteration until interrup...
virtual std::string GetName() const
Gets the name of this Subsystem.
CommandPtr RunEnd(std::function< void()> run, std::function< void()> end)
Constructs a command that runs an action every iteration until interrupted, and then runs a second ac...
void SetDefaultCommand(T &&defaultCommand)
Sets the default Command of the subsystem.
Definition Subsystem.hpp:79
virtual void SimulationPeriodic()
This method is called periodically by the CommandScheduler.
void RemoveDefaultCommand()
Removes the default command for the subsystem.
Command * GetDefaultCommand() const
Gets the default command for this subsystem.
void Register()
Registers this subsystem with the CommandScheduler, allowing its Periodic() method to be called when ...
unique_function is a type-erasing functor similar to std::function.
Definition FunctionExtras.hpp:57
Definition CommandNiDsStadiaController.hpp:15