From 921dc67824f5c1d2e2bece5186b9392cd91e25a3 Mon Sep 17 00:00:00 2001 From: Silvan Date: Wed, 16 Apr 2025 11:27:38 +0200 Subject: [PATCH] FW land detector: only use LNDFW_ROT_MAX if speeds are not valid The rotational speed threshold on fixed-wing vehicles is triggering easily if the plane is lifted prior to takeoff (hand-launch), and can cause issues for the auto takeoff state machine. Thus if either airspeed or groundspeed is valid, it's better to rely on these for land detection, and only use the rotational speed if they're invalid. Signed-off-by: Silvan --- src/modules/land_detector/FixedwingLandDetector.cpp | 4 +++- src/modules/land_detector/land_detector_params_fw.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/land_detector/FixedwingLandDetector.cpp b/src/modules/land_detector/FixedwingLandDetector.cpp index 4ed4a353ab..db077d6504 100644 --- a/src/modules/land_detector/FixedwingLandDetector.cpp +++ b/src/modules/land_detector/FixedwingLandDetector.cpp @@ -121,7 +121,9 @@ bool FixedwingLandDetector::_get_landed_state() const float vel_xy_max_threshold = airspeed_invalid ? 0.7f * _param_lndfw_vel_xy_max.get() : _param_lndfw_vel_xy_max.get(); - const float max_rotation_threshold = math::radians(_param_lndfw_rot_max.get()) ; + // only use the max rotational threshold if neither airspeed nor groundspeed can be used for landing detection + const float max_rotation_threshold = (!_vehicle_local_position.v_xy_valid + && airspeed_invalid) ? math::radians(_param_lndfw_rot_max.get()) : INFINITY; // Crude land detector for fixedwing. landDetected = _airspeed_filtered < _param_lndfw_airspd.get() diff --git a/src/modules/land_detector/land_detector_params_fw.c b/src/modules/land_detector/land_detector_params_fw.c index 6ab78fb867..11eaac239c 100644 --- a/src/modules/land_detector/land_detector_params_fw.c +++ b/src/modules/land_detector/land_detector_params_fw.c @@ -107,6 +107,7 @@ PARAM_DEFINE_FLOAT(LNDFW_TRIG_TIME, 2.f); * Fixed-wing land detector: max rotational speed * * Maximum allowed norm of the angular velocity in the landed state. + * Only used if neither airspeed nor groundspeed can be used for landing detection. * * @unit deg/s * @decimal 1