Skip to content

Commit

Permalink
Fix building when terrain not available
Browse files Browse the repository at this point in the history
  • Loading branch information
shellixyz committed May 16, 2022
1 parent cdeb17c commit 1bf3765
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ArduPlane/mode_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ void ModeRTL::update()
plane.calc_throttle();

float altitude = plane.relative_altitude;
#if AP_TERRAIN_AVAILABLE
if (!plane.terrain_disabled()) plane.terrain.height_above_terrain(altitude, true);
#endif

if (plane.rtl.emergency_landing_status >= Plane::FSEmergencyLandingStatus::GLIDING &&
(plane.g.fs_emergency_landing_land_upwind || (plane.g.fs_emergency_landing_leveling_altitude > -1 && altitude < plane.g.fs_emergency_landing_leveling_altitude.get()))) {
Expand Down Expand Up @@ -208,7 +210,9 @@ void ModeRTL::navigate()
case Plane::FSEmergencyLandingStatus::GLIDING: {
plane.set_auto_thr_gliding(true);
float altitude = plane.relative_altitude;
#if AP_TERRAIN_AVAILABLE
if (!plane.terrain_disabled()) plane.terrain.height_above_terrain(altitude, true);
#endif

if (altitude < 10) {
// below 10m don't go back to home altitude if FS ends
Expand Down

0 comments on commit 1bf3765

Please sign in to comment.