Skip to content

Commit

Permalink
mag_fusion: prevent fusing default value of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
bresch committed Jul 23, 2021
1 parent b747307 commit 698c2aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/ekf2/EKF/mag_fusion.cpp
Expand Up @@ -781,6 +781,11 @@ void Ekf::fuseHeading()
// Vehicle is at rest so use the last moving prediction as an observation
// to prevent the heading from drifting and to enable yaw gyro bias learning
// before takeoff.

if (fabsf(_last_static_yaw) < 1e-6f) {
_last_static_yaw = predicted_hdg;
}

measured_hdg = _last_static_yaw;

}
Expand Down Expand Up @@ -836,6 +841,11 @@ void Ekf::fuseHeading()
// Vehicle is at rest so use the last moving prediction as an observation
// to prevent the heading from drifting and to enable yaw gyro bias learning
// before takeoff.

if (fabsf(_last_static_yaw) < 1e-6f) {
_last_static_yaw = predicted_hdg;
}

measured_hdg = _last_static_yaw;

}
Expand Down

0 comments on commit 698c2aa

Please sign in to comment.