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
This commit is contained in:
Andrew Tridgell 2013-11-04 13:57:51 +11:00
parent 17b27a47de
commit a7931b1581
1 changed files with 1 additions and 1 deletions

View File

@ -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