From 3e7fb66a774fe5a06a0216938dc67c61305d6c44 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Thu, 12 Dec 2019 12:55:45 +0900 Subject: [PATCH] Copter: precision landing does not use terrain database precision landing was always only using the range finder, there was no use of the provided alt unless the rangefinder was good --- ArduCopter/Copter.h | 1 - ArduCopter/precision_landing.cpp | 6 +----- ArduCopter/terrain.cpp | 10 ---------- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 2bd3cd492d..6cb93730fa 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -888,7 +888,6 @@ private: // terrain.cpp void terrain_update(); void terrain_logging(); - bool terrain_use(); // tuning.cpp void tuning(); diff --git a/ArduCopter/precision_landing.cpp b/ArduCopter/precision_landing.cpp index ad6cd8f391..4ae12b3e5d 100644 --- a/ArduCopter/precision_landing.cpp +++ b/ArduCopter/precision_landing.cpp @@ -15,13 +15,9 @@ void Copter::update_precland() { int32_t height_above_ground_cm = current_loc.alt; - // use range finder altitude if it is valid, else try to get terrain alt + // use range finder altitude if it is valid, otherwise use home alt if (rangefinder_alt_ok()) { height_above_ground_cm = rangefinder_state.alt_cm; - } else if (terrain_use() && !current_loc.is_zero()) { - if (!current_loc.get_alt_cm(Location::AltFrame::ABOVE_TERRAIN, height_above_ground_cm)) { - height_above_ground_cm = current_loc.alt; - } } precland.update(height_above_ground_cm, rangefinder_alt_ok()); diff --git a/ArduCopter/terrain.cpp b/ArduCopter/terrain.cpp index 6f4476e1ae..09649eb26f 100644 --- a/ArduCopter/terrain.cpp +++ b/ArduCopter/terrain.cpp @@ -26,13 +26,3 @@ void Copter::terrain_logging() } #endif } - -// should we use terrain data for things including the home altitude -bool Copter::terrain_use() -{ -#if AP_TERRAIN_AVAILABLE && AC_TERRAIN - return (g.terrain_follow > 0); -#else - return false; -#endif -}