From 59023505f9675ec05456f6c814b3d0268f76154a Mon Sep 17 00:00:00 2001 From: jasonshort Date: Sat, 16 Jul 2011 21:53:47 +0000 Subject: [PATCH] Added in limit for alt hold to prevent I term run up. git-svn-id: https://arducopter.googlecode.com/svn/trunk@2870 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- ArduCopterMega/navigation.pde | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ArduCopterMega/navigation.pde b/ArduCopterMega/navigation.pde index 6c3e443b1e..5e84db1087 100644 --- a/ArduCopterMega/navigation.pde +++ b/ArduCopterMega/navigation.pde @@ -21,7 +21,7 @@ void navigate() wp_distance = get_distance(¤t_loc, &next_WP); if (wp_distance < 0){ - gcs.send_text_P(SEVERITY_HIGH,PSTR(" WP error - distance < 0")); + //gcs.send_text_P(SEVERITY_HIGH,PSTR(" WP error - distance < 0")); //Serial.println(wp_distance,DEC); //print_current_waypoints(); return; @@ -48,9 +48,13 @@ get_nav_throttle(long error) { int throttle; - // limit error + // limit error to 4 meters to prevent I term run up + error = constrain(error, -400,400); + throttle = g.pid_throttle.get_pid(error, delta_ms_medium_loop, 1.0); throttle = g.throttle_cruise + constrain(throttle, -80, 80); + + // failed experiment //int tem = alt_hold_velocity(); //throttle -= tem;