Skip to content

Commit

Permalink
Plane: more places checking for terrain alt
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Dec 11, 2024
1 parent 3754576 commit b9ae24b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ArduPlane/ArduPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ bool Plane::set_target_location(const Location &target_loc)
return false;
}
// add home alt if needed
if (loc.relative_alt) {
if (loc.relative_alt && !loc.terrain_alt) {
loc.alt += plane.home.alt;
loc.relative_alt = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion ArduPlane/GCS_Mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ bool GCS_MAVLINK_Plane::handle_guided_request(AP_Mission::Mission_Command &cmd)
void GCS_MAVLINK_Plane::handle_change_alt_request(AP_Mission::Mission_Command &cmd)
{
plane.next_WP_loc.alt = cmd.content.location.alt;
if (cmd.content.location.relative_alt) {
if (cmd.content.location.relative_alt && !cmd.content.location.terrain_alt) {
plane.next_WP_loc.alt += plane.home.alt;
}
plane.next_WP_loc.relative_alt = false;
Expand Down
2 changes: 1 addition & 1 deletion ArduPlane/mode_guided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void ModeGuided::navigate()
bool ModeGuided::handle_guided_request(Location target_loc)
{
// add home alt if needed
if (target_loc.relative_alt) {
if (target_loc.relative_alt && !target_loc.terrain_alt) {
target_loc.alt += plane.home.alt;
target_loc.relative_alt = 0;
}
Expand Down

0 comments on commit b9ae24b

Please sign in to comment.