APM: changed hold_course for landing to be based on yaw_sensor

when we are in the final stages of a landing (less than 2 seconds from
landing waypoint, or less than 3m above landing altitude) we switch
the navigation to use a fixed course. The code previously used the
crosstrack_bearing for this, but this can lead to a large nav_roll in
this final stage of the approach, which can put a wing into the
runway. In autotest we were seeing a nav_roll value of -45 degrees as
we crossed the transition point for the landing, which often led to a
crash.

This changes the code to use the current yaw_sensor value instead,
which is much less likely to lead to large rolls in the final landing
stages.
This commit is contained in:
Andrew Tridgell 2012-02-15 08:49:38 +11:00
parent c6b6320b43
commit 2dcb594f4a
1 changed files with 12 additions and 6 deletions

View File

@ -314,13 +314,19 @@ 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; //Set land_complete if we are within 2 seconds distance or within 3 meters altitude land_complete = 1;
if(hold_course == -1) { if(hold_course == -1) {
// save our current course to land // we have just reached the threshold of 2 seconds or 3
//hold_course = yaw_sensor; // meters to landing. We now don't want to do any radical
// save the course line of the runway to land // turns, as rolling could put the wings into the runway.
hold_course = crosstrack_bearing; // To prevent further turns we set hold_course to the
// current heading. Previously we set this to
// crosstrack_bearing, but the xtrack bearing can easily
// be quite large at this point, and that could induce a
// sudden large roll correction which is very nasty at
// this point in the landing.
hold_course = dcm.yaw_sensor;
} }
} }