From 7035529953677d87163b27b04ba3f3bdd9d65675 Mon Sep 17 00:00:00 2001 From: rmackay9 Date: Sat, 24 Nov 2012 16:46:07 +0900 Subject: [PATCH] ArduCopter: remove unused get_desired_climb_rate function --- ArduCopter/navigation.pde | 56 --------------------------------------- 1 file changed, 56 deletions(-) diff --git a/ArduCopter/navigation.pde b/ArduCopter/navigation.pde index 2ff4b85263..bed377c548 100644 --- a/ArduCopter/navigation.pde +++ b/ArduCopter/navigation.pde @@ -523,60 +523,6 @@ static void reset_desired_speed() max_speed_old = 0; } -#define MAX_CLIMB_RATE_UP 300 -#define MAX_CLIMB_RATE_DOWN 200 -#define MIN_CLIMB_RATE 50 -#define DECEL_CLIMB_RATE 30 - - -static int16_t get_desired_climb_rate() -{ - if(alt_change_flag == REACHED_ALT) { - return 0; - } - - int16_t climb = 0; - int32_t dist = labs(altitude_error); - - if(dist < 20000){ // limit the size of numbers we're dealing with to avoid overflow - dist -= 300; // give ourselves 3 meter buffer to the desired alt - float temp = 2 * DECEL_CLIMB_RATE * dist + (MIN_CLIMB_RATE * MIN_CLIMB_RATE); // 50cm minium climb_rate; - climb = sqrt(temp); - - if(alt_change_flag == ASCENDING){ - climb = constrain(climb, 200, MAX_CLIMB_RATE_UP); - }else{ - // Descending - climb = constrain(climb, MIN_CLIMB_RATE, MAX_CLIMB_RATE_DOWN); - } - - }else{ - if(alt_change_flag == ASCENDING){ - climb = MAX_CLIMB_RATE_UP; // don't go to fast - }else{ - climb = MAX_CLIMB_RATE_DOWN; // don't go to fast - } - } - - if(alt_change_flag == DESCENDING){ - climb = -climb; - } - return climb; -} - -static int16_t get_desired_climb_rate_old() -{ - if(alt_change_flag == ASCENDING) { - return constrain(altitude_error / 4, 100, 180); // 180cm /s up, minimum is 100cm/s - - }else if(alt_change_flag == DESCENDING) { - return constrain(altitude_error / 6, -100, -10); // -100cm /s down, max is -10cms - - }else{ - return 0; - } -} - static void update_crosstrack(void) { // Crosstrack Error @@ -653,8 +599,6 @@ static void verify_altitude() // Keeps old data out of our calculation / logs static void reset_nav_params(void) { - nav_throttle = 0; - // always start Circle mode at same angle circle_angle = 0;