From 1d0a6678267298c02b24d28ffd87c4bf939f942f Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 26 Sep 2016 16:50:36 -0400 Subject: [PATCH] Geofence defaults (#5534) * geofence messages too frequent * geofence horz/vert disable with 0 instead of -1 -closes #5430 --- src/modules/navigator/geofence.cpp | 4 ++-- src/modules/navigator/geofence_params.c | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/modules/navigator/geofence.cpp b/src/modules/navigator/geofence.cpp index 0bee602955..9485180368 100644 --- a/src/modules/navigator/geofence.cpp +++ b/src/modules/navigator/geofence.cpp @@ -54,7 +54,7 @@ #include #include "navigator.h" -#define GEOFENCE_RANGE_WARNING_LIMIT 3000000 +#define GEOFENCE_RANGE_WARNING_LIMIT 5000000 /* Oddly, ERROR is not defined for C++ */ #ifdef ERROR @@ -137,7 +137,7 @@ bool Geofence::inside(double lat, double lon, float altitude) float max_horizontal_distance = _param_max_hor_distance.get(); float max_vertical_distance = _param_max_ver_distance.get(); - if (max_horizontal_distance > 0 || max_vertical_distance > 0) { + if (max_horizontal_distance > 1 || max_vertical_distance > 1) { if (_home_pos_set) { float dist_xy = -1.0f; float dist_z = -1.0f; diff --git a/src/modules/navigator/geofence_params.c b/src/modules/navigator/geofence_params.c index 307523e2f6..246d1878e5 100644 --- a/src/modules/navigator/geofence_params.c +++ b/src/modules/navigator/geofence_params.c @@ -106,24 +106,25 @@ PARAM_DEFINE_INT32(GF_COUNT, -1); /** * Max horizontal distance in meters. * - * Set to > 0 to activate a geofence action if horizontal distance to home exceeds this value. + * Maximum horizontal distance in meters the vehicle can be from home before triggering a geofence action. Disabled if 0. * * @unit m - * @min -1 - * @max 5000 + * @min 0 + * @max 10000 * @increment 1 * @group Geofence */ -PARAM_DEFINE_FLOAT(GF_MAX_HOR_DIST, -1); +PARAM_DEFINE_FLOAT(GF_MAX_HOR_DIST, 0); /** * Max vertical distance in meters. * - * Set to > 0 to activate a geofence action if vertical distance to home exceeds this value. + * Maximum vertical distance in meters the vehicle can be from home before triggering a geofence action. Disabled if 0. * * @unit m - * @min -1 + * @min 0 + * @max 10000 * @increment 1 * @group Geofence */ -PARAM_DEFINE_FLOAT(GF_MAX_VER_DIST, -1); +PARAM_DEFINE_FLOAT(GF_MAX_VER_DIST, 0);