WPILibC++ 2023.4.3-108-ge5452e3
Commands.h File Reference
#include <concepts>
#include <functional>
#include <initializer_list>
#include <memory>
#include <span>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "frc2/command/CommandPtr.h"
#include "frc2/command/SelectCommand.h"

Go to the source code of this file.

Namespaces

namespace  frc2
 
namespace  frc2::cmd
 Namespace for command factories.
 
namespace  frc2::cmd::impl
 

Functions

CommandPtr frc2::cmd::None ()
 Constructs a command that does nothing, finishing immediately. More...
 
CommandPtr frc2::cmd::RunOnce (std::function< void()> action, std::initializer_list< Subsystem * > requirements)
 Constructs a command that runs an action once and finishes. More...
 
CommandPtr frc2::cmd::RunOnce (std::function< void()> action, std::span< Subsystem *const > requirements={})
 Constructs a command that runs an action once and finishes. More...
 
CommandPtr frc2::cmd::Run (std::function< void()> action, std::initializer_list< Subsystem * > requirements)
 Constructs a command that runs an action every iteration until interrupted. More...
 
CommandPtr frc2::cmd::Run (std::function< void()> action, std::span< Subsystem *const > requirements={})
 Constructs a command that runs an action every iteration until interrupted. More...
 
CommandPtr frc2::cmd::StartEnd (std::function< void()> start, std::function< void()> end, std::initializer_list< Subsystem * > requirements)
 Constructs a command that runs an action once and another action when the command is interrupted. More...
 
CommandPtr frc2::cmd::StartEnd (std::function< void()> start, std::function< void()> end, std::span< Subsystem *const > requirements={})
 Constructs a command that runs an action once and another action when the command is interrupted. More...
 
CommandPtr frc2::cmd::RunEnd (std::function< void()> run, std::function< void()> end, std::initializer_list< Subsystem * > requirements)
 Constructs a command that runs an action every iteration until interrupted, and then runs a second action. More...
 
CommandPtr frc2::cmd::RunEnd (std::function< void()> run, std::function< void()> end, std::span< Subsystem *const > requirements={})
 Constructs a command that runs an action every iteration until interrupted, and then runs a second action. More...
 
CommandPtr frc2::cmd::Print (std::string_view msg)
 Constructs a command that prints a message and finishes. More...
 
CommandPtr frc2::cmd::Wait (units::second_t duration)
 Constructs a command that does nothing, finishing after a specified duration. More...
 
CommandPtr frc2::cmd::WaitUntil (std::function< bool()> condition)
 Constructs a command that does nothing, finishing once a condition becomes true. More...
 
CommandPtr frc2::cmd::Either (CommandPtr &&onTrue, CommandPtr &&onFalse, std::function< bool()> selector)
 Runs one of two commands, based on the boolean selector function. More...
 
template<typename Key , std::convertible_to< CommandPtr >... CommandPtrs>
CommandPtr frc2::cmd::Select (std::function< Key()> selector, std::pair< Key, CommandPtrs > &&... commands)
 Runs one of several commands, based on the selector function. More...
 
template<std::convertible_to< CommandPtr >... Args>
std::vector< CommandPtr > frc2::cmd::impl::MakeVector (Args &&... args)
 Create a vector of commands. More...
 
CommandPtr frc2::cmd::Sequence (std::vector< CommandPtr > &&commands)
 Runs a group of commands in series, one after the other. More...
 
template<std::convertible_to< CommandPtr >... CommandPtrs>
CommandPtr frc2::cmd::Sequence (CommandPtrs &&... commands)
 Runs a group of commands in series, one after the other. More...
 
CommandPtr frc2::cmd::RepeatingSequence (std::vector< CommandPtr > &&commands)
 Runs a group of commands in series, one after the other. More...
 
template<std::convertible_to< CommandPtr >... CommandPtrs>
CommandPtr frc2::cmd::RepeatingSequence (CommandPtrs &&... commands)
 Runs a group of commands in series, one after the other. More...
 
CommandPtr frc2::cmd::Parallel (std::vector< CommandPtr > &&commands)
 Runs a group of commands at the same time. More...
 
template<std::convertible_to< CommandPtr >... CommandPtrs>
CommandPtr frc2::cmd::Parallel (CommandPtrs &&... commands)
 Runs a group of commands at the same time. More...
 
CommandPtr frc2::cmd::Race (std::vector< CommandPtr > &&commands)
 Runs a group of commands at the same time. More...
 
template<std::convertible_to< CommandPtr >... CommandPtrs>
CommandPtr frc2::cmd::Race (CommandPtrs &&... commands)
 Runs a group of commands at the same time. More...
 
CommandPtr frc2::cmd::Deadline (CommandPtr &&deadline, std::vector< CommandPtr > &&others)
 Runs a group of commands at the same time. More...
 
template<std::convertible_to< CommandPtr >... CommandPtrs>
CommandPtr frc2::cmd::Deadline (CommandPtr &&deadline, CommandPtrs &&... commands)
 Runs a group of commands at the same time. More...