-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 magnetometer fusion and add mag_type "init" #3532
Conversation
6607e2e
to
f5bc1a4
Compare
No flaws found |
|
||
- The magnetometer **biases** are only observable while the drone is rotating | ||
- The true heading is observable when the vehicle is accelerating (linear acceleration) while absolute position or velocity measurements are fused (e.g. GPS). | ||
This means that magnetometer heading measurements are optional after initialization if those conditions are met often enough to constrain the heading drift (caused by gyro bias). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that we can get heading from GPS-measured position/velocity when moving so we don't need magnetometer readings when moving, as long as we're getting enough info to constrain the heading drift - right. Presumably there might be some drift when we stop in position?
When you say "optional after initialization" do you mean "before arming"? I mean, why do we need them on initialization/or does the measurement matter until we're ready to fly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably there might be some drift when we stop in position?
Yes, the heading can drift if you hover in place but usually there are enough disturbances to always provide the tiny bit of motion required to constrain the heading drift. Also, when the position controller is active, an incorrect heading makes the drone "toilet bowl", which makes the heading observable, so unless really unlucky, the heading cannot really drift away by a lot without causing disturbances that makes the heading observable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you say "optional after initialization" do you mean "before arming"? I mean, why do we need them on initialization/or does the measurement matter until we're ready to fly?
We often just need the magnetometer to align the heading and start fusing GNSS. So even before arming, if the drone is not moving, the heading won't change and the drift is really low, and if it's moving the heading is observable so we don't need a mag at all to constrain the drift
|
||
The following selection tree can be used to select the right option: | ||
|
||
![EKF mag type selection tree](../../assets/config/ekf/ekf_mag_type_selection_tree.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, Images are best in-tree (done). I also ran prettier and fixed a few typos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, good to know, thanks!
@bresch Did this go into PX4 v1.15 or main? I want to add a release note for this. Looks great. A few questions mostly FMI here https://github.com/PX4/PX4-user_guide/pull/3532/files#r1926316422 but I'm going to merge. |
That feature was merged after 1.15 |
Mag type "init" was added in PX4/PX4-Autopilot#23185 but documentation was missing