SWARM-Bot Firmware
v1.0
Mobile robot OS - Embedded C/C++
|
General PID implementation for AVR. More...
#include <_pid_.h>
Go to the source code of this file.
Functions | |
void | pid_Init (int16_t p_factor, int16_t i_factor, int16_t d_factor, struct PID_DATA *pid) |
Initialisation of PID controller parameters. More... | |
int16_t | pid_Controller (int16_t setPoint, int16_t processValue, struct PID_DATA *pid_st) |
PID control algorithm. More... | |
void | pid_Reset_Integrator (pidData_t *pid_st) |
Resets the integrator. More... | |
General PID implementation for AVR.
Discrete PID controller implementation. Set up by giving P/I/D terms to Init_PID(), and uses a struct PID_DATA to store internal values.
$Name$
$RCSfile$
Definition in file _pid_.c.
int16_t pid_Controller | ( | int16_t | setPoint, |
int16_t | processValue, | ||
struct PID_DATA * | pid_st | ||
) |
PID control algorithm.
Calculates output from setpoint, process value and PID status.
setPoint | Desired value. |
processValue | Measured value. |
pid_st | PID status struct. |
References MAX_INT, PID_DATA::maxError, PID_DATA::maxSumError, PID_DATA::P_Factor, and PID_DATA::sumError.
Referenced by _update_controller().
void pid_Init | ( | int16_t | p_factor, |
int16_t | i_factor, | ||
int16_t | d_factor, | ||
struct PID_DATA * | pid | ||
) |
Initialisation of PID controller parameters.
Initialise the variables used by the PID algorithm.
p_factor | Proportional term. |
i_factor | Integral term. |
d_factor | Derivate term. |
pid | Struct with PID status. |
References PID_DATA::D_Factor, PID_DATA::I_Factor, PID_DATA::lastProcessValue, MAX_INT, PID_DATA::maxError, PID_DATA::maxSumError, PID_DATA::P_Factor, and PID_DATA::sumError.
Referenced by _init_dc_control().
void pid_Reset_Integrator | ( | pidData_t * | pid_st | ) |
Resets the integrator.
Calling this function will reset the integrator in the PID regulator.
References PID_DATA::sumError.