-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor mag heading into mag 3D fusion #22927
Conversation
I've recently found this repo and have been reading the code and playing with symforce (what a nice and powerful tool). Out of curiosity, what's prompting you to modify your Jacobian computations in this PR to use the chain rule (as Sola describes), as opposed to the default symforce tangent space Jacobian in your original implementation? |
Hi @laughlinbarker , the reason why I used the chain rule (instead of the first order approximation done in SymForce) is because I changed the angular error to be a "global error" (before was a "local error").
This means that the measurement jacobians are also different and to see if everything worked as expected I quickly implemented the chain rule for global errors (as described by Sola) instead of the first order approximation method because it was simpler. I also tried to chain the "local error jacobian" obtained by SymForce with the transpose of the rotation matrix (because I still want to try to implement the first order approximation for global errors as it should produce less code, but this could just be an optimization that can be done later (the result is numerically the same). I'm not against a bit of help, so if you want to try to do it, please either share your results here, open a PR against this one or contact me on the Dronecode Discord server (my name is FYI, this is how the Jacobians using first order approximations are computed in SymForce: https://github.com/symforce-org/symforce/blob/f04f31141f5573f31aa8bbbf0d800264f023b04f/symforce/jacobian_helpers.py#L34 |
14d21c6
to
21ed9c4
Compare
b6fb3b0
to
a7e3a26
Compare
Starting with no yaw uncertainty makes the tilt more observable when using fake position fusion during the quasi-stationary alignment phase.
This prevents over-constraining the heading from mag fusion. An incorrect mag yaw rotation can be absorbed as a declination error.
Declination fusion is only used when not observable (no global aiding).
a7e3a26
to
3a5ff7f
Compare
Solved Problem
In its current form, mag heading fusion is made by fusing a yaw measurement based on magnetic data. The issues with that approach are:
Solution
Heading fusion can be achieved by inhibiting the effect of the fusion on the attitude to only affect the rotation around the vertical axis (NED frame). To do this, I first needed to re-define the quaternion error as a small perturbation in the NED frame (aka: global angular error) instead of in the body frame (aka: local angular error). This allows us to use the exact same fusion process as "mag 3D" and inhibit its effect on the tilt estimate by zeroing the two first elements of the Kalman gain. Note that this is only possible because we're using the Joseph stabilized update.
I haven't yet found how to derive the measurement jacobians using first order retractions (as done in SymForce for local errors). The current version is using a chain rule method that produces a bit more auto-code.
TODO:
Future work:
Changelog Entry
For release notes: