From f9ec0cd5ea301612333fdbbd6226e8bdbfe406ca Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Tue, 8 Jan 2019 14:50:56 +0100 Subject: [PATCH] LandDetector: use vertical velocity estimate for threshold instead of the derivative of the vertical position which is not the same value when using the ekf2 estimation. Using the position derivative resulted in delayed landing because the value for some reason often bumped over the theshold before slowly converging towards zero while the velocity was within expected accuary in all these cases. --- src/modules/land_detector/MulticopterLandDetector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/land_detector/MulticopterLandDetector.cpp b/src/modules/land_detector/MulticopterLandDetector.cpp index b6c839409a76..3e54f3d0c980 100644 --- a/src/modules/land_detector/MulticopterLandDetector.cpp +++ b/src/modules/land_detector/MulticopterLandDetector.cpp @@ -175,7 +175,7 @@ bool MulticopterLandDetector::_get_ground_contact_state() // Adjust maxClimbRate if land_speed is lower than 2x maxClimbrate float maxClimbRate = ((land_speed_threshold * 0.5f) < _params.maxClimbRate) ? (0.5f * land_speed_threshold) : _params.maxClimbRate; - verticalMovement = fabsf(_vehicleLocalPosition.z_deriv) > maxClimbRate; + verticalMovement = fabsf(_vehicleLocalPosition.vz) > maxClimbRate; } // Check if we are moving horizontally.