Browse Source

AP_Terrain: avoid direct use of Location alt field

gps-1.3.1
Peter Barker 3 years ago committed by Andrew Tridgell
parent
commit
5fe91f16af
  1. 8
      libraries/AP_Terrain/TerrainGCS.cpp

8
libraries/AP_Terrain/TerrainGCS.cpp

@ -247,11 +247,9 @@ void AP_Terrain::send_terrain_report(mavlink_channel_t chan, const Location &loc @@ -247,11 +247,9 @@ void AP_Terrain::send_terrain_report(mavlink_channel_t chan, const Location &loc
if (spacing == 0 && !(extrapolate && have_current_loc_height)) {
current_height = 0;
} else {
if (current_loc.relative_alt) {
current_height = current_loc.alt*0.01f;
} else {
current_height = (current_loc.alt - ahrs.get_home().alt)*0.01f;
}
int32_t height_above_home_cm = 0;
UNUSED_RESULT(current_loc.get_alt_cm(Location::AltFrame::ABOVE_HOME, height_above_home_cm));
current_height = height_above_home_cm * 0.01f; // cm -> m
}
current_height += home_terrain_height - terrain_height;

Loading…
Cancel
Save