初始化仓库

This commit is contained in:
2025-10-15 00:22:56 +08:00
commit a6ddc01c98
650 changed files with 438085 additions and 0 deletions

42
code/pid.h Normal file
View File

@@ -0,0 +1,42 @@
// <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>: GB18030
/*
* pid.h
*
* Created on: 2025<32><35>3<EFBFBD><33>25<32><35>
* 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_ */