SWARM-Bot Firmware
v1.0
Mobile robot OS - Embedded C/C++
|
Header file for pid.c. More...
#include "stdint.h"
Go to the source code of this file.
Classes | |
struct | PID_DATA |
PID Status. More... | |
Macros | |
#define | SCALING_FACTOR 128 |
#define | MAX_INT INT16_MAX |
Maximum values. More... | |
#define | MAX_LONG INT32_MAX |
#define | MAX_I_TERM (MAX_LONG / 2) |
#define | FALSE 0 |
#define | TRUE 1 |
Typedefs | |
typedef struct PID_DATA | pidData_t |
PID Status. More... | |
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... | |
Variables | |
volatile uint8_t | flag |
Header file for pid.c.
$RCSfile$
Definition in file _pid_.h.
#define MAX_INT INT16_MAX |
Maximum values.
Needed to avoid sign/overflow problems
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.