From f5cde2cf024a5cbda4161aeb756c38a55cab3e65 Mon Sep 17 00:00:00 2001 From: jonas Date: Fri, 20 Nov 2026 11:12:23 +0100 Subject: [PATCH] docs(commander): say how a GF_CONT_ACTION of Terminate is handled GF_CONT_ACTION has no Terminate, but the value 4 can still be set by hand. The comments now say what happens then: commander only warns, and Navigator passes the value on and refuses Go-to targets outside the contingency geofence, as for every action other than None and Warning. Assisted-by: Claude:claude-fable-5-2 Signed-off-by: jonas --- src/modules/commander/failsafe/failsafe.cpp | 5 ++++- src/modules/navigator/geofence.h | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/commander/failsafe/failsafe.cpp b/src/modules/commander/failsafe/failsafe.cpp index b4fdd110001..f03da080950 100644 --- a/src/modules/commander/failsafe/failsafe.cpp +++ b/src/modules/commander/failsafe/failsafe.cpp @@ -132,6 +132,9 @@ FailsafeBase::ActionOptions Failsafe::fromGfActParam(int param_value) return options; } +// GF_CONT_ACTION offers the actions of GF_ACTION without Terminate (4): the vehicle is expected to reach the +// contingency geofence, so terminating there is too dangerous. Terminate stays with GF_ACTION. +// A 4 set by hand does not terminate: like every value that is not offered, it only warns. FailsafeBase::ActionOptions Failsafe::fromGfContActParam(int param_value) { switch (geofence_violation_action(param_value)) { @@ -142,7 +145,7 @@ FailsafeBase::ActionOptions Failsafe::fromGfContActParam(int param_value) return fromGfActParam(param_value); default: - // The contingency geofence does not offer Terminate. + // Warning, Terminate and unknown values. return ActionOptions(Action::Warn); } } diff --git a/src/modules/navigator/geofence.h b/src/modules/navigator/geofence.h index 8f7be547d4c..8ec24d2e991 100644 --- a/src/modules/navigator/geofence.h +++ b/src/modules/navigator/geofence.h @@ -224,7 +224,13 @@ public: int getSource() { return _param_gf_source.get(); } int getGeofenceAction() { return _param_gf_action.get(); } - /** GF_CONT_ACTION, or None while the contingency geofence is disabled. */ + /** + * GF_CONT_ACTION, or None while the contingency geofence is disabled. + * The value is passed on as set. Commander decides what a breach triggers and turns a value the parameter + * does not offer into a Warning, see Failsafe::fromGfContActParam(). Example: a 4 (Terminate) set by hand + * only warns. Navigator still refuses Go-to targets outside the contingency geofence with such a value, + * as it does for every action other than None and Warning. + */ int getContGeofenceAction() const { return getContGeofenceMargin() > FLT_EPSILON ? _param_gf_cont_action.get() : geofence_result_s::GF_ACTION_NONE;