EKF: Improve detection of indoor flight condition

This commit is contained in:
Paul Riseborough
2018-06-09 22:23:55 +02:00
committed by Lorenz Meier
parent 565f99254c
commit ea9e8246ed
3 changed files with 9 additions and 4 deletions
+5 -1
View File
@@ -624,11 +624,15 @@ void Ekf::fuseHeading()
// Vehicle is not at rest so fuse a zero innovation and record the
// predicted heading to use as an observation when movement ceases.
_heading_innov = 0.0f;
_last_static_yaw = predicted_hdg;
_vehicle_at_rest_prev = false;
} else {
// 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) {
_last_static_yaw = predicted_hdg;
_vehicle_at_rest_prev = true;
}
_heading_innov = predicted_hdg - _last_static_yaw;
R_YAW = 0.01f;
innov_gate = 5.0f;