mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-15 21:17:34 +08:00
PX4 style fixes (excluding EKF generated code)
This commit is contained in:
@@ -78,6 +78,7 @@ DataValidator::put(uint64_t timestamp, float val[dimensions], uint64_t error_cou
|
||||
|
||||
if (error_count_in > _error_count) {
|
||||
_error_density += (error_count_in - _error_count);
|
||||
|
||||
} else if (_error_density > 0) {
|
||||
_error_density--;
|
||||
}
|
||||
@@ -90,6 +91,7 @@ DataValidator::put(uint64_t timestamp, float val[dimensions], uint64_t error_cou
|
||||
_mean[i] = 0;
|
||||
_lp[i] = val[i];
|
||||
_M2[i] = 0;
|
||||
|
||||
} else {
|
||||
float lp_val = val[i] - _lp[i];
|
||||
|
||||
@@ -100,6 +102,7 @@ DataValidator::put(uint64_t timestamp, float val[dimensions], uint64_t error_cou
|
||||
|
||||
if (fabsf(_value[i] - val[i]) < 0.000001f) {
|
||||
_value_equal_count++;
|
||||
|
||||
} else {
|
||||
_value_equal_count = 0;
|
||||
}
|
||||
@@ -126,23 +129,23 @@ DataValidator::confidence(uint64_t timestamp)
|
||||
_error_mask |= ERROR_FLAG_NO_DATA;
|
||||
ret = 0.0f;
|
||||
|
||||
/* timed out - that's it */
|
||||
} else if (timestamp - _time_last > _timeout_interval) {
|
||||
/* timed out - that's it */
|
||||
_error_mask |= ERROR_FLAG_TIMEOUT;
|
||||
ret = 0.0f;
|
||||
|
||||
/* we got the exact same sensor value N times in a row */
|
||||
} else if (_value_equal_count > _value_equal_count_threshold) {
|
||||
/* we got the exact same sensor value N times in a row */
|
||||
_error_mask |= ERROR_FLAG_STALE_DATA;
|
||||
ret = 0.0f;
|
||||
|
||||
/* check error count limit */
|
||||
} else if (_error_count > NORETURN_ERRCOUNT) {
|
||||
/* check error count limit */
|
||||
_error_mask |= ERROR_FLAG_HIGH_ERRCOUNT;
|
||||
ret = 0.0f;
|
||||
|
||||
/* cap error density counter at window size */
|
||||
} else if (_error_density > ERROR_DENSITY_WINDOW) {
|
||||
/* cap error density counter at window size */
|
||||
_error_mask |= ERROR_FLAG_HIGH_ERRDENSITY;
|
||||
_error_density = ERROR_DENSITY_WINDOW;
|
||||
|
||||
@@ -171,7 +174,7 @@ DataValidator::print()
|
||||
|
||||
for (unsigned i = 0; i < dimensions; i++) {
|
||||
ECL_INFO("\tval: %8.4f, lp: %8.4f mean dev: %8.4f RMS: %8.4f conf: %8.4f",
|
||||
(double) _value[i], (double)_lp[i], (double)_mean[i],
|
||||
(double)_rms[i], (double)confidence(ecl_absolute_time()));
|
||||
(double) _value[i], (double)_lp[i], (double)_mean[i],
|
||||
(double)_rms[i], (double)confidence(ecl_absolute_time()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user