127 std::function<
bool()> selector);
135template <
typename Key, std::convertible_to<CommandPtr>... CommandPtrs>
137 std::pair<Key, CommandPtrs>&&... commands) {
138 std::vector<std::pair<Key, std::unique_ptr<Command>>> vec;
140 ((void)vec.emplace_back(commands.first, std::move(commands.second).Unwrap()),
179template <std::convertible_to<CommandPtr>... Args>
181 std::vector<CommandPtr> data;
182 data.reserve(
sizeof...(Args));
183 (data.emplace_back(std::forward<Args>(args)), ...);
197template <std::convertible_to<CommandPtr>... CommandPtrs>
212template <std::convertible_to<CommandPtr>... CommandPtrs>
228template <std::convertible_to<CommandPtr>... CommandPtrs>
243template <std::convertible_to<CommandPtr>... CommandPtrs>
258template <std::convertible_to<CommandPtr>... CommandPtrs>
260 return Deadline(std::move(deadline),
CommandPtr ToPtr() &&override
Definition CommandHelper.hpp:31
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
Represents requirements for a command, which is a set of (pointers to) subsystems.
Definition Requirements.hpp:20
A command composition that runs one of a selection of commands using a selector and a key to command ...
Definition SelectCommand.hpp:37
A robot subsystem.
Definition Subsystem.hpp:42
unique_function is a type-erasing functor similar to std::function.
Definition FunctionExtras.hpp:57
Definition Commands.hpp:174
std::vector< CommandPtr > MakeVector(Args &&... args)
Create a vector of commands.
Definition Commands.hpp:180
Namespace for command factories.
Definition Commands.hpp:26
CommandPtr Race(std::vector< CommandPtr > &&commands)
Runs a group of commands at the same time.
CommandPtr Select(std::function< Key()> selector, std::pair< Key, CommandPtrs > &&... commands)
Runs one of several commands, based on the selector function.
Definition Commands.hpp:136
CommandPtr Sequence(std::vector< CommandPtr > &&commands)
Runs a group of commands in series, one after the other.
CommandPtr Run(std::function< void()> action, Requirements requirements={})
Constructs a command that runs an action every iteration until interrupted.
CommandPtr Wait(wpi::units::second_t duration)
Constructs a command that does nothing, finishing after a specified duration.
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 DeferredProxy(wpi::util::unique_function< Command *()> supplier)
Constructs a command that schedules the command returned from the supplier when initialized,...
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...
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 Deadline(CommandPtr &&deadline, std::vector< CommandPtr > &&others)
Runs a group of commands at the same time.
CommandPtr Print(std::string_view msg)
Constructs a command that prints a message and finishes.
CommandPtr Parallel(std::vector< CommandPtr > &&commands)
Runs a group of commands at the same time.
CommandPtr Idle(Requirements requirements={})
Constructs a command that does nothing until interrupted.
CommandPtr Defer(wpi::util::unique_function< CommandPtr()> supplier, Requirements requirements)
Runs the command supplied by the supplier.
CommandPtr None()
Constructs a command that does nothing, finishing immediately.
CommandPtr RepeatingSequence(std::vector< CommandPtr > &&commands)
Runs a group of commands in series, one after the other.
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 RunOnce(std::function< void()> action, Requirements requirements={})
Constructs a command that runs an action once and finishes.
Definition CommandNiDsStadiaController.hpp:15