Browse Source

VTOL Land Detector: move to airspeed_validated

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
sbg
Silvan Fuhrer 5 years ago committed by Roman Bapst
parent
commit
dad9c154a3
  1. 7
      src/modules/land_detector/VtolLandDetector.cpp
  2. 6
      src/modules/land_detector/VtolLandDetector.h

7
src/modules/land_detector/VtolLandDetector.cpp

@ -49,7 +49,7 @@ namespace land_detector @@ -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() @@ -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

6
src/modules/land_detector/VtolLandDetector.h

@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
#pragma once
#include <uORB/topics/airspeed.h>
#include <uORB/topics/airspeed_validated.h>
#include <uORB/topics/vehicle_status.h>
#include "MulticopterLandDetector.h"
@ -62,10 +62,10 @@ protected: @@ -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 */

Loading…
Cancel
Save