From 06bf60672bb4aba2e323a8de8c076c8adb8f7e9e Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Mon, 17 Oct 2022 11:49:04 +0200 Subject: [PATCH] MC LandDetector: add constant (0.3) for vz threshold for in_descend flag Signed-off-by: Silvan Fuhrer --- src/modules/land_detector/MulticopterLandDetector.cpp | 2 +- src/modules/land_detector/MulticopterLandDetector.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/land_detector/MulticopterLandDetector.cpp b/src/modules/land_detector/MulticopterLandDetector.cpp index cba3d049d5..99a6638c20 100644 --- a/src/modules/land_detector/MulticopterLandDetector.cpp +++ b/src/modules/land_detector/MulticopterLandDetector.cpp @@ -202,7 +202,7 @@ bool MulticopterLandDetector::_get_ground_contact_state() if (_trajectory_setpoint_sub.update(&trajectory_setpoint)) { // Setpoints can be NAN _in_descend = PX4_ISFINITE(trajectory_setpoint.velocity[2]) - && (trajectory_setpoint.velocity[2] > FLT_EPSILON); + && (trajectory_setpoint.velocity[2] > DESCENT_TRAJECTORY_VZ_THRESHOLD); } // ground contact requires commanded descent until landed diff --git a/src/modules/land_detector/MulticopterLandDetector.h b/src/modules/land_detector/MulticopterLandDetector.h index 1e473eff83..6493ec4261 100644 --- a/src/modules/land_detector/MulticopterLandDetector.h +++ b/src/modules/land_detector/MulticopterLandDetector.h @@ -87,6 +87,9 @@ private: /** Distance above ground below which entering ground contact state is possible when distance to ground is available. */ static constexpr float DIST_FROM_GROUND_THRESHOLD = 1.0f; + /** Down velocity threshold for setting "in_descend" flag */ + static constexpr float DESCENT_TRAJECTORY_VZ_THRESHOLD = 0.3f; + /** Handles for interesting parameters. **/ struct { param_t minThrottle;