RIT VEXU Core API
|
#include <pid.h>
Public Member Functions | |
void | set_pid (double kP, double kI, double kD) |
void | set_p (double kP) |
void | set_i (double kI) |
void | set_d (double kD) |
void | set_tolerance (double tolerance) |
void | set_i_zone (double i_zone) |
double | p () const |
double | i () const |
double | d () const |
double | tolerance () const |
double | i_zone () const |
void | set_i_limits (double i_min, double i_max) |
void | set_output_limits (double minimum_output, double maximum_output) |
double | dt () const |
void | set_dt (double dt) |
void | set_setpoint (double setpoint) |
double | setpoint () const |
bool | is_continuous () const |
void | enable_continuous (double minimum_input=-1, double maximum_input=1) |
void | disable_continuous () |
bool | at_setpoint () const |
double | calculate (double measurement) |
double | calculate (double setpoint, double measurement) |
void | reset () |
void | reset_i () |
Implements a PID controller with some additional features.
This class allows for setting PID gains, tolerance, integral zone, integral limits, output limits, and continuous mode for angle wrapping.
The PID formula is: output = kP * error + kI * integral(error) + kD * derivative(error)
|
inline |
Checks if the measured value is at the setpoint within the tolerance.
|
inline |
|
inline |
|
inline |
Returns the derivative gain.
|
inline |
Disables continuous mode.
|
inline |
Returns the time period in seconds.
|
inline |
Enables continuous mode and sets the input range. This wraps the inputs, mostly useful for angles.
minimum_input | The minimum input value (default -1). |
maximum_input | The maximum input value (default 1). |
|
inline |
Returns the integral gain.
|
inline |
Returns the integral zone.
|
inline |
Checks if the PID controller is in continuous mode.
|
inline |
Returns the proportional gain.
|
inline |
Resets the PID controller.
|
inline |
Resets the integral term only.
|
inline |
Sets the Derivative gain.
kD | The derivative gain. |
|
inline |
Sets the update time period in seconds.
dt | The time period in seconds. |
|
inline |
Sets the Integral gain.
kI | The integral gain. |
|
inline |
Sets limits on the effect of the integral term.
i_min | The minimum value for the integral term. |
i_max | The maximum value for the integral term. |
|
inline |
Sets the integral zone. If the absolute error is less than this value, the integral term will accumulate. If the absolute error is greater than this value, the accumulated error will be reset to zero.
i_zone | The integral zone value. |
|
inline |
Sets the output limits, usually -12V to 12V for a motor.
minimum_output | The minimum output value. |
maximum_output | The maximum output value. |
|
inline |
Sets the Proportional gain.
kP | The proportional gain. |
|
inline |
Sets the PID gains.
kP | The proportional gain. |
kI | The integral gain. |
kD | The derivative gain. |
|
inline |
Sets the setpoint.
setpoint | The setpoint value. |
|
inline |
Sets the tolerance for whether the setpoint is reached.
tolerance | The tolerance value. If absolute error < tol then it's at the setpoint. |
|
inline |
Returns the current setpoint.
|
inline |
Returns the tolerance.