mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 03:31:37 +08:00
VTOL Land Detector: move to airspeed_validated
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
committed by
Roman Bapst
parent
9a96ca14be
commit
dad9c154a3
@@ -49,7 +49,7 @@ namespace land_detector
|
|||||||
void VtolLandDetector::_update_topics()
|
void VtolLandDetector::_update_topics()
|
||||||
{
|
{
|
||||||
MulticopterLandDetector::_update_topics();
|
MulticopterLandDetector::_update_topics();
|
||||||
_airspeed_sub.update(&_airspeed);
|
_airspeed_validated_sub.update(&_airspeed_validated);
|
||||||
_vehicle_status_sub.update(&_vehicle_status);
|
_vehicle_status_sub.update(&_vehicle_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,10 +74,9 @@ bool VtolLandDetector::_get_landed_state()
|
|||||||
bool landed = MulticopterLandDetector::_get_landed_state();
|
bool landed = MulticopterLandDetector::_get_landed_state();
|
||||||
|
|
||||||
// for vtol we additionally consider airspeed
|
// for vtol we additionally consider airspeed
|
||||||
if (hrt_elapsed_time(&_airspeed.timestamp) < 1_s && _airspeed.confidence > 0.99f
|
if (hrt_elapsed_time(&_airspeed_validated.timestamp) < 1_s && PX4_ISFINITE(_airspeed_validated.true_airspeed_m_s)) {
|
||||||
&& PX4_ISFINITE(_airspeed.indicated_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 {
|
} else {
|
||||||
// if airspeed does not update, set it to zero and rely on multicopter land detector
|
// if airspeed does not update, set it to zero and rely on multicopter land detector
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <uORB/topics/airspeed.h>
|
#include <uORB/topics/airspeed_validated.h>
|
||||||
#include <uORB/topics/vehicle_status.h>
|
#include <uORB/topics/vehicle_status.h>
|
||||||
|
|
||||||
#include "MulticopterLandDetector.h"
|
#include "MulticopterLandDetector.h"
|
||||||
@@ -62,10 +62,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
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)};
|
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
|
||||||
|
|
||||||
airspeed_s _airspeed{};
|
airspeed_validated_s _airspeed_validated{};
|
||||||
vehicle_status_s _vehicle_status{};
|
vehicle_status_s _vehicle_status{};
|
||||||
|
|
||||||
bool _was_in_air{false}; /**< indicates whether the vehicle was in the air in the previous iteration */
|
bool _was_in_air{false}; /**< indicates whether the vehicle was in the air in the previous iteration */
|
||||||
|
|||||||
Reference in New Issue
Block a user