mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
committed by
Peter Johnson
parent
c8482cd6d2
commit
0b113ad9ce
@@ -27,8 +27,8 @@ Command::Command(const wpi::Twine& name) : Command(name, -1.0) {}
|
||||
|
||||
Command::Command(double timeout) : Command("", timeout) {}
|
||||
|
||||
Command::Command(Subsystem& requirement) : Command("", -1.0) {
|
||||
Requires(&requirement);
|
||||
Command::Command(Subsystem& subsystem) : Command("", -1.0) {
|
||||
Requires(&subsystem);
|
||||
}
|
||||
|
||||
Command::Command(const wpi::Twine& name, double timeout) : SendableBase(false) {
|
||||
@@ -47,19 +47,18 @@ Command::Command(const wpi::Twine& name, double timeout) : SendableBase(false) {
|
||||
}
|
||||
}
|
||||
|
||||
Command::Command(const wpi::Twine& name, Subsystem& requirement)
|
||||
Command::Command(const wpi::Twine& name, Subsystem& subsystem)
|
||||
: Command(name, -1.0) {
|
||||
Requires(&requirement);
|
||||
Requires(&subsystem);
|
||||
}
|
||||
|
||||
Command::Command(double timeout, Subsystem& requirement)
|
||||
: Command("", timeout) {
|
||||
Requires(&requirement);
|
||||
Command::Command(double timeout, Subsystem& subsystem) : Command("", timeout) {
|
||||
Requires(&subsystem);
|
||||
}
|
||||
|
||||
Command::Command(const wpi::Twine& name, double timeout, Subsystem& requirement)
|
||||
Command::Command(const wpi::Twine& name, double timeout, Subsystem& subsystem)
|
||||
: Command(name, timeout) {
|
||||
Requires(&requirement);
|
||||
Requires(&subsystem);
|
||||
}
|
||||
|
||||
double Command::TimeSinceInitialized() const {
|
||||
|
||||
@@ -11,6 +11,8 @@ using namespace frc;
|
||||
|
||||
InstantCommand::InstantCommand(const wpi::Twine& name) : Command(name) {}
|
||||
|
||||
InstantCommand::InstantCommand(Subsystem& subsystem) : Command(subsystem) {}
|
||||
|
||||
InstantCommand::InstantCommand(const wpi::Twine& name, Subsystem& subsystem)
|
||||
: Command(name, subsystem) {}
|
||||
|
||||
|
||||
@@ -42,35 +42,36 @@ PIDCommand::PIDCommand(double p, double i, double d, double period) {
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
double f, double period, Subsystem& requirement)
|
||||
: Command(name, requirement) {
|
||||
double f, double period, Subsystem& subsystem)
|
||||
: Command(name, subsystem) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(double p, double i, double d, double f, double period,
|
||||
Subsystem& requirement) {
|
||||
Subsystem& subsystem)
|
||||
: Command(subsystem) {
|
||||
m_controller =
|
||||
std::make_shared<PIDController>(p, i, d, f, this, this, period);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
Subsystem& requirement)
|
||||
: Command(name) {
|
||||
Subsystem& subsystem)
|
||||
: Command(name, subsystem) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(const wpi::Twine& name, double p, double i, double d,
|
||||
double period, Subsystem& requirement)
|
||||
: Command(name) {
|
||||
double period, Subsystem& subsystem)
|
||||
: Command(name, subsystem) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(double p, double i, double d, Subsystem& requirement) {
|
||||
PIDCommand::PIDCommand(double p, double i, double d, Subsystem& subsystem) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this);
|
||||
}
|
||||
|
||||
PIDCommand::PIDCommand(double p, double i, double d, double period,
|
||||
Subsystem& requirement) {
|
||||
Subsystem& subsystem) {
|
||||
m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ TimedCommand::TimedCommand(const wpi::Twine& name, double timeout)
|
||||
TimedCommand::TimedCommand(double timeout) : Command(timeout) {}
|
||||
|
||||
TimedCommand::TimedCommand(const wpi::Twine& name, double timeout,
|
||||
Subsystem& requirement)
|
||||
: Command(name, timeout, requirement) {}
|
||||
Subsystem& subsystem)
|
||||
: Command(name, timeout, subsystem) {}
|
||||
|
||||
TimedCommand::TimedCommand(double timeout, Subsystem& requirement)
|
||||
: Command(timeout, requirement) {}
|
||||
TimedCommand::TimedCommand(double timeout, Subsystem& subsystem)
|
||||
: Command(timeout, subsystem) {}
|
||||
|
||||
bool TimedCommand::IsFinished() { return IsTimedOut(); }
|
||||
|
||||
Reference in New Issue
Block a user