feat: 增加速度环
This commit is contained in:
@@ -36,10 +36,11 @@ void PID_Init(PID_TypeDef *uPID)
|
||||
{
|
||||
uPID->OutputSum = uPID->OutMin;
|
||||
}
|
||||
|
||||
else { }
|
||||
|
||||
}
|
||||
void PID(PID_TypeDef *uPID, float *Input, float *Output, float *Setpoint, float Kp, float Ki, float Kd, PIDPON_TypeDef POn, PIDCD_TypeDef ControllerDirection)
|
||||
|
||||
void PID(PID_TypeDef *uPID, const float *Input, float *Output, const float *Setpoint, float Kp, float Ki, float Kd, PIDPON_TypeDef POn, PIDCD_TypeDef ControllerDirection)
|
||||
{
|
||||
/* ~~~~~~~~~~ Set parameter ~~~~~~~~~~ */
|
||||
uPID->MyOutput = Output;
|
||||
@@ -56,7 +57,7 @@ void PID(PID_TypeDef *uPID, float *Input, float *Output, float *Setpoint, float
|
||||
|
||||
}
|
||||
|
||||
void PID2(PID_TypeDef *uPID, float *Input, float *Output, float *Setpoint, float Kp, float Ki, float Kd, PIDCD_TypeDef ControllerDirection)
|
||||
void PID2(PID_TypeDef *uPID, const float *Input, float *Output, const float *Setpoint, float Kp, float Ki, float Kd, PIDCD_TypeDef ControllerDirection)
|
||||
{
|
||||
PID(uPID, Input, Output, Setpoint, Kp, Ki, Kd, _PID_P_ON_E, ControllerDirection);
|
||||
}
|
||||
@@ -65,10 +66,10 @@ void PID2(PID_TypeDef *uPID, float *Input, float *Output, float *Setpoint, float
|
||||
uint8_t PID_Compute(PID_TypeDef *uPID)
|
||||
{
|
||||
|
||||
float input=0;
|
||||
float error=0;
|
||||
float dInput=0;
|
||||
float output=0;
|
||||
float input;
|
||||
float error;
|
||||
float dInput;
|
||||
float output;
|
||||
|
||||
/* ~~~~~~~~~~ Check PID mode ~~~~~~~~~~ */
|
||||
if (!uPID->InAuto)
|
||||
|
||||
Reference in New Issue
Block a user