Plane: fixed guided alt without terrain bit

This commit is contained in:
Andrew Tridgell 2014-07-25 10:23:12 +10:00
parent c4047f6f11
commit 077177384d
2 changed files with 6 additions and 4 deletions

View File

@ -888,6 +888,7 @@ void GCS_MAVLINK::handle_guided_request(AP_Mission::Mission_Command &cmd)
// add home alt if needed
if (guided_WP_loc.flags.relative_alt) {
guided_WP_loc.alt += home.alt;
guided_WP_loc.flags.relative_alt = 0;
}
set_mode(GUIDED);
@ -902,11 +903,11 @@ void GCS_MAVLINK::handle_guided_request(AP_Mission::Mission_Command &cmd)
*/
void GCS_MAVLINK::handle_change_alt_request(AP_Mission::Mission_Command &cmd)
{
if (cmd.content.location.flags.relative_alt) {
cmd.content.location.alt += home.alt;
}
next_WP_loc.alt = cmd.content.location.alt;
if (cmd.content.location.flags.relative_alt) {
next_WP_loc.alt += home.alt;
}
next_WP_loc.flags.relative_alt = false;
}

View File

@ -26,6 +26,7 @@ static void set_next_WP(const struct Location& loc)
if (next_WP_loc.alt == 0) {
next_WP_loc.alt = current_loc.alt;
next_WP_loc.flags.relative_alt = false;
next_WP_loc.flags.terrain_alt = false;
}
}