made the last step of landing stop navigating so we can drop straight down.

This commit is contained in:
Jason Short 2011-12-14 22:03:47 -08:00
parent 66c974a949
commit 96ce429537

View File

@ -1244,9 +1244,19 @@ static void update_navigation()
// switch passthrough to LOITER // switch passthrough to LOITER
case LOITER: case LOITER:
case POSITION: case POSITION:
wp_control = LOITER_MODE;
// calculates the desired Roll and Pitch
update_nav_wp();
break;
case LAND: case LAND:
wp_control = LOITER_MODE; wp_control = LOITER_MODE;
if (current_loc.alt < 250){
wp_control = NO_NAV_MODE;
next_WP.alt = -200; // force us down
}
// calculates the desired Roll and Pitch // calculates the desired Roll and Pitch
update_nav_wp(); update_nav_wp();
break; break;
@ -1589,11 +1599,16 @@ static void update_nav_wp()
//int nroll = nav_roll; //int nroll = nav_roll;
//int npitch = nav_pitch; //int npitch = nav_pitch;
//Serial.printf("CIRCLE: angle:%d, dist:%d, X:%d, Y:%d, P:%d, R:%d \n", angleTest, (int)wp_distance , (int)long_error, (int)lat_error, npitch, nroll); //Serial.printf("CIRCLE: angle:%d, dist:%d, X:%d, Y:%d, P:%d, R:%d \n", angleTest, (int)wp_distance , (int)long_error, (int)lat_error, npitch, nroll);
} else {
}else if(wp_control == WP_MODE){
// use error as the desired rate towards the target // use error as the desired rate towards the target
calc_nav_rate(g.waypoint_speed_max); calc_nav_rate(g.waypoint_speed_max);
// rotate pitch and roll to the copter frame of reference // rotate pitch and roll to the copter frame of reference
calc_nav_pitch_roll(); calc_nav_pitch_roll();
}else if(wp_control == NO_NAV_MODE){
nav_roll = 0;
nav_pitch = 0;
} }
} }