-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Mag cal: automatically disable internal mags if external ones are available #24316
Conversation
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 152 byte (0.01 %)]
px4_fmu-v6x [Total VM Diff: 144 byte (0.01 %)]
Updated: 2025-02-14T14:54:14 |
src/modules/sensors/vehicle_magnetometer/VehicleMagnetometer.cpp
Outdated
Show resolved
Hide resolved
Nice idea, I just wonder if we should do something basic to validate the external is alive and "good"? |
@bresch This will require docs update. The whole calibration doc will need some minor work, but in particular we will need to update https://docs.px4.io/main/en/config/compass.html#additional-calibration-configuration and the sub topic on disabling a compass My assumption is that if the internal compass is disabled after calibration it is still calibrated. So the section would change from "Disable a Compass" to "Re-enable a compass" and include explanation that often this is worse than nothing so explain when/why you would do it. |
This makes sense, I think many users already disable the internal mag after calibration anyway. The cherry on top would be a sensor status tab in QGC Vehicle page. Right now it's not obvious to users what sensors are enabled, functional, and which calibration parameters corresponds to which device. |
5458fda
to
ae31c14
Compare
oh yes, that could be nice to have
Yes, if QGC could show you something like "Mag 1 (external): IST8310" and the calibration values. |
sys_has_mag defines the required number of mags; if one mag is needed, it can be any instance, not necessarily mag 0
fadeba9
to
d7e3a81
Compare
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.
Code looks clean and I bench tested it a bit.
Solved Problem
Magnetometers inside the autopilot are almost always highly affected by varying magnetic fields generated by the drone due to their location inside the drone.
The internal mag is useful for initial autopilot bench testing, before it gets integrated inside a drone, and when performing the calibration of the external one to automatically detect the rotation parameter. However, it then only causes issues as it often triggers false warnings (mag inconsistency) and in case of an in-air failure of the external mag, a fallback to the internal mag can lead to worse performance than not using a mag at all.
Solution
Automatically disable all internal mags just after calibration if an external one is available.
Changelog Entry
For release notes:
Test coverage
Bench tested