// 文件编码: GB18030 /* * pid.h * * Created on: 2025年3月25日 * Author: LHYe200 */ #ifndef CODE_PID_H_ #define CODE_PID_H_ typedef struct { float kp; float ki; float kd; float p_output; float i_output; float d_output; float output; float integral_max; float err; float err_last; float last_derivative; float integral; float output_max; float output_min; } PID; void PID_Init(PID *pid, float kp, float ki, float kd, float integral_max, float output_max, float output_min); void PID_Reset(PID *pid); float PID_Loc_Ctrl(PID * pid, float err); float PID_Inc_Ctrl(PID * pid, float err); float PID_ChangeIntegral_Inc_Ctrl(PID * pid, float err, float change_integral_b, float change_integral_k); float constrain_float(float amt, float low, float high); #endif /* CODE_PID_H_ */