APM: when land_complete is true, use land_pitch

this gives a flare on final landing
This commit is contained in:
Andrew Tridgell 2012-08-15 12:35:40 +10:00
parent 2d7fcbd14b
commit df3c8a5bc0
2 changed files with 9 additions and 9 deletions

View File

@ -1080,13 +1080,11 @@ static void update_current_flight_mode(void)
case MAV_CMD_NAV_LAND: case MAV_CMD_NAV_LAND:
calc_nav_roll(); calc_nav_roll();
if (airspeed.use()) {
calc_nav_pitch(); calc_nav_pitch();
calc_throttle(); calc_throttle();
}else{ if (!airspeed.use() || land_complete) {
calc_nav_pitch(); // calculate nav_pitch just to use for calc_throttle // hold pitch constant in final approach
calc_throttle(); // throttle based on altitude error nav_pitch_cd = g.land_pitch_cd;
nav_pitch_cd = g.land_pitch_cd; // pitch held constant
} }
if (land_complete) { if (land_complete) {
@ -1100,6 +1098,7 @@ static void update_current_flight_mode(void)
// we are doing normal AUTO flight, the special cases // we are doing normal AUTO flight, the special cases
// are for takeoff and landing // are for takeoff and landing
hold_course = -1; hold_course = -1;
land_complete = false;
calc_nav_roll(); calc_nav_roll();
calc_nav_pitch(); calc_nav_pitch();
calc_throttle(); calc_throttle();

View File

@ -8,6 +8,7 @@ handle_process_nav_cmd()
{ {
// reset navigation integrators // reset navigation integrators
// ------------------------- // -------------------------
land_complete = false;
reset_I(); reset_I();
gcs_send_text_fmt(PSTR("Executing command ID #%i"),next_nav_command.id); gcs_send_text_fmt(PSTR("Executing command ID #%i"),next_nav_command.id);
@ -319,9 +320,9 @@ static bool verify_land()
if (((wp_distance > 0) && (wp_distance <= (2*g_gps->ground_speed/100))) if (((wp_distance > 0) && (wp_distance <= (2*g_gps->ground_speed/100)))
|| (current_loc.alt <= next_WP.alt + 300)){ || (current_loc.alt <= next_WP.alt + 300)){
land_complete = 1; land_complete = true;
if(hold_course == -1) { if (hold_course == -1) {
// we have just reached the threshold of 2 seconds or 3 // we have just reached the threshold of 2 seconds or 3
// meters to landing. We now don't want to do any radical // meters to landing. We now don't want to do any radical
// turns, as rolling could put the wings into the runway. // turns, as rolling could put the wings into the runway.