EEEN21000
GROUP 30 Line Following Buggy
|
Proportional-integral-derivative controller. More...
#include <PID.h>
Public Member Functions | |
PID (float Kc, float tauI, float tauD, float interval) | |
Contructor. More... | |
void | setInputLimits (float inMin, float inMax) |
Scale from inputs to 0-100%. More... | |
void | setOutputLimits (float outMin, float outMax) |
Scale from outputs to 0-100%. More... | |
void | setTunings (float Kc, float tauI, float tauD) |
Calculate PID constants. More... | |
void | reset () |
Reset previous values of output and error. More... | |
void | setSetPoint (float sp) |
Set the set point. More... | |
float | getSetPoint () |
Get the setpoint. More... | |
void | setProcessValue (float pv) |
Set the process value. More... | |
void | setBias (float bias) |
Set the bias. More... | |
float | compute (void) |
PID calculation. More... | |
Protected Attributes | |
bool | _usingFeedForward |
float | _Kc |
float | _tauR |
float | _tauD |
float | _pParam |
float | _iParam |
float | _dParam |
float | _setPoint |
float | _processVariable |
float | _prevProcessVariable |
float | _prevError |
float | _controllerOutput |
float | _prevControllerOutput |
float | _inMin |
float | _inMax |
float | _inSpan |
float | _outMin |
float | _outMax |
float | _outSpan |
float | _accError |
float | _bias |
float | _a |
float | _tSample |
Proportional-integral-derivative controller.
PID::PID | ( | float | Kc, |
float | tauI, | ||
float | tauD, | ||
float | interval | ||
) |
Contructor.
Sets default limits [0-3.3V], calculates tuning parameters, and sets manual mode with no bias.
Kc | - Proportional gain |
tauI | - Integral gain |
tauD | - Derivative gain |
interval | - PID calculation performed every interval seconds. |
void PID::setInputLimits | ( | float | inMin, |
float | inMax | ||
) |
Scale from inputs to 0-100%.
inMin | - The real world value corresponding to 0% |
inMax | - The real world value corresponding to 100% |
void PID::setOutputLimits | ( | float | outMin, |
float | outMax | ||
) |
Scale from outputs to 0-100%.
outMin | - The real world value corresponding to 0% |
outMax | - The real world value corresponding to 100% |
void PID::setTunings | ( | float | Kc, |
float | tauI, | ||
float | tauD | ||
) |
Calculate PID constants.
Allows parameters to be changed on the fly without ruining calculations.
Kc | - Proportional gain |
tauI | - Integral gain |
tauD | - Derivative gain |
void PID::reset | ( | ) |
Reset previous values of output and error.
void PID::setSetPoint | ( | float | sp | ) |
Set the set point.
sp | The set point as a real world value. |
float PID::getSetPoint | ( | ) |
Get the setpoint.
void PID::setProcessValue | ( | float | pv | ) |
Set the process value.
pv | The process value as a real world value. |
void PID::setBias | ( | float | bias | ) |
Set the bias.
bias | The bias for the controller output. |
float PID::compute | ( | void | ) |
PID calculation.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |