Skip to content

Commit

Permalink
VtolLandDetector add airspeed finite check
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Mar 26, 2018
1 parent fda2edb commit 25300a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/modules/land_detector/VtolLandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ bool VtolLandDetector::_get_landed_state()
bool landed = MulticopterLandDetector::_get_landed_state();

// for vtol we additionally consider airspeed
if (hrt_elapsed_time(&_airspeed.timestamp) < 500 * 1000) {
_airspeed_filtered = 0.95f * _airspeed_filtered + 0.05f * _airspeed.true_airspeed_m_s;
if (hrt_elapsed_time(&_airspeed.timestamp) < 500 * 1000 && _airspeed.confidence > 0.99f
&& PX4_ISFINITE(_airspeed.indicated_airspeed_m_s)) {

_airspeed_filtered = 0.95f * _airspeed_filtered + 0.05f * _airspeed.indicated_airspeed_m_s;

} else {
// if airspeed does not update, set it to zero and rely on multicopter land detector
Expand All @@ -98,7 +100,7 @@ bool VtolLandDetector::_get_landed_state()

// only consider airspeed if we have been in air before to avoid false
// detections in the case of wind on the ground
if (_was_in_air && _airspeed_filtered > _params.maxAirSpeed) {
if (_was_in_air && (_airspeed_filtered > _params.maxAirSpeed)) {
landed = false;
}

Expand Down

0 comments on commit 25300a6

Please sign in to comment.