mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
C++ PIDCommand: Add GetMeasurement() and UseOutput() (#1892)
These are in the Java version but were missed in C++.
This commit is contained in:
@@ -31,10 +31,10 @@ PIDCommand::PIDCommand(PIDController controller,
|
||||
void PIDCommand::Initialize() { m_controller.Reset(); }
|
||||
|
||||
void PIDCommand::Execute() {
|
||||
m_useOutput(m_controller.Calculate(m_measurement(), m_setpoint()));
|
||||
UseOutput(m_controller.Calculate(GetMeasurement(), m_setpoint()));
|
||||
}
|
||||
|
||||
void PIDCommand::End(bool interrupted) { m_useOutput(0); }
|
||||
void PIDCommand::End(bool interrupted) { UseOutput(0); }
|
||||
|
||||
void PIDCommand::SetOutput(std::function<void(double)> useOutput) {
|
||||
m_useOutput = useOutput;
|
||||
@@ -52,4 +52,8 @@ void PIDCommand::SetSetpointRelative(double relativeSetpoint) {
|
||||
SetSetpoint(m_setpoint() + relativeSetpoint);
|
||||
}
|
||||
|
||||
double PIDCommand::GetMeasurement() { return m_measurement(); }
|
||||
|
||||
void PIDCommand::UseOutput(double output) { m_useOutput(output); }
|
||||
|
||||
PIDController& PIDCommand::getController() { return m_controller; }
|
||||
|
||||
Reference in New Issue
Block a user