From 05451852181fe7648e2a9b086875a5e3d1378c63 Mon Sep 17 00:00:00 2001 From: David Dewey Date: Tue, 13 Aug 2013 16:53:45 +0800 Subject: [PATCH] Copter: RTL at no less than 2m above home alt --- ArduCopter/config.h | 4 ++++ ArduCopter/control_rtl.pde | 1 + 2 files changed, 5 insertions(+) diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 1cbbddaf64..d8ad95b22b 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -467,6 +467,10 @@ # define RTL_ALT 1500 // default alt to return to home in cm, 0 = Maintain current altitude #endif +#ifndef RTL_ALT_MIN + # define RTL_ALT_MIN 200 // min height above ground for RTL (i.e 2m) +#endif + #ifndef RTL_LOITER_TIME # define RTL_LOITER_TIME 5000 // Time (in milliseconds) to loiter above home before begining final descent #endif diff --git a/ArduCopter/control_rtl.pde b/ArduCopter/control_rtl.pde index 3a908e59f0..1b735b7a80 100644 --- a/ArduCopter/control_rtl.pde +++ b/ArduCopter/control_rtl.pde @@ -389,6 +389,7 @@ static float get_RTL_alt() { // maximum of current altitude and rtl altitude float rtl_alt = max(current_loc.alt, g.rtl_altitude); + rtl_alt = max(rtl_alt, RTL_ALT_MIN); #if AC_FENCE == ENABLED // ensure not above fence altitude if alt fence is enabled