|
Valkyrie 2026
|
#include <valkyrie/controllers/PIDController.h>
Public Types | |
| using | ErrorDerivative = units::unit_t<units::compound_unit<INPUT, units::inverse<units::second>>> |
Public Member Functions | |
| constexpr | PIDController (const PIDF< INPUT, OUTPUT > &pidf, units::second_t period=Robot::kDefaultPeriod) |
| constexpr void | SetPID (const PIDF< INPUT, OUTPUT > &pidf) |
| constexpr void | SetP (PIDF< INPUT, OUTPUT >::ProportionalGain_t Kp) |
| constexpr void | SetI (PIDF< INPUT, OUTPUT >::IntegralGain_t Ki) |
| constexpr void | SetD (PIDF< INPUT, OUTPUT >::DerivativeGain_t Kd) |
| constexpr void | SetIZone (PIDF< INPUT, OUTPUT >::Output_t iZone) |
| constexpr PIDF< INPUT, OUTPUT >::ProportionalGain_t | GetP () const |
| constexpr PIDF< INPUT, OUTPUT >::IntegralGain_t | GetI () const |
| constexpr PIDF< INPUT, OUTPUT >::DerivativeGain_t | GetD () const |
| constexpr PIDF< INPUT, OUTPUT >::Output_t | GetIZone () const |
| constexpr PIDF< INPUT, OUTPUT >::Input_t | GetErrorTolerance () const |
| constexpr ErrorDerivative | GetErrorDerivativeTolerance () const |
| constexpr PIDF< INPUT, OUTPUT >::Input_t | GetAccumulatedError () const |
| constexpr void | SetSetpoint (PIDF< INPUT, OUTPUT >::Input_t setpoint) |
| constexpr PIDF< INPUT, OUTPUT >::Input_t | GetSetpoint () const |
| constexpr void | EnableContinuousInput (PIDF< INPUT, OUTPUT >::Input_t minimumInput, PIDF< INPUT, OUTPUT >::Input_t maximumInput) |
| constexpr void | SetIntegratorRange (PIDF< INPUT, OUTPUT >::Output_t minimumIntegral, PIDF< INPUT, OUTPUT >::Output_t maximumIntegral) |
| constexpr void | SetTolerance (PIDF< INPUT, OUTPUT >::Input_t errorTolerance, ErrorDerivative errorDerivativeTolerance=ErrorDerivative{std::numeric_limits< double >::infinity()}) |
| constexpr PIDF< INPUT, OUTPUT >::Input_t | GetError () const |
| constexpr ErrorDerivative | GetErrorDerivative () const |
| constexpr const valor::PIDF< INPUT, OUTPUT > & | GetPID () const |
| constexpr PIDF< INPUT, OUTPUT >::Output_t | Calculate (PIDF< INPUT, OUTPUT >::Input_t measurement) |
| constexpr PIDF< INPUT, OUTPUT >::Output_t | Calculate (PIDF< INPUT, OUTPUT >::Input_t measurement, PIDF< INPUT, OUTPUT >::Input_t setpoint) |
Implements a PID control loop.
|
inlineconstexpr |
Allocates a PIDController with the given constants.
| pidf | The PIDF structure defining feedforward and gains. |
| period | The period between controller updates in seconds. The default is 20 milliseconds. Must be positive. |
|
inlineconstexpr |
Returns the next output of the PID controller.
| measurement | The current measurement of the process variable. |
|
inlineconstexpr |
Returns the next output of the PID controller.
| measurement | The current measurement of the process variable. |
| setpoint | The new setpoint of the controller. |
|
inlineconstexpr |
Enables continuous input.
Rather then using the max and min input range as constraints, it considers them to be the same point and automatically calculates the shortest route to the setpoint.
| minimumInput | The minimum value expected from the input. |
| maximumInput | The maximum value expected from the input. |
|
inlineconstexpr |
Gets the accumulated error used in the integral calculation of this controller.
|
inlineconstexpr |
Gets the differential coefficient.
|
inlineconstexpr |
Returns the difference between the setpoint and the measurement.
|
inlineconstexpr |
Returns the error derivative.
|
inlineconstexpr |
Gets the error derivative tolerance of this controller. Defaults to ∞.
|
inlineconstexpr |
Gets the error tolerance of this controller. Defaults to 0.05.
|
inlineconstexpr |
Gets the integral coefficient.
|
inlineconstexpr |
Get the IZone range.
|
inlineconstexpr |
Gets the proportional coefficient.
|
inlineconstexpr |
Gets the PID gains
|
inlineconstexpr |
Returns the current setpoint of the PIDController.
|
inlineconstexpr |
Sets the differential coefficient of the PID controller gain.
| Kd | The differential coefficient. Must be >= 0. |
|
inlineconstexpr |
Sets the integral coefficient of the PID controller gain.
| Ki | The integral coefficient. Must be >= 0. |
|
inlineconstexpr |
Sets the minimum and maximum contributions of the integral term.
The internal integrator is clamped so that the integral term's contribution to the output stays between minimumIntegral and maximumIntegral. This prevents integral windup.
| minimumIntegral | The minimum contribution of the integral term. |
| maximumIntegral | The maximum contribution of the integral term. |
|
inlineconstexpr |
Sets the IZone range. When the absolute value of the position error is greater than IZone, the total accumulated error will reset to zero, disabling integral gain until the absolute value of the position error is less than IZone. This is used to prevent integral windup. Must be non-negative. Passing a value of zero will effectively disable integral gain. Passing a value of infinity disables IZone functionality.
| iZone | Maximum magnitude of error to allow integral control. Must be >= 0. |
|
inlineconstexpr |
Sets the proportional coefficient of the PID controller gain.
| Kp | The proportional coefficient. Must be >= 0. |
|
inlineconstexpr |
Sets the PID Controller gain parameters.
| pidf | The PIDF structure defining feedforward and gains. |
|
inlineconstexpr |
Sets the setpoint for the PIDController.
| setpoint | The desired setpoint. |
|
inlineconstexpr |
Sets the error which is considered tolerable for use with AtSetpoint().
| errorTolerance | error which is tolerable. |
| errorDerivativeTolerance | error derivative which is tolerable. |