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 <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2020-02-14 17:46:30 +03:00
committed by Roman Bapst
parent dad9c154a3
commit 342e0da796
2 changed files with 11 additions and 0 deletions
@@ -40,6 +40,7 @@
*/
#include <drivers/drv_hrt.h>
#include <matrix/math.hpp>
#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
@@ -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: