Dependents:
GPSNavigationNew
Fork of
PID
by Aaron Berk
« Back to documentation index
PID Class Reference
Proportional-integral-derivative controller.
More...
#include <PID.h >
Public Member Functions
PID (float Kc, float tauI, float tauD, float interval)
Constructor.
void setInputLimits (float inMin, float inMax)
Scale from inputs to 0-100%.
void setOutputLimits (float outMin, float outMax)
Scale from outputs to 0-100%.
void setTunings (float Kc, float tauI, float tauD)
Calculate PID constants.
void reset (void)
Reinitializes controller internals.
void setMode (int mode)
Set PID to manual or auto mode.
void setInterval (float interval)
Set how fast the PID loop is run.
void setSetPoint (float sp)
Set the set point.
void setProcessValue (float pv)
Set the process value.
void setBias (float bias)
Set the bias.
float compute (void)
PID calculation.
Detailed Description
Proportional-integral-derivative controller.
Definition at line 64 of file PID.h .
Constructor & Destructor Documentation
PID
(
float
Kc ,
float
tauI ,
float
tauD ,
float
interval
)
Constructor.
Sets default limits [0-3.3V], calculates tuning parameters, and sets manual mode with no bias.
Parameters:
Kc - Tuning parameter
tauI - Tuning parameter
tauD - Tuning parameter
interval PID calculation performed every interval seconds.
Definition at line 11 of file PID.cpp .
Member Function Documentation
PID calculation.
Returns: The controller output as a float between outMin and outMax.
Definition at line 139 of file PID.cpp .
Reinitializes controller internals.
Automatically called on a manual to auto transition.
Definition at line 87 of file PID.cpp .
void setBias
(
float
bias )
Set the bias.
Parameters:
bias The bias for the controller output.
Definition at line 132 of file PID.cpp .
void setInputLimits
(
float
inMin ,
float
inMax
)
Scale from inputs to 0-100%.
Parameters:
InMin The real world value corresponding to 0%.
InMax The real world value corresponding to 100%.
Definition at line 40 of file PID.cpp .
void setInterval
(
float
interval )
Set how fast the PID loop is run.
Parameters:
interval PID calculation peformed every interval seconds.
Definition at line 108 of file PID.cpp .
void setMode
(
int
mode )
Set PID to manual or auto mode.
Parameters:
mode 0 -> Manual Non-zero -> Auto
Definition at line 96 of file PID.cpp .
void setOutputLimits
(
float
outMin ,
float
outMax
)
Scale from outputs to 0-100%.
Parameters:
outMin The real world value corresponding to 0%.
outMax The real world value corresponding to 100%.
Definition at line 48 of file PID.cpp .
void setProcessValue
(
float
pv )
Set the process value.
Parameters:
pv The process value as a real world value.
Definition at line 126 of file PID.cpp .
void setSetPoint
(
float
sp )
Set the set point.
Parameters:
sp The set point as a real world value.
Definition at line 120 of file PID.cpp .
void setTunings
(
float
Kc ,
float
tauI ,
float
tauD
)
Calculate PID constants.
Allows parameters to be changed on the fly without ruining calculations.
Parameters:
Kc - Tuning parameter
tauI - Tuning parameter
tauD - Tuning parameter
Definition at line 57 of file PID.cpp .