139 std::function<
bool()> selector);
147template <
typename Key, std::convertible_to<CommandPtr>... CommandPtrs>
150 std::pair<Key, CommandPtrs>&&... commands) {
151 std::vector<std::pair<Key, std::unique_ptr<Command>>> vec;
153 ((void)vec.emplace_back(commands.first, std::move(commands.second).Unwrap()),
178[[nodiscard]] [[deprecated(
179 "The ProxyCommand supplier constructor has been deprecated. Use "
180 "Defer(supplier).AsProxy() instead.")]]
190[[nodiscard]] [[deprecated(
191 "The ProxyCommand supplier constructor has been deprecated. Use "
192 "Defer(supplier).AsProxy() instead.")]]
202template <std::convertible_to<CommandPtr>... Args>
204 std::vector<CommandPtr> data;
205 data.reserve(
sizeof...(Args));
206 (data.emplace_back(std::forward<Args>(args)), ...);
221template <std::convertible_to<CommandPtr>... CommandPtrs>
238template <std::convertible_to<CommandPtr>... CommandPtrs>
256template <std::convertible_to<CommandPtr>... CommandPtrs>
273template <std::convertible_to<CommandPtr>... CommandPtrs>
290template <std::convertible_to<CommandPtr>... CommandPtrs>
293 return Deadline(std::move(deadline),
CommandPtr ToPtr() &&override
Definition: CommandHelper.h:31
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:28
Represents requirements for a command, which is a set of (pointers to) subsystems.
Definition: Requirements.h:20
A command composition that runs one of a selection of commands using a selector and a key to command ...
Definition: SelectCommand.h:38
unique_function is a type-erasing functor similar to std::function.
Definition: FunctionExtras.h:58
basic_string_view< char > string_view
Definition: core.h:518
#define WPI_IGNORE_DEPRECATED
Definition: deprecated.h:16
#define WPI_UNIGNORE_DEPRECATED
Definition: deprecated.h:27
std::vector< CommandPtr > MakeVector(Args &&... args)
Create a vector of commands.
Definition: Commands.h:203
CommandPtr Deadline(CommandPtr &&deadline, std::vector< CommandPtr > &&others)
Runs a group of commands at the same time.
CommandPtr StartEnd(std::function< void()> start, std::function< void()> end, Requirements requirements={})
Constructs a command that runs an action once and another action when the command is interrupted.
CommandPtr WaitUntil(std::function< bool()> condition)
Constructs a command that does nothing, finishing once a condition becomes true.
CommandPtr Either(CommandPtr &&onTrue, CommandPtr &&onFalse, std::function< bool()> selector)
Runs one of two commands, based on the boolean selector function.
CommandPtr RunEnd(std::function< void()> run, std::function< void()> end, Requirements requirements={})
Constructs a command that runs an action every iteration until interrupted, and then runs a second ac...
CommandPtr None()
Constructs a command that does nothing, finishing immediately.
CommandPtr Parallel(std::vector< CommandPtr > &&commands)
Runs a group of commands at the same time.
CommandPtr RepeatingSequence(std::vector< CommandPtr > &&commands)
Runs a group of commands in series, one after the other.
CommandPtr Sequence(std::vector< CommandPtr > &&commands)
Runs a group of commands in series, one after the other.
CommandPtr Idle(Requirements requirements={})
Constructs a command that does nothing until interrupted.
CommandPtr RunOnce(std::function< void()> action, Requirements requirements={})
Constructs a command that runs an action once and finishes.
CommandPtr Run(std::function< void()> action, Requirements requirements={})
Constructs a command that runs an action every iteration until interrupted.
CommandPtr Print(std::string_view msg)
Constructs a command that prints a message and finishes.
CommandPtr Wait(units::second_t duration)
Constructs a command that does nothing, finishing after a specified duration.
CommandPtr Defer(wpi::unique_function< CommandPtr()> supplier, Requirements requirements)
Runs the command supplied by the supplier.
WPI_IGNORE_DEPRECATED CommandPtr DeferredProxy(wpi::unique_function< Command *()> supplier)
Constructs a command that schedules the command returned from the supplier when initialized,...
CommandPtr Select(std::function< Key()> selector, std::pair< Key, CommandPtrs > &&... commands)
Runs one of several commands, based on the selector function.
Definition: Commands.h:149
CommandPtr Race(std::vector< CommandPtr > &&commands)
Runs a group of commands at the same time.
CommandPtr StartRun(std::function< void()> start, std::function< void()> run, Requirements requirements={})
Constructs a command that runs an action once, and then runs an action every iteration until interrup...
Definition: NotifierCommand.h:16