mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Merged in f5soh/librepilot/LP-596_AltitudeHold_transition (pull request #509)
LP-596 Fix AltitudeHold transition Approved-by: Lalanne Laurent <f5soh@free.fr> Approved-by: Cliff . <cliffsjunk@att.net> Approved-by: Julian Lilov <jdl@abv.bg> Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
This commit is contained in:
commit
853a014e47
@ -219,7 +219,17 @@ float pid2_apply(
|
||||
// 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;
|
||||
// pid->I = 0.0f;
|
||||
// whether ki is zero or non-zero, when doing 'reconfigure' we start with setpoint==actual
|
||||
pid->I = (pid->u0 - pid->va) / pid->vb;
|
||||
// if ki is non-zero
|
||||
if (pid->bi > 5e-7f) {
|
||||
// then the output can wind up/down to get rid of a difference between setpoint and actual
|
||||
// so we can generate the full bumpless transfer here
|
||||
// else leave off the part that can vary due to difference between setpoint and actual
|
||||
// so that it is repeatable (for tuning purposes at least)
|
||||
pid->I -= pid->kp * (pid->beta * r - y);
|
||||
}
|
||||
}
|
||||
|
||||
// compute proportional part
|
||||
|
Loading…
x
Reference in New Issue
Block a user