-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Add magnetometer thermal calibration/compensation. #20288
Conversation
e4851a6
to
04738bf
Compare
Overall this looks good, but I really don't think we should be plumbing in random baro temperature in a magnetometer driver just for a temperature. Should we do something to make the temperature source configurable (at the level of the compensation)? |
Yes. Good suggestion. I'll work on that. Thanks @dagar ! |
cd78776
to
e41657b
Compare
e41657b
to
dca707a
Compare
f65e155
to
ceaad12
Compare
9756c83
to
5fc80d2
Compare
Overall looks fine, but I do have a few suggestions for later
|
ad0f639
to
a7045e5
Compare
@dagar , comments addressed, thank you! Squashed and rebased. |
a7045e5
to
860315d
Compare
f3f0cc0
to
ff1859b
Compare
ff1859b
to
0bf5cab
Compare
e58d38a
to
7ed3b2a
Compare
7ed3b2a
to
cc4db66
Compare
704c5e4
to
d2c3836
Compare
…t do not have valid temperature readings in temperature calibration data, use primary baro for magnetometers without valid temperature.
39cb988
to
52fb5ab
Compare
…wing autotune module from the fmu-v5 test build to meet flash constraints.
52fb5ab
to
3f2bf8e
Compare
@mcsauder When this goes in, we will need to update http://docs.px4.io/main/en/advanced_config/sensor_thermal_calibration.html#thermal-calibration-and-compensation - I assume this will be in the release after PX4 v1.15, and that you will take care of initial update (might be as small as just removing the note up the top of that doc.) |
Describe problem solved by this pull request
This PR extends the thermal compensation to include magnetometers. Sensor ordering following the convention
accel, gyro, mag, baro
is also standardized across files in this PR.Describe your solution
Data taken from an IST8310 magnetometer standard with the pixhawk4 and pixhawk4 mini shows a change in measured values from 0C to 45C by almost ~10uTesla (0.1Gauss). The typical earth magnetic field strength is ~60uTesla, so the observed shift is significant against what is being measured and more significant in areas of the earth with weaker magnetic field strength.
![image](https://user-images.githubusercontent.com/2497951/191872184-0bfe2c8f-9938-47a7-9831-dd947abe2224.png)
Test data / coverage
Flight tested with calibration values applied at ambient (~21C): https://review.px4.io/plot_app?log=6335c430-828b-4f7e-8404-ba7832585ada
After cold soaking to ~7C and temperature climbing to ~17C: https://review.px4.io/plot_app?log=6335c430-828b-4f7e-8404-ba7832585ada
Additional context
Most magnetometers do not have an integrated temperature sensor, so this PR utilizes the primary barometer temperature value as the magnetometer temperature. If there is a better alternative we can certainly use a different source (such as the IMU).
Let me know if you have questions or feedback on this PR. Thanks!
-Mark