Alt hold fix

This commit is contained in:
Jason Short 2011-11-07 12:00:37 -08:00
parent 3b51874a70
commit 6d0a32cc65

View File

@ -94,12 +94,10 @@ get_nav_throttle(long z_error)
// limit error to prevent I term run up
z_error = constrain(z_error, -ALT_ERROR_MAX, ALT_ERROR_MAX);
int rate_error = g.pi_alt_hold.get_pi(z_error, .1); //_p = .85
rate_error = rate_error - climb_rate;
// limit the rate
rate_error = constrain(rate_error, -80, 140);
return (int)g.pi_throttle.get_pi(rate_error, .1);
return constrain((int)g.pi_throttle.get_pi(rate_error, .1), -120, 180);
}
static int