PreFltCheck: do not force to report ekf2 failures on GCS connection

EKF2 has a grace period of 10 seconds after boot where it doesn't need
to warn the user while the sensors (especially GNSS) are still
converging.
A connection to a GCS shouldn't skip this grace period but
an arming request should.
This commit is contained in:
bresch
2021-09-08 14:41:26 -04:00
committed by Daniel Agar
parent 58ea97a699
commit aad11ecc65
2 changed files with 7 additions and 5 deletions
@@ -237,14 +237,16 @@ bool PreFlightCheck::preflightCheck(orb_advert_t *mavlink_log_pub, vehicle_statu
if (estimator_type == 2) {
const bool ekf_healthy = ekf2Check(mavlink_log_pub, status, false, report_failures) &&
ekf2CheckSensorBias(mavlink_log_pub, report_failures);
const bool in_grace_period = time_since_boot < 10_s;
const bool do_report_ekf2_failures = report_failures && (!in_grace_period || prearm);
const bool ekf_healthy = ekf2Check(mavlink_log_pub, status, false, do_report_ekf2_failures) &&
ekf2CheckSensorBias(mavlink_log_pub, do_report_ekf2_failures);
// For the first 10 seconds the ekf2 can be unhealthy, and we just mark it
// as not present.
// After that or if report_failures is true, we'll set the flags as is.
// After that or if we're forced to report, we'll set the flags as is.
if (!ekf_healthy && time_since_boot < 10_s && !report_failures) {
if (!ekf_healthy && !do_report_ekf2_failures) {
set_health_flags(subsystem_info_s::SUBSYSTEM_TYPE_AHRS, true, false, false, status);
} else {
+1 -1
View File
@@ -3528,7 +3528,7 @@ void Commander::data_link_check()
if (!_armed.armed && !_status_flags.condition_calibration_enabled) {
// make sure to report preflight check failures to a connecting GCS
PreFlightCheck::preflightCheck(&_mavlink_log_pub, _status, _status_flags, true, true,
PreFlightCheck::preflightCheck(&_mavlink_log_pub, _status, _status_flags, true, false,
hrt_elapsed_time(&_boot_timestamp));
}
}