PID Control Class.
More...
#include <PID.h>
|
| PID (float kp_, float ki_, float kd_, float tau_, float lim_min_output_, float lim_max_output_, float lim_min_int_, float lim_max_int_, float update_period) |
| Construct a new PID object.
|
|
float ** | get_terms (void) |
| Get the PID terms.
|
|
void | update (float set_point, float measurement) |
| Updates the output of PID controller based on the real time measurement.
|
|
void | set_constants (float kp_, float ki_, float kd_) |
| Takes in the 3 parameters to set the PID coefficients values.
|
|
void | set_tau (float tau_) |
|
void | reset () |
| Reset the PID controller.
|
|
float | get_output (void) |
| Get the output of the PID controller.
|
|
float * | get_constants (void) |
|
PID Control Class.
Requires manual update of output using update() function
Assumes a constant period between updates, so a ticker that calls update() is recommended
Definition at line 20 of file PID.h.
◆ PID()
PID::PID |
( |
float | kp_, |
|
|
float | ki_, |
|
|
float | kd_, |
|
|
float | tau_, |
|
|
float | lim_min_output_, |
|
|
float | lim_max_output_, |
|
|
float | lim_min_int_, |
|
|
float | lim_max_int_, |
|
|
float | update_period ) |
Construct a new PID object.
- Parameters
-
kp_ | Propotional Term Gain Constant |
ki_ | Integral Term Gain Constant |
kd_ | Differentiator Term Gain Constant |
tau_ | Time Constant Tau |
lim_min_output_ | min output limit |
lim_max_output_ | max output limit |
lim_min_int_ | min integral term limit |
lim_max_int_ | max integral term limit |
update_period | update period (secs) |
Definition at line 5 of file PID.cpp.
◆ get_constants()
float * PID::get_constants |
( |
void | | ) |
|
◆ get_output()
float PID::get_output |
( |
void | | ) |
|
Get the output of the PID controller.
- Returns
- The output of the PID controller.
Definition at line 108 of file PID.cpp.
◆ get_terms()
float ** PID::get_terms |
( |
void | | ) |
|
Get the PID terms.
- Returns
- A pointer to an array of floats containing 8 PID terms in the order: 0. Time index,
- set point,
- sensor measured value,
- error,
- propotional term
- integral term
- differentiator term
- output of the PID
Definition at line 144 of file PID.cpp.
◆ reset()
Reset the PID controller.
This function resets the integral term and clears any internal state of the PID controller.
Definition at line 114 of file PID.cpp.
◆ set_constants()
void PID::set_constants |
( |
float | kp_, |
|
|
float | ki_, |
|
|
float | kd_ ) |
Takes in the 3 parameters to set the PID coefficients values.
- Parameters
-
kp_ | Propotional Term Gain Constant. |
ki_ | Integral Term Gain Constant. |
kd_ | Differentiator Term Gain Constant. |
Definition at line 132 of file PID.cpp.
◆ set_tau()
void PID::set_tau |
( |
float | tau_ | ) |
|
◆ update()
void PID::update |
( |
float | set_point, |
|
|
float | measurement ) |
Updates the output of PID controller based on the real time measurement.
- Parameters
-
set_point | The desired set point. |
measurement | The current measurement. |
Definition at line 57 of file PID.cpp.
The documentation for this class was generated from the following files: