Add dependency injection of Subsystem to Command (#1275)

This commit is contained in:
Matt Soucy
2018-08-19 22:43:21 -04:00
committed by Peter Johnson
parent 6df500e726
commit e28295fc7b
12 changed files with 291 additions and 2 deletions

View File

@@ -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;
/**