mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 02:18:29 -04:00
ArduCopter: remove unused get_desired_climb_rate function
This commit is contained in:
parent
a94826f182
commit
7035529953
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user