EKF: Ensure yaw gets reset when declination is set

This commit is contained in:
Paul Riseborough
2018-11-15 07:16:31 +11:00
committed by Paul Riseborough
parent 68a3cbc368
commit 4657a9cd21
4 changed files with 53 additions and 39 deletions
+2
View File
@@ -79,6 +79,8 @@ bool Ekf::collect_gps(uint64_t time_usec, struct gps_message *gps)
_last_gps_origin_time_us = _time_last_imu;
// set the magnetic declination returned by the geo library using the current GPS position
_mag_declination_gps = math::radians(get_mag_declination(lat, lon));
// request a reset of the yaw using the new declination
_mag_yaw_reset_req = true;
// save the horizontal and vertical position uncertainty of the origin
_gps_origin_eph = gps->eph;
_gps_origin_epv = gps->epv;