mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 04:43:34 +08:00
EKF: Fix bug causing large yaw innovations when GPS is lost
This commit is contained in:
committed by
Lorenz Meier
parent
f59cd0f5b0
commit
adb4a09beb
+3
-1
@@ -629,7 +629,7 @@ void Ekf::fuseHeading()
|
||||
// Vehicle is at rest so use the last moving prediciton as an observation
|
||||
// to prevent the heading from drifting and to enable yaw gyro bias learning
|
||||
// before takeoff.
|
||||
if (!_vehicle_at_rest_prev) {
|
||||
if (!_vehicle_at_rest_prev || !_mag_use_inhibit_prev) {
|
||||
_last_static_yaw = predicted_hdg;
|
||||
_vehicle_at_rest_prev = true;
|
||||
}
|
||||
@@ -639,7 +639,9 @@ void Ekf::fuseHeading()
|
||||
}
|
||||
} else {
|
||||
_heading_innov = predicted_hdg - measured_hdg;
|
||||
_last_static_yaw = predicted_hdg;
|
||||
}
|
||||
_mag_use_inhibit_prev = _mag_use_inhibit;
|
||||
|
||||
// wrap the innovation to the interval between +-pi
|
||||
_heading_innov = wrap_pi(_heading_innov);
|
||||
|
||||
Reference in New Issue
Block a user