Browse Source

AP_AHRS: fixed wrapping bug in GPS based heading error

this bug could cause the GPS based yaw to use an expensive reset far
too often
mission-4.1.18
Andrew Tridgell 11 years ago
parent
commit
a7931b1581
  1. 2
      libraries/AP_AHRS/AP_AHRS_DCM.cpp

2
libraries/AP_AHRS/AP_AHRS_DCM.cpp

@ -367,7 +367,7 @@ AP_AHRS_DCM::drift_correction_yaw(void) @@ -367,7 +367,7 @@ AP_AHRS_DCM::drift_correction_yaw(void)
_gps_last_update = _gps->last_fix_time;
new_value = true;
float gps_course_rad = ToRad(_gps->ground_course_cd * 0.01f);
float yaw_error_rad = gps_course_rad - yaw;
float yaw_error_rad = wrap_PI(gps_course_rad - yaw);
yaw_error = sinf(yaw_error_rad);
/* reset yaw to match GPS heading under any of the

Loading…
Cancel
Save