From dad9c154a3cc475ca0a5fca04886a8ff9a29b7a5 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Tue, 21 Jan 2020 16:28:18 +0100 Subject: [PATCH] VTOL Land Detector: move to airspeed_validated Signed-off-by: Silvan Fuhrer --- src/modules/land_detector/VtolLandDetector.cpp | 7 +++---- src/modules/land_detector/VtolLandDetector.h | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/land_detector/VtolLandDetector.cpp b/src/modules/land_detector/VtolLandDetector.cpp index a3f4292e53..6729d98647 100644 --- a/src/modules/land_detector/VtolLandDetector.cpp +++ b/src/modules/land_detector/VtolLandDetector.cpp @@ -49,7 +49,7 @@ namespace land_detector void VtolLandDetector::_update_topics() { MulticopterLandDetector::_update_topics(); - _airspeed_sub.update(&_airspeed); + _airspeed_validated_sub.update(&_airspeed_validated); _vehicle_status_sub.update(&_vehicle_status); } @@ -74,10 +74,9 @@ bool VtolLandDetector::_get_landed_state() bool landed = MulticopterLandDetector::_get_landed_state(); // for vtol we additionally consider airspeed - if (hrt_elapsed_time(&_airspeed.timestamp) < 1_s && _airspeed.confidence > 0.99f - && PX4_ISFINITE(_airspeed.indicated_airspeed_m_s)) { + if (hrt_elapsed_time(&_airspeed_validated.timestamp) < 1_s && PX4_ISFINITE(_airspeed_validated.true_airspeed_m_s)) { - _airspeed_filtered = 0.95f * _airspeed_filtered + 0.05f * _airspeed.indicated_airspeed_m_s; + _airspeed_filtered = 0.95f * _airspeed_filtered + 0.05f * _airspeed_validated.true_airspeed_m_s; } else { // if airspeed does not update, set it to zero and rely on multicopter land detector diff --git a/src/modules/land_detector/VtolLandDetector.h b/src/modules/land_detector/VtolLandDetector.h index 10f24f8059..681f6edcb8 100644 --- a/src/modules/land_detector/VtolLandDetector.h +++ b/src/modules/land_detector/VtolLandDetector.h @@ -41,7 +41,7 @@ #pragma once -#include +#include #include #include "MulticopterLandDetector.h" @@ -62,10 +62,10 @@ protected: private: - uORB::Subscription _airspeed_sub{ORB_ID(airspeed)}; + uORB::Subscription _airspeed_validated_sub{ORB_ID(airspeed_validated)}; uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)}; - airspeed_s _airspeed{}; + airspeed_validated_s _airspeed_validated{}; vehicle_status_s _vehicle_status{}; bool _was_in_air{false}; /**< indicates whether the vehicle was in the air in the previous iteration */