EKF: Fix inconsistency in timeout for terrain validity

Terrain validity is determined solely by successful range finder fusion and terrain state initialisation.
A range finder that has been declared faulty requires continuous range finder data fusion requires  data to be continuous before the fault status _rng_hgt_faulty  can be cleared. This will enforce the requirement for continuous data before fusion can commence.
This commit is contained in:
Paul Riseborough
2018-07-26 07:53:39 +02:00
committed by Lorenz Meier
parent d1d49857f9
commit 628079719f
2 changed files with 6 additions and 2 deletions
+5
View File
@@ -1144,6 +1144,11 @@ void Ekf::checkRangeDataValidity()
return;
}
// Don't allow faulty flag to clear unless range data is continuous
if (_rng_hgt_faulty && !_range_data_continuous) {
return;
}
// Don't run the checks after this unless we have retrieved new data from the buffer
if (!_range_data_ready) {
return;
+1 -2
View File
@@ -171,8 +171,7 @@ bool Ekf::get_terrain_valid()
// determine terrain validity
void Ekf::update_terrain_valid()
{
if (_terrain_initialised && _range_data_continuous && !_control_status.flags.rng_stuck &&
(_time_last_imu - _time_last_hagl_fuse < (uint64_t)5e6)) {
if (_terrain_initialised && (_time_last_imu - _time_last_hagl_fuse < (uint64_t)5e6)) {
_hagl_valid = true;