From 342e0da7961f9a3301706ed3835cfc163b14b2ed Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Tue, 21 Jan 2020 16:46:17 +0100 Subject: [PATCH] VTOL land detector: extend fall_detection from multicopter land detector and disable in fixed-wing mode Extend the get_freefall_state() from MC land detector to have a VTOL-specific one that just enables free fall detection if in rotary wing or transition mode. This is done to prevent wrong free-fall detected warnings while doing low-G maneuvers (parabolic flights). Land detection is anyway disabled in FW flight for VTOL so no logic change. Signed-off-by: Silvan Fuhrer --- src/modules/land_detector/VtolLandDetector.cpp | 10 ++++++++++ src/modules/land_detector/VtolLandDetector.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/modules/land_detector/VtolLandDetector.cpp b/src/modules/land_detector/VtolLandDetector.cpp index 6729d98647..1f6e962acf 100644 --- a/src/modules/land_detector/VtolLandDetector.cpp +++ b/src/modules/land_detector/VtolLandDetector.cpp @@ -40,6 +40,7 @@ */ #include +#include #include "VtolLandDetector.h" @@ -94,4 +95,13 @@ bool VtolLandDetector::_get_landed_state() return landed; } +bool VtolLandDetector::_get_freefall_state() +{ + bool free_fall_detected = + MulticopterLandDetector::_get_freefall_state(); // true if falling or in a parabolic flight (low gravity) + + // only return a positive free fall detected if not in fixed-wing mode + return _vehicle_status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_FIXED_WING && free_fall_detected; +} + } // namespace land_detector diff --git a/src/modules/land_detector/VtolLandDetector.h b/src/modules/land_detector/VtolLandDetector.h index 681f6edcb8..d159728636 100644 --- a/src/modules/land_detector/VtolLandDetector.h +++ b/src/modules/land_detector/VtolLandDetector.h @@ -59,6 +59,7 @@ protected: void _update_topics() override; bool _get_landed_state() override; bool _get_maybe_landed_state() override; + bool _get_freefall_state() override; private: