79 template <std::derived_from<Command> T>
82 this, std::forward<T>(defaultCommand));
A state machine representing a complete action to be performed by the robot.
Definition: Command.h:41
A wrapper around std::unique_ptr<Command> so commands have move-only semantics.
Definition: CommandPtr.h:29
static CommandScheduler & GetInstance()
Returns the Scheduler instance.
void SetDefaultCommand(Subsystem *subsystem, T &&defaultCommand)
Sets the default command for a subsystem.
Definition: CommandScheduler.h:184
A robot subsystem.
Definition: Subsystem.h:43
void SetDefaultCommand(CommandPtr &&defaultCommand)
Sets the default Command of the subsystem.
virtual std::string GetName() const
Gets the name of this Subsystem.
void SetDefaultCommand(T &&defaultCommand)
Sets the default Command of the subsystem.
Definition: Subsystem.h:80
Command * GetCurrentCommand() const
Returns the command currently running on this subsystem.
void Register()
Registers this subsystem with the CommandScheduler, allowing its Periodic() method to be called when ...
CommandPtr RunOnce(std::function< void()> action)
Constructs a command that runs an action once and finishes.
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 RemoveDefaultCommand()
Removes the default command for the subsystem.
virtual void SimulationPeriodic()
This method is called periodically by the CommandScheduler.
virtual void Periodic()
This method is called periodically by the CommandScheduler.
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 Defer(wpi::unique_function< CommandPtr()> supplier)
Constructs a DeferredCommand with the provided supplier.
Command * GetDefaultCommand() const
Gets the default command for this subsystem.
CommandPtr Run(std::function< void()> action)
Constructs a command that runs an action every iteration until interrupted.
unique_function is a type-erasing functor similar to std::function.
Definition: FunctionExtras.h:57
Definition: TrapezoidProfileSubsystem.h:12