Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter reset when vehicle is idle for too long #16314

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions libraries/AP_NavEKF3/AP_NavEKF3_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,27 @@ void NavEKF3_core::UpdateFilter(bool predict)

// Wind output forward from the fusion to output time horizon
calcOutputStates();

/*
this is a check to cope with a vehicle sitting idle on the
ground and getting over-confident of the state. The symptoms
would be "gyros still settling" when the user tries to arm. In
that state the EKF can't recover, so we do a hard reset and let
it try again.
*/
if (filterStatus.value != 0) {
last_filter_ok_ms = dal.millis();
}
if (filterStatus.value == 0 &&
last_filter_ok_ms != 0 &&
dal.millis() - last_filter_ok_ms > 5000 &&
!dal.get_armed()) {
// we've been unhealthy for 5 seconds after being healthy, reset the filter
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "EKF3 IMU%u forced reset",(unsigned)imu_index);
last_filter_ok_ms = 0;
statesInitialised = false;
InitialiseFilterBootstrap();
}
}

void NavEKF3_core::correctDeltaAngle(Vector3f &delAng, float delAngDT, uint8_t gyro_index)
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_NavEKF3/AP_NavEKF3_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,9 @@ class NavEKF3_core : public NavEKF_core_common

// timing statistics
struct ekf_timing timing;

// when was attitude filter status last non-zero?
uint32_t last_filter_ok_ms;

// should we assume zero sideslip?
bool assume_zero_sideslip(void) const;
Expand Down