Skip to content

Commit e8237c8

Browse files
committed
Plane: more places checking for terrain alt
1 parent 7fe8c0c commit e8237c8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ArduPlane/ArduPlane.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ bool Plane::set_target_location(const Location &target_loc)
859859
return false;
860860
}
861861
// add home alt if needed
862-
if (loc.relative_alt) {
862+
if (loc.relative_alt && !loc.terrain_alt) {
863863
loc.alt += plane.home.alt;
864864
loc.relative_alt = 0;
865865
}

ArduPlane/GCS_Mavlink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ bool GCS_MAVLINK_Plane::handle_guided_request(AP_Mission::Mission_Command &cmd)
749749
void GCS_MAVLINK_Plane::handle_change_alt_request(AP_Mission::Mission_Command &cmd)
750750
{
751751
plane.next_WP_loc.alt = cmd.content.location.alt;
752-
if (cmd.content.location.relative_alt) {
752+
if (cmd.content.location.relative_alt && !cmd.content.location.terrain_alt) {
753753
plane.next_WP_loc.alt += plane.home.alt;
754754
}
755755
plane.next_WP_loc.relative_alt = false;

ArduPlane/mode_guided.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void ModeGuided::navigate()
109109
bool ModeGuided::handle_guided_request(Location target_loc)
110110
{
111111
// add home alt if needed
112-
if (target_loc.relative_alt) {
112+
if (target_loc.relative_alt && !target_loc.terrain_alt) {
113113
target_loc.alt += plane.home.alt;
114114
target_loc.relative_alt = 0;
115115
}

0 commit comments

Comments
 (0)