wpi-32u4-library
|
A generic PID controller. More...
#include <PIDcontroller.h>
Public Member Functions | |
PIDController (float p, float i=0, float d=0, float bound=0) | |
Constructor defaults to proportional only. More... | |
float | calcEffort (float error) |
Used to calculate the effort from the error. More... | |
float | setKp (float k) |
float | setKi (float k) |
float | setKd (float k) |
float | setCap (float cap) |
void | resetSum (void) |
Protected Attributes | |
float | Kp |
float | Ki |
float | Kd |
float | currError = 0 |
float | prevError = 0 |
float | sumError = 0 |
float | errorBound = 0 |
float | deltaT = 0 |
float | currEffort = 0 |
A generic PID controller.
If errorBound is non-zero, the integral will be capped at that value.
Definition at line 9 of file PIDcontroller.h.
|
inline |
Constructor defaults to proportional only.
Definition at line 25 of file PIDcontroller.h.
float PIDController::calcEffort | ( | float | error | ) |
Used to calculate the effort from the error.
error | The current error (which is calculated in the calling code). |
Definition at line 8 of file PIDcontroller.cpp.
References currEffort, currError, errorBound, Kd, Ki, Kp, prevError, and sumError.
Referenced by Romi32U4Motor::update().
|
inline |
Definition at line 34 of file PIDcontroller.h.
References sumError.
Referenced by Romi32U4Motor::setTargetSpeed().
|
inline |
Definition at line 33 of file PIDcontroller.h.
References errorBound.
|
inline |
Definition at line 32 of file PIDcontroller.h.
References Kd.
|
inline |
Definition at line 31 of file PIDcontroller.h.
Referenced by Romi32U4Motor::setPIDCoeffients().
|
inline |
Definition at line 30 of file PIDcontroller.h.
References Kp.
Referenced by Romi32U4Motor::setPIDCoeffients().
|
protected |
Definition at line 21 of file PIDcontroller.h.
Referenced by calcEffort().
|
protected |
Definition at line 13 of file PIDcontroller.h.
Referenced by calcEffort().
|
protected |
Definition at line 19 of file PIDcontroller.h.
|
protected |
Definition at line 17 of file PIDcontroller.h.
Referenced by calcEffort(), and setCap().
|
protected |
Definition at line 12 of file PIDcontroller.h.
Referenced by calcEffort(), and setKd().
|
protected |
Definition at line 12 of file PIDcontroller.h.
Referenced by calcEffort(), and setKi().
|
protected |
Definition at line 12 of file PIDcontroller.h.
Referenced by calcEffort(), and setKp().
|
protected |
Definition at line 14 of file PIDcontroller.h.
Referenced by calcEffort().
|
protected |
Definition at line 16 of file PIDcontroller.h.
Referenced by calcEffort(), resetSum(), and setKi().