Browse Source

Alt hold fix

master
Jason Short 13 years ago
parent
commit
0446cae242
  1. 4
      ArduCopter/Attitude.pde

4
ArduCopter/Attitude.pde

@ -94,12 +94,10 @@ get_nav_throttle(long z_error) @@ -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

Loading…
Cancel
Save