1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

LP-289 prevent initialization with non-zero pid->I accumulator (dangerous if kI is low)

This commit is contained in:
Eric Price 2017-03-09 18:48:36 +01:00 committed by paul Jewell
parent ebc4b16d9a
commit fb5f9034ea

View File

@ -221,7 +221,10 @@ float pid2_apply(
pid->D = 0.0f; pid->D = 0.0f;
// t=0, u=u0, y=y0, v=u // t=0, u=u0, y=y0, v=u
pid->I = (pid->u0 - pid->va) / pid->vb - pid->kp * (pid->beta * r - y); // pid->I = (pid->u0 - pid->va) / pid->vb - pid->kp * (pid->beta * r - y);
// this is dangerous, if pid->I starts nonzero with very low or zero kI, then
// it will never settle!
pid->I = 0.0f;
} }
// compute proportional part // compute proportional part