terrain_estimator: introduce quality metric in rng

This commit introduces a quality measure in the range data. It is
used to properly decide whether to initialize the HAGL estimate on
 sensor data or MIN_HGT parameter, as well as in the decision of
whether a 'fake' measurement should be published on the ground to
allow for optical flow take-offs.
This commit is contained in:
Nico van Duijn
2019-09-12 17:45:37 +10:00
committed by Paul Riseborough
parent 3e05fd552e
commit a12186c285
5 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -314,7 +314,7 @@ void EstimatorInterface::setAirspeedData(uint64_t time_usec, float true_airspeed
}
}
void EstimatorInterface::setRangeData(uint64_t time_usec, float data)
void EstimatorInterface::setRangeData(uint64_t time_usec, float data, uint8_t quality)
{
if (!_initialised || _range_buffer_fail) {
return;
@@ -336,6 +336,7 @@ void EstimatorInterface::setRangeData(uint64_t time_usec, float data)
rangeSample range_sample_new;
range_sample_new.rng = data;
range_sample_new.time_us = time_usec - _params.range_delay_ms * 1000;
range_sample_new.quality = quality;
_time_last_range = time_usec;
_range_buffer.push(range_sample_new);