mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Add dependency injection of Subsystem to Command (#1275)
This commit is contained in:
committed by
Peter Johnson
parent
6df500e726
commit
e28295fc7b
@@ -72,6 +72,13 @@ class Command : public ErrorBase, public SendableBase {
|
||||
*/
|
||||
explicit Command(double timeout);
|
||||
|
||||
/**
|
||||
* Creates a new command with the given timeout and a default name.
|
||||
*
|
||||
* @param requirement the subsystem that the command requires
|
||||
*/
|
||||
explicit Command(Subsystem& requirement);
|
||||
|
||||
/**
|
||||
* Creates a new command with the given name and timeout.
|
||||
*
|
||||
@@ -81,6 +88,33 @@ class Command : public ErrorBase, public SendableBase {
|
||||
*/
|
||||
Command(const wpi::Twine& name, double timeout);
|
||||
|
||||
/**
|
||||
* Creates a new command with the given name and timeout.
|
||||
*
|
||||
* @param name the name of the command
|
||||
* @param requirement the subsystem that the command requires
|
||||
*/
|
||||
Command(const wpi::Twine& name, Subsystem& requirement);
|
||||
|
||||
/**
|
||||
* Creates a new command with the given name and timeout.
|
||||
*
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
* @param requirement the subsystem that the command requires
|
||||
* @see IsTimedOut()
|
||||
*/
|
||||
Command(double timeout, Subsystem& requirement);
|
||||
|
||||
/**
|
||||
* Creates a new command with the given name and timeout.
|
||||
*
|
||||
* @param name the name of the command
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
* @param requirement the subsystem that the command requires
|
||||
* @see IsTimedOut()
|
||||
*/
|
||||
Command(const wpi::Twine& name, double timeout, Subsystem& requirement);
|
||||
|
||||
~Command() override = default;
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,14 @@ class InstantCommand : public Command {
|
||||
*/
|
||||
explicit InstantCommand(const wpi::Twine& name);
|
||||
|
||||
/**
|
||||
* Creates a new InstantCommand with the given name.
|
||||
*
|
||||
* @param name The name for this command
|
||||
* @param requirement The subsystem that the command requires
|
||||
*/
|
||||
InstantCommand(const wpi::Twine& name, Subsystem& requirement);
|
||||
|
||||
InstantCommand() = default;
|
||||
virtual ~InstantCommand() = default;
|
||||
|
||||
|
||||
@@ -28,6 +28,17 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
|
||||
PIDCommand(double p, double i, double d);
|
||||
PIDCommand(double p, double i, double d, double period);
|
||||
PIDCommand(double p, double i, double d, double f, double period);
|
||||
PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
Subsystem& requirement);
|
||||
PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
double period, Subsystem& requirement);
|
||||
PIDCommand(const wpi::Twine& name, double p, double i, double d, double f,
|
||||
double period, Subsystem& requirement);
|
||||
PIDCommand(double p, double i, double d, Subsystem& requirement);
|
||||
PIDCommand(double p, double i, double d, double period,
|
||||
Subsystem& requirement);
|
||||
PIDCommand(double p, double i, double d, double f, double period,
|
||||
Subsystem& requirement);
|
||||
virtual ~PIDCommand() = default;
|
||||
|
||||
void SetSetpointRelative(double deltaSetpoint);
|
||||
|
||||
@@ -35,6 +35,23 @@ class TimedCommand : public Command {
|
||||
*/
|
||||
explicit TimedCommand(double timeout);
|
||||
|
||||
/**
|
||||
* Creates a new TimedCommand with the given name and timeout.
|
||||
*
|
||||
* @param name the name of the command
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
* @param requirement the subsystem that the command requires
|
||||
*/
|
||||
TimedCommand(const wpi::Twine& name, double timeout, Subsystem& requirement);
|
||||
|
||||
/**
|
||||
* Creates a new WaitCommand with the given timeout.
|
||||
*
|
||||
* @param timeout the time (in seconds) before this command "times out"
|
||||
* @param requirement the subsystem that the command requires
|
||||
*/
|
||||
TimedCommand(double timeout, Subsystem& requirement);
|
||||
|
||||
virtual ~TimedCommand() = default;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user