mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpimath] PIDController: Update field and method names for error and errorDerivative (#7088)
This commit is contained in:
committed by
GitHub
parent
64e5e6db59
commit
6281ec0810
@@ -121,18 +121,36 @@ class WPILIB_DLLEXPORT PIDController
|
||||
*/
|
||||
units::second_t GetPeriod() const;
|
||||
|
||||
/**
|
||||
* Gets the error tolerance of this controller.
|
||||
*
|
||||
* @return The error tolerance of the controller.
|
||||
*/
|
||||
double GetErrorTolerance() const;
|
||||
|
||||
/**
|
||||
* Gets the error derivative tolerance of this controller.
|
||||
*
|
||||
* @return The error derivative tolerance of the controller.
|
||||
*/
|
||||
double GetErrorDerivativeTolerance() const;
|
||||
|
||||
/**
|
||||
* Gets the position tolerance of this controller.
|
||||
*
|
||||
* @return The position tolerance of the controller.
|
||||
* @deprecated Use GetErrorTolerance() instead.
|
||||
*/
|
||||
[[deprecated("Use the GetErrorTolerance method instead.")]]
|
||||
double GetPositionTolerance() const;
|
||||
|
||||
/**
|
||||
* Gets the velocity tolerance of this controller.
|
||||
*
|
||||
* @return The velocity tolerance of the controller.
|
||||
* @deprecated Use GetErrorDerivativeTolerance() instead.
|
||||
*/
|
||||
[[deprecated("Use the GetErrorDerivativeTolerance method instead.")]]
|
||||
double GetVelocityTolerance() const;
|
||||
|
||||
/**
|
||||
@@ -201,21 +219,35 @@ class WPILIB_DLLEXPORT PIDController
|
||||
/**
|
||||
* Sets the error which is considered tolerable for use with AtSetpoint().
|
||||
*
|
||||
* @param positionTolerance Position error which is tolerable.
|
||||
* @param velocityTolerance Velocity error which is tolerable.
|
||||
* @param errorTolerance error which is tolerable.
|
||||
* @param errorDerivativeTolerance error derivative which is tolerable.
|
||||
*/
|
||||
void SetTolerance(
|
||||
double positionTolerance,
|
||||
double velocityTolerance = std::numeric_limits<double>::infinity());
|
||||
void SetTolerance(double errorTolerance,
|
||||
double errorDerivativeTolerance =
|
||||
std::numeric_limits<double>::infinity());
|
||||
|
||||
/**
|
||||
* Returns the difference between the setpoint and the measurement.
|
||||
*/
|
||||
double GetError() const;
|
||||
|
||||
/**
|
||||
* Returns the error derivative.
|
||||
*/
|
||||
double GetErrorDerivative() const;
|
||||
|
||||
/**
|
||||
* Returns the difference between the setpoint and the measurement.
|
||||
* @deprecated Use GetError() instead.
|
||||
*/
|
||||
[[deprecated("Use GetError method instead.")]]
|
||||
double GetPositionError() const;
|
||||
|
||||
/**
|
||||
* Returns the velocity error.
|
||||
* @deprecated Use GetErrorDerivative() instead.
|
||||
*/
|
||||
[[deprecated("Use GetErrorDerivative method instead.")]]
|
||||
double GetVelocityError() const;
|
||||
|
||||
/**
|
||||
@@ -268,8 +300,8 @@ class WPILIB_DLLEXPORT PIDController
|
||||
bool m_continuous = false;
|
||||
|
||||
// The error at the time of the most recent call to Calculate()
|
||||
double m_positionError = 0;
|
||||
double m_velocityError = 0;
|
||||
double m_error = 0;
|
||||
double m_errorDerivative = 0;
|
||||
|
||||
// The error at the time of the second-most-recent call to Calculate() (used
|
||||
// to compute velocity)
|
||||
@@ -279,8 +311,8 @@ class WPILIB_DLLEXPORT PIDController
|
||||
double m_totalError = 0;
|
||||
|
||||
// The error that is considered at setpoint.
|
||||
double m_positionTolerance = 0.05;
|
||||
double m_velocityTolerance = std::numeric_limits<double>::infinity();
|
||||
double m_errorTolerance = 0.05;
|
||||
double m_errorDerivativeTolerance = std::numeric_limits<double>::infinity();
|
||||
|
||||
double m_setpoint = 0;
|
||||
double m_measurement = 0;
|
||||
|
||||
@@ -162,7 +162,7 @@ class ProfiledPIDController
|
||||
* @return The position tolerance of the controller.
|
||||
*/
|
||||
double GetPositionTolerance() const {
|
||||
return m_controller.GetPositionTolerance();
|
||||
return m_controller.GetErrorTolerance();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,7 @@ class ProfiledPIDController
|
||||
* @return The velocity tolerance of the controller.
|
||||
*/
|
||||
double GetVelocityTolerance() const {
|
||||
return m_controller.GetVelocityTolerance();
|
||||
return m_controller.GetErrorDerivativeTolerance();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,14 +300,14 @@ class ProfiledPIDController
|
||||
* @return The error.
|
||||
*/
|
||||
Distance_t GetPositionError() const {
|
||||
return Distance_t{m_controller.GetPositionError()};
|
||||
return Distance_t{m_controller.GetError()};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the change in error per second.
|
||||
*/
|
||||
Velocity_t GetVelocityError() const {
|
||||
return Velocity_t{m_controller.GetVelocityError()};
|
||||
return Velocity_t{m_controller.GetErrorDerivative()};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user