Skip to content

MAGFit: add GSF and GPS yaw attitude sources - #372

Open
j-w9 wants to merge 1 commit into
ArduPilot:mainfrom
j-w9:magfit-gsf-gps-yaw
Open

j-w9 wants to merge 1 commit into
ArduPilot:mainfrom
j-w9:magfit-gsf-gps-yaw

Conversation

@j-w9

@j-w9 j-w9 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

"Option to use GSF and GPS yaw as truth" from #81.

New attitude sources: EKF3 roll and pitch with yaw from the GSF yaw estimator (XKY0.YC), or from any GPS instance that logs yaw (GPS.Yaw, which is logged as 0 when there is none). Neither uses the compass.

  • GSF samples are used when YCS is under the EKF's own reset threshold, GSF_YAW_ACCURACY_THRESHOLD_DEG (15 deg). YCS is logged as sqrt(degrees(variance)), so the threshold is converted to match (about 1.98).
  • The new attitude is built at the EKF quaternion times with interpolated yaw. Samples with more than 1 s between valid yaw samples are skipped.
  • These sources only cover part of the flight, so selecting one limits the analysis time to that range rather than changing the fit code.
  • The sources only appear when the log has valid data, and the default selection is unchanged. Default fits are identical to main on four logs.

Tested on a SITL flight with an NMEA GPS emitting HDT (GPS1_TYPE 5, SIM_GPS1_TYPE 5, SIM_GPS1_HDG 1), flying a square and full yaw turns. Mean yaw difference from ATT: GSF 5.6 deg, GPS 2.2 deg. Offsets with EKF / GSF / GPS yaw: (3.0, 16.9, -17.7) / (4.2, 14.9, -17.6) / (3.1, 14.3, -17.5).

Attitude sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant