From f29f7d9777ce75230dea752217483a6275de8a30 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 11 Nov 2013 22:29:09 +0900 Subject: [PATCH] Copter: bug fix to take-off in Loiter and AltHold Always set the target altitude after take-off to be current altitude + 20cm. This resolves a bug in which the target altitude could end up being a couple of meters higher than the current altitude if the user entered Loiter / Alt Hold mode before inertial nav altitude estimate had settled. --- ArduCopter/Attitude.pde | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ArduCopter/Attitude.pde b/ArduCopter/Attitude.pde index 6b690847ae..569e1cbc09 100644 --- a/ArduCopter/Attitude.pde +++ b/ArduCopter/Attitude.pde @@ -979,9 +979,8 @@ static void set_throttle_takeoff() { // set alt target - if (controller_desired_alt < current_loc.alt) { - controller_desired_alt = current_loc.alt + ALT_HOLD_TAKEOFF_JUMP; - } + controller_desired_alt = current_loc.alt + ALT_HOLD_TAKEOFF_JUMP; + // clear i term from acceleration controller if (g.pid_throttle_accel.get_integrator() < 0) { g.pid_throttle_accel.reset_I();