9#include <initializer_list>
31 explicit CommandPtr(std::unique_ptr<CommandBase>&& command)
32 : m_ptr(
std::move(command)) {}
34 template <std::derived_from<Command> T>
38 std::make_unique<
std::decay_t<T>>(
std::forward<T>(command))) {}
91 std::span<Subsystem* const> requirements = {}) &&;
102 std::initializer_list<Subsystem*> requirements) &&;
124 std::initializer_list<Subsystem*> requirements) &&;
135 std::span<Subsystem* const> requirements = {}) &&;
327 explicit operator
bool() const&;
330 explicit operator
bool() && = delete;
340 void AssertValid() const;
A Sendable base class for Commands.
Definition: CommandBase.h:26
A state machine representing a complete action to be performed by the robot.
Definition: Command.h:44
InterruptionBehavior
An enum describing the command's behavior when another command with a shared requirement is scheduled...
Definition: Command.h:101
A wrapper around std::unique_ptr<Command> so commands have move-only semantics.
Definition: CommandPtr.h:29
CommandPtr OnlyIf(std::function< bool()> condition) &&
Decorates this command to only run if this condition is met.
void Cancel() const &
Cancels this command.
CommandPtr(std::unique_ptr< CommandBase > &&command)
Definition: CommandPtr.h:31
CommandBase * get() const &
Get a raw pointer to the held command.
CommandPtr BeforeStarting(std::function< void()> toRun, std::initializer_list< Subsystem * > requirements) &&
Decorates this command with a runnable to run before this command starts.
CommandPtr(CommandPtr &&)=default
CommandPtr HandleInterrupt(std::function< void()> handler) &&
Decorates this command with a lambda to call on interrupt, following the command's inherent Command::...
CommandPtr Unless(std::function< bool()> condition) &&
Decorates this command to only run if this condition is not met.
CommandPtr BeforeStarting(std::function< void()> toRun, std::span< Subsystem *const > requirements={}) &&
Decorates this command with a runnable to run before this command starts.
CommandPtr RaceWith(CommandPtr &¶llel) &&
Decorates this command with a set of commands to run parallel to it, ending when the first command en...
bool HasRequirement(Subsystem *requirement) const &
Whether the command requires a given subsystem.
CommandPtr AndThen(CommandPtr &&next) &&
Decorates this command with a set of commands to run after it in sequence.
CommandPtr Until(std::function< bool()> condition) &&
Decorates this command with an interrupt condition.
CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&
Decorates this command to run or stop when disabled.
CommandPtr WithInterruptBehavior(Command::InterruptionBehavior interruptBehavior) &&
Decorates this command to have a different interrupt behavior.
CommandPtr BeforeStarting(CommandPtr &&before) &&
Decorates this command with another command to run before this command starts.
CommandPtr WithName(std::string_view name) &&
Decorates this Command with a name.
CommandPtr AlongWith(CommandPtr &¶llel) &&
Decorates this command with a set of commands to run parallel to it, ending when the last command end...
CommandPtr(T &&command)
Definition: CommandPtr.h:36
static std::vector< std::unique_ptr< Command > > UnwrapVector(std::vector< CommandPtr > &&vec)
Convert a vector of CommandPtr objects to their underlying unique_ptrs.
void Schedule() const &
Schedules this command.
bool IsScheduled() const &
Whether or not the command is currently scheduled.
CommandPtr AsProxy() &&
Decorates this command to run "by proxy" by wrapping it in a ProxyCommand.
CommandPtr AndThen(std::function< void()> toRun, std::span< Subsystem *const > requirements={}) &&
Decorates this command with a runnable to run after the command finishes.
std::unique_ptr< CommandBase > Unwrap() &&
Convert to the underlying unique_ptr.
CommandPtr OnlyWhile(std::function< bool()> condition) &&
Decorates this command with a run condition.
CommandPtr FinallyDo(std::function< void(bool)> end) &&
Decorates this command with a lambda to call on interrupt or end, following the command's inherent Co...
CommandPtr WithTimeout(units::second_t duration) &&
Decorates this command with a timeout.
CommandPtr Repeatedly() &&
Decorates this command to run repeatedly, restarting it when it ends, until this command is interrupt...
CommandPtr & operator=(CommandPtr &&)=default
CommandPtr AndThen(std::function< void()> toRun, std::initializer_list< Subsystem * > requirements) &&
Decorates this command with a runnable to run after the command finishes.
CommandPtr DeadlineWith(CommandPtr &¶llel) &&
Decorates this command with a set of commands to run parallel to it, ending when the calling command ...
A robot subsystem.
Definition: Subsystem.h:39
basic_string_view< char > string_view
Definition: core.h:520
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
Definition: ProfiledPIDCommand.h:18
Definition: BFloat16.h:88