63 float current_result, error = pid_handler->
expect - collect;
70 current_result = pid_handler->
kp * error + pid_handler->
ki * pid_handler->
summary
78 return current_result;
this is the header file of fast_math.c, the macros of fast amplitude limiting algorithm and cosine fu...
#define fast_constrain(x, low, high)
fast clipping algorithm
volatile unsigned char pid_control_mode_flag
flag variable of PID closed loop mode
unsigned char pid_parameter_available_flag
flag variable for PID parameter availability
void pid_config(unsigned char mode)
configure pid loop parameters
volatile PID_Structure_t angle_pid_handler
algorithm handler of PID angle loop
volatile PID_Structure_t speed_pid_handler
algorithm handler of PID speed loop
float pid_calculate_result(PID_Structure_t *pid_handler, float collect)
calculate result using sampling value
this is the header file of pid.c, which defines the structure of PID algorithm and closed-loop state ...
structure of PID algorithm
float ki
integral term coefficient in PID
float kp
proportional term coefficient in PID
float minimum
minimum output in PID
float maximum
maximum output in PID
float sum_maximum
maximum of anti saturation integral in PID
float last_error
error value of previous calculation in PID
float summary
value of integral term in PID
float expect
user expectations in PID
float kd
differential term coefficient in PID
void user_memset(void *buf, unsigned char data, unsigned char num)
format buffer array to fixed value, replace memset function
system basic function header file