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()),
195template <std::convertible_to<CommandPtr>... Args>
197 std::vector<CommandPtr> data;
198 data.reserve(
sizeof...(Args));
199 (data.emplace_back(std::forward<Args>(args)), ...);
214template <std::convertible_to<CommandPtr>... CommandPtrs>
231template <std::convertible_to<CommandPtr>... CommandPtrs>
249template <std::convertible_to<CommandPtr>... CommandPtrs>
266template <std::convertible_to<CommandPtr>... CommandPtrs>
283template <std::convertible_to<CommandPtr>... CommandPtrs>
286 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:57
std::vector< CommandPtr > MakeVector(Args &&... args)
Create a vector of commands.
Definition Commands.h:196
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 DeferredProxy(wpi::unique_function< Command *()> supplier)
Constructs a command that schedules the command returned from the supplier when initialized,...
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.
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 FunctionalCommand.h:13