mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:08:52 +08:00
ekf2: mag_3d check mag bias variance before allowed to update all states (orientation)
This commit is contained in:
@@ -452,9 +452,11 @@ void Ekf::runMagAndMagDeclFusions(const Vector3f &mag)
|
||||
|
||||
void Ekf::run3DMagAndDeclFusions(const Vector3f &mag)
|
||||
{
|
||||
// For the first few seconds after in-flight alignment we allow the magnetic field state estimates to stabilise
|
||||
// before they are used to constrain heading drift
|
||||
const bool update_all_states = ((_time_delayed_us - _flt_mag_align_start_time) > (uint64_t)5e6);
|
||||
// sanity check mag_B before they are used to constrain heading drift
|
||||
const Vector3f mag_bias_var = P.slice<3, 3>(19, 19).diag();
|
||||
const bool mag_bias_var_good = (mag_bias_var.min() > 0.f) && (mag_bias_var.max() < sq(0.02f));
|
||||
|
||||
const bool update_all_states = _control_status.flags.mag_aligned_in_flight && mag_bias_var_good;
|
||||
|
||||
if (!_mag_decl_cov_reset) {
|
||||
// After any magnetic field covariance reset event the earth field state
|
||||
|
||||
Reference in New Issue
Block a user