Fix some PIDCommand constructors not forwarding subsystems (#1299)

Also added missing constructor to wpilibc's InstantCommand and renamed
argument from requirement to subsystem as per
https://github.com/wpilibsuite/allwpilib/pull/1275#issuecomment-416071940.
This commit is contained in:
Tyler Veness
2018-09-02 14:18:12 -07:00
committed by Peter Johnson
parent c8482cd6d2
commit 0b113ad9ce
12 changed files with 119 additions and 113 deletions

View File

@@ -75,9 +75,9 @@ class Command : public ErrorBase, public SendableBase {
/**
* Creates a new command with the given timeout and a default name.
*
* @param requirement the subsystem that the command requires
* @param subsystem the subsystem that the command requires
*/
explicit Command(Subsystem& requirement);
explicit Command(Subsystem& subsystem);
/**
* Creates a new command with the given name and timeout.
@@ -91,29 +91,27 @@ class Command : public ErrorBase, public SendableBase {
/**
* 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
* @param name the name of the command
* @param subsystem the subsystem that the command requires
*/
Command(const wpi::Twine& name, Subsystem& requirement);
Command(const wpi::Twine& name, Subsystem& subsystem);
/**
* 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()
* @param timeout the time (in seconds) before this command "times out"
* @param subsystem the subsystem that the command requires @see IsTimedOut()
*/
Command(double timeout, Subsystem& requirement);
Command(double timeout, Subsystem& subsystem);
/**
* 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()
* @param name the name of the command
* @param timeout the time (in seconds) before this command "times out"
* @param subsystem the subsystem that the command requires @see IsTimedOut()
*/
Command(const wpi::Twine& name, double timeout, Subsystem& requirement);
Command(const wpi::Twine& name, double timeout, Subsystem& subsystem);
~Command() override = default;

View File

@@ -27,13 +27,20 @@ class InstantCommand : public Command {
*/
explicit InstantCommand(const wpi::Twine& name);
/**
* Creates a new InstantCommand with the given requirement.
*
* @param subsystem The subsystem that the command requires
*/
explicit InstantCommand(Subsystem& subsystem);
/**
* Creates a new InstantCommand with the given name.
*
* @param name The name for this command
* @param requirement The subsystem that the command requires
* @param name The name for this command
* @param subsystem The subsystem that the command requires
*/
InstantCommand(const wpi::Twine& name, Subsystem& requirement);
InstantCommand(const wpi::Twine& name, Subsystem& subsystem);
InstantCommand() = default;
virtual ~InstantCommand() = default;

View File

@@ -29,16 +29,15 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
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);
Subsystem& subsystem);
PIDCommand(const wpi::Twine& name, double p, double i, double d,
double period, Subsystem& requirement);
double period, Subsystem& subsystem);
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);
double period, Subsystem& subsystem);
PIDCommand(double p, double i, double d, Subsystem& subsystem);
PIDCommand(double p, double i, double d, double period, Subsystem& subsystem);
PIDCommand(double p, double i, double d, double f, double period,
Subsystem& requirement);
Subsystem& subsystem);
virtual ~PIDCommand() = default;
void SetSetpointRelative(double deltaSetpoint);

View File

@@ -38,19 +38,19 @@ class TimedCommand : public Command {
/**
* 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
* @param name the name of the command
* @param timeout the time (in seconds) before this command "times out"
* @param subsystem the subsystem that the command requires
*/
TimedCommand(const wpi::Twine& name, double timeout, Subsystem& requirement);
TimedCommand(const wpi::Twine& name, double timeout, Subsystem& subsystem);
/**
* 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
* @param timeout the time (in seconds) before this command "times out"
* @param subsystem the subsystem that the command requires
*/
TimedCommand(double timeout, Subsystem& requirement);
TimedCommand(double timeout, Subsystem& subsystem);
virtual ~TimedCommand() = default;