From 9ad6f711f89acf54271d30aed7cf53a33938f294 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sat, 12 Jan 2013 11:40:03 +0900 Subject: [PATCH] ArduCopter: replace FS_THR_RTL_MIN_DISTANCE with wp_radius This effectively means that an RTL kicked off by a failsafe will immediately switch to LAND mode only if within 2 meters. Previously the radius was much wider (15m). --- ArduCopter/config.h | 4 ---- ArduCopter/events.pde | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 43fcfc3b5b..ffb07392a2 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -501,10 +501,6 @@ # define FS_THR_VALUE_DEFAULT 975 #endif -#ifndef FS_THR_RTL_MIN_DISTANCE - # define FS_THR_RTL_MIN_DISTANCE 1500 // the minimum distance from home in which -#endif - #ifndef MINIMUM_THROTTLE # define MINIMUM_THROTTLE 130 diff --git a/ArduCopter/events.pde b/ArduCopter/events.pde index b10772f7d6..4cd25ba20e 100644 --- a/ArduCopter/events.pde +++ b/ArduCopter/events.pde @@ -18,7 +18,7 @@ static void failsafe_on_event() // if throttle is zero disarm motors if (g.rc_3.control_in == 0) { init_disarm_motors(); - }else if(ap.home_is_set == true && home_distance >= FS_THR_RTL_MIN_DISTANCE) { + }else if(ap.home_is_set == true && home_distance > g.waypoint_radius) { set_mode(RTL); }else{ // We have no GPS or are very close to home so we will land @@ -28,7 +28,7 @@ static void failsafe_on_event() case AUTO: // failsafe_throttle is 1 do RTL, 2 means continue with the mission if (g.failsafe_throttle == FS_THR_ENABLED_ALWAYS_RTL) { - if(home_distance >= FS_THR_RTL_MIN_DISTANCE) { + if(home_distance > g.waypoint_radius) { set_mode(RTL); }else{ // We are very close to home so we will land @@ -38,7 +38,7 @@ static void failsafe_on_event() // if failsafe_throttle is 2 (i.e. FS_THR_ENABLED_CONTINUE_MISSION) no need to do anything break; default: - if(ap.home_is_set == true && home_distance >= FS_THR_RTL_MIN_DISTANCE) { + if(ap.home_is_set == true && home_distance > g.waypoint_radius) { set_mode(RTL); }else{ // We have no GPS or are very close to home so we will land @@ -77,7 +77,7 @@ static void low_battery_event(void) } break; case AUTO: - if(ap.home_is_set == true && home_distance >= FS_THR_RTL_MIN_DISTANCE) { + if(ap.home_is_set == true && home_distance > g.waypoint_radius) { set_mode(RTL); }else{ // We have no GPS or are very close to home so we will land