From 563bfbf6e7483cb8d5ced4704063f9b790d0aef8 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Thu, 16 Nov 2023 13:58:07 +0100 Subject: [PATCH] Geofence: remove GF_COUNT Signed-off-by: Silvan Fuhrer --- src/modules/navigator/geofence.cpp | 16 ++-------------- src/modules/navigator/geofence.h | 2 -- src/modules/navigator/geofence_params.c | 12 +----------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/modules/navigator/geofence.cpp b/src/modules/navigator/geofence.cpp index 9b01736f3d..1a2c4395ae 100644 --- a/src/modules/navigator/geofence.cpp +++ b/src/modules/navigator/geofence.cpp @@ -259,20 +259,8 @@ bool Geofence::checkAll(double lat, double lon, float altitude) // as they both report being inside when not enabled inside_fence = inside_fence && isInsidePolygonOrCircle(lat, lon, altitude); - if (inside_fence) { - _outside_counter = 0; - return inside_fence; - - } else { - _outside_counter++; - - if (_outside_counter > _param_gf_count.get()) { - return inside_fence; - - } else { - return true; - } - } + return inside_fence; +} } bool Geofence::check(const vehicle_global_position_s &global_position, const sensor_gps_s &gps_position) diff --git a/src/modules/navigator/geofence.h b/src/modules/navigator/geofence.h index 0359141404..329edf6ca8 100644 --- a/src/modules/navigator/geofence.h +++ b/src/modules/navigator/geofence.h @@ -189,7 +189,6 @@ private: MapProjection _projection_reference{}; ///< class to convert (lon, lat) to local [m] - int _outside_counter{0}; uint16_t _update_counter{0}; ///< dataman update counter: if it does not match, polygon data was updated bool _fence_updated{true}; ///< flag indicating if fence are updated to dataman cache bool _initiate_fence_updated{true}; ///< flag indicating if fence updated is needed @@ -231,7 +230,6 @@ private: DEFINE_PARAMETERS( (ParamInt) _param_gf_action, (ParamInt) _param_gf_source, - (ParamInt) _param_gf_count, (ParamFloat) _param_gf_max_hor_dist, (ParamFloat) _param_gf_max_ver_dist, (ParamBool) _param_gf_predict diff --git a/src/modules/navigator/geofence_params.c b/src/modules/navigator/geofence_params.c index 3d53fa1cdf..cbca819644 100644 --- a/src/modules/navigator/geofence_params.c +++ b/src/modules/navigator/geofence_params.c @@ -76,17 +76,7 @@ PARAM_DEFINE_INT32(GF_ACTION, 2); */ PARAM_DEFINE_INT32(GF_SOURCE, 0); -/** - * Geofence counter limit - * - * Set how many subsequent position measurements outside of the fence are needed before geofence violation is triggered - * - * @min -1 - * @max 10 - * @increment 1 - * @group Geofence - */ -PARAM_DEFINE_INT32(GF_COUNT, -1); + /** * Max horizontal distance in meters.