Proportionnal-integral-derivative regulator with integrator saturation capability.
More...
|
| void | pid_Init (pid_Pid *pid, float32_t kp, float32_t ki, float32_t kd, float32_t arw, float32_t feedforward) |
| | Initialize the PID structure. More...
|
| |
| float32_t | pid_Step (pid_Pid *pid, float32_t current, float32_t target, float32_t dt) |
| | Step the PID structure. More...
|
| |
Proportionnal-integral-derivative regulator with integrator saturation capability.
First, instantiate a pid_Pid structure (e.g. "pid_Pid pid;"), then initialize it once with pid_Init(). Then, every time a new command needs to be computed (typically when a new measurement arrives), call pid_Step().
◆ pid_Init()
| void pid_Init |
( |
pid_Pid * |
pid, |
|
|
float32_t |
kp, |
|
|
float32_t |
ki, |
|
|
float32_t |
kd, |
|
|
float32_t |
arw, |
|
|
float32_t |
feedforward |
|
) |
| |
Initialize the PID structure.
- Parameters
-
| pid | pointer to the PID structure. |
| kp | proportionnal coefficient of the PID. No effect if zero. |
| ki | integral coefficient of the PID. No effect if zero. |
| kd | derivative coefficient of the PID. No effect if zero. |
| arw | maximum value of the integrator (anti-reset windup). Disabled if negative. |
| feedforward | component proportional to the target (not the error). No effect if zero. |
◆ pid_Step()
| float32_t pid_Step |
( |
pid_Pid * |
pid, |
|
|
float32_t |
current, |
|
|
float32_t |
target, |
|
|
float32_t |
dt |
|
) |
| |
Step the PID structure.
- Parameters
-
| pid | pointer to the PID structure. |
| current | current state of the system to control. |
| target | target state of the system to control. |
| dt | timestep (time since the last call of this function) [s]. |
- Return values
-
| command | to apply to the system. |