11 #include <initializer_list>
15 #include <frc/ErrorBase.h>
16 #include <units/units.h>
17 #include <wpi/ArrayRef.h>
18 #include <wpi/Demangle.h>
19 #include <wpi/SmallSet.h>
21 #include "frc2/command/Subsystem.h"
26 std::string GetTypeName(
const T& type) {
30 class ParallelCommandGroup;
31 class ParallelRaceGroup;
32 class ParallelDeadlineGroup;
33 class SequentialCommandGroup;
34 class PerpetualCommand;
35 class ProxyScheduleCommand;
80 virtual void End(
bool interrupted);
135 std::function<
void()> toRun,
136 std::initializer_list<Subsystem*> requirements) &&;
146 std::function<
void()> toRun,
156 SequentialCommandGroup
AndThen(
157 std::function<
void()> toRun,
158 std::initializer_list<Subsystem*> requirements) &&;
167 SequentialCommandGroup
AndThen(
168 std::function<
void()> toRun,
187 ProxyScheduleCommand
AsProxy();
250 virtual std::string GetName()
const;
259 bool m_isGrouped =
false;
269 bool RequirementsDisjoint(Command* first, Command* second);
A CommandGroup that runs a set of commands in parallel, ending when any one of the commands ends and ...
Definition: ParallelRaceGroup.h:30
virtual bool IsFinished()
Whether the command has finished.
Definition: Command.h:88
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:42
void Schedule()
Schedules this command, defaulting to interruptible.
Definition: Command.h:200
virtual void Execute()
The main body of a command.
virtual void End(bool interrupted)
The action to take when the command ends.
ParallelRaceGroup WithTimeout(units::second_t duration) &&
Decorates this command with a timeout.
std::string Demangle(const Twine &mangledSymbol)
Demangle a C++ symbol.
virtual std::unique_ptr< Command > TransferOwnership() &&=0
Transfers ownership of this command to a unique pointer.
void Cancel()
Cancels this command.
A state machine representing a complete action to be performed by the robot.
Definition: Command.h:52
ProxyScheduleCommand AsProxy()
Decorates this command to run "by proxy" by wrapping it in a {}.
virtual void Initialize()
The initial subroutine of a command.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:135
Base class for most objects.
Definition: ErrorBase.h:104
bool IsGrouped() const
Whether the command is currently grouped in a command group.
ParallelRaceGroup WithInterrupt(std::function< bool()> condition) &&
Decorates this command with an interrupt condition.
virtual bool RunsWhenDisabled() const
Whether the given command should run when the robot is disabled.
Definition: Command.h:248
void SetGrouped(bool grouped)
Sets whether the command is currently grouped in a command group.
bool HasRequirement(Subsystem *requirement) const
Whether the command requires a given subsystem.
PerpetualCommand Perpetually() &&
Decorates this command to run perpetually, ignoring its ordinary end conditions.
A CommandGroups that runs a list of commands in sequence.
Definition: SequentialCommandGroup.h:38
SequentialCommandGroup BeforeStarting(std::function< void()> toRun, std::initializer_list< Subsystem * > requirements) &&
Decorates this command with a runnable to run before this command starts.
bool IsScheduled() const
Whether or not the command is currently scheduled.
A robot subsystem.
Definition: Subsystem.h:39
virtual wpi::SmallSet< Subsystem *, 4 > GetRequirements() const =0
Specifies the set of subsystems used by this command.
SequentialCommandGroup AndThen(std::function< void()> toRun, std::initializer_list< Subsystem * > requirements) &&
Decorates this command with a runnable to run after the command finishes.