Pid Controller: Set integral term lower boundary to 0
This commit is contained in:
parent
60104df30e
commit
e815442617
@ -65,8 +65,8 @@ static void calculate_integral(struct pid_controller *pid, float deviation)
|
|||||||
/* Saturate integral term to specified maximum */
|
/* Saturate integral term to specified maximum */
|
||||||
if (pid->integral > pid->integral_max)
|
if (pid->integral > pid->integral_max)
|
||||||
pid->integral = pid->integral_max;
|
pid->integral = pid->integral_max;
|
||||||
else if (pid->integral < -pid->integral_max)
|
else if (pid->integral < 0.0f)
|
||||||
pid->integral = -pid->integral_max;
|
pid->integral = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pid_sample(struct pid_controller *pid, float deviation)
|
float pid_sample(struct pid_controller *pid, float deviation)
|
||||||
|
Loading…
Reference in New Issue
Block a user