From 267195a11ba951576cddea74a23da8de8720b1f6 Mon Sep 17 00:00:00 2001 From: Nico van Duijn Date: Thu, 12 Sep 2019 09:12:25 +0200 Subject: [PATCH] EKF: remove check for faulty flag in fake rng This removes the check for _rng_hgt_faulty in the decision of publishing a fake range measurement. The reason for this is that some distance sensors don't populate the quality flag, even if they are saturated. Hence, if we are on the ground and not moving, it is safe to publish a fake measurement of the distance sensor and overwrite the actual sensor data. --- EKF/terrain_estimator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EKF/terrain_estimator.cpp b/EKF/terrain_estimator.cpp index 3027874317..929258d0ab 100644 --- a/EKF/terrain_estimator.cpp +++ b/EKF/terrain_estimator.cpp @@ -99,7 +99,7 @@ void Ekf::runTerrainEstimator() // if stationary on the ground and no range data for over a second, fake a measurement // to handle bad range finder data when on ground - if (_rng_hgt_faulty && !_range_data_ready && !_control_status.flags.in_air && _vehicle_at_rest && (_time_last_imu - _time_last_hagl_fuse) > (uint64_t)1E6) { + if (!_range_data_ready && !_control_status.flags.in_air && _vehicle_at_rest && (_time_last_imu - _time_last_hagl_fuse) > (uint64_t)1E6) { _range_data_ready = true; _rng_hgt_faulty = false; _range_sample_delayed.rng = _params.rng_gnd_clearance;