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
QST QMC5883L cleanup/rewrite #14384
QST QMC5883L cleanup/rewrite #14384
Conversation
47f0c27
to
228e0d2
Compare
@rolandash can you comment on the usage of the qmc5883l on the mindpx2? |
You mean in the context of this PR? |
Yes, is it actually used (internally) and how is it mounted? |
Yes the new shipments have changed to QMC5883. It works fine on v1.10.x. However I did not test against this PR yet. |
Bench tested with an mRo GPS unit. With the orientation from the datasheet preserved (X = X) the mRo direction of flight is rotation 10 (ROTATION_ROLL_180_YAW_90), which mag cal auto rotation correctly found and set. INFO [commander] [cal] External Mag: 1 (396809), no rotation change: 0
INFO [commander] [cal] External Mag: 2 (527649), determined rotation: 10
INFO [sensor_calibration] MAG 396825 EN: 1, offset: [-0.035 -0.010 -0.157], scale: [ 0.989 1.000 1.023], Internal
INFO [sensor_calibration] MAG 396809 EN: 1, offset: [ 0.055 0.034 -0.104], scale: [ 0.984 0.998 1.007], External ROT: 0
INFO [sensor_calibration] MAG 527649 EN: 1, offset: [-0.417 -0.055 -0.008], scale: [ 0.976 1.024 1.005], External ROT: 10 INFO [vehicle_magnetometer] selected magnetometer: 396809 (1)
INFO [data_validator] validator: best: 1, prev best: 1, failsafe: NO (0 events)
INFO [data_validator] sensor #0, prio: 50, state: OK
INFO [data_validator] val: 0.1754, lp: 0.1763 mean dev: -0.0005 RMS: 0.0023 conf: 1.0000
INFO [data_validator] val: -0.1402, lp: -0.1385 mean dev: -0.0000 RMS: 0.0014 conf: 1.0000
INFO [data_validator] val: 0.3784, lp: 0.3733 mean dev: -0.0001 RMS: 0.0049 conf: 1.0000
INFO [data_validator] sensor #1, prio: 75, state: OK
INFO [data_validator] val: 0.1694, lp: 0.1681 mean dev: -0.0003 RMS: 0.0019 conf: 1.0000
INFO [data_validator] val: -0.1267, lp: -0.1276 mean dev: -0.0001 RMS: 0.0014 conf: 1.0000
INFO [data_validator] val: 0.3789, lp: 0.3782 mean dev: -0.0011 RMS: 0.0044 conf: 1.0000
INFO [data_validator] sensor #2, prio: 75, state: OK
INFO [data_validator] val: 0.2096, lp: 0.2092 mean dev: 0.0280 RMS: 0.0569 conf: 1.0000
INFO [data_validator] val: -0.1396, lp: -0.1386 mean dev: -0.0403 RMS: 0.0823 conf: 1.0000
INFO [data_validator] val: 0.3942, lp: 0.3971 mean dev: -0.0252 RMS: 0.0512 conf: 1.0000
INFO [sensor_calibration] MAG 396825 EN: 1, offset: [-0.035 -0.010 -0.157], scale: [ 0.989 1.000 1.023], Internal
INFO [sensor_calibration] MAG 396809 EN: 1, offset: [ 0.055 0.034 -0.104], scale: [ 0.984 0.998 1.007], External ROT: 0
INFO [sensor_calibration] MAG 527649 EN: 1, offset: [-0.417 -0.055 -0.008], scale: [ 0.976 1.024 1.005], External ROT: 10 |
@rolandash if you could quickly verify this on a mindracer-v2 we should be good to merge. |
Will this make it to 1.11? I know it says 1.12 but this is a pretty common HMC5883 replacement, we can physically flight test it this week if need be. Have ~10x 1.11 rc3 flight tests with this compass (external) completed already this week so can compare against that if need be. If bench test is only needed, we can do as well. |
No, but we're going to be doing releases much more frequently going forward. Smaller (safer) incremental updates so upgrading isn't such a monumental task. |
I’m a big fan of incremental changes. Will definitely make upgrading easier. Ok. Sounds good. |
Sry @dagar , I just do not have a qmc5883 test unit right now. |
@dagar a quick test shows the qmc5883 driver on latest master gives wrong direction which is 180 degree reverted of true north. I am using a mind racer-v2 with qmc5883. |
Sorry about that, quickly fixed in master. 1984663 |
thank you @dagar , that fixed it. |
@dagar We have met strange behaviour of this driver while migrating from 1.11 to 1.12\1.13. Often Driver regulary sticks for ~400ms. While diving into the code we have discovered that configuration registers values have been changed. Here it is what is in 1.12 - 1.13 - Master code right now: `// CNTL1
};` Looks like this two lines of code is incorrect OSR_512 = Bit7 | Bit6, // 00 This values actually should be equal to 00 and 00, according to datasheet https://datasheet.lcsc.com/szlcsc/QST-QMC5883L-TR_C192585.pdf But "Bit7 | Bit6" means OSR_64 and "Bit5 | Bit4" means "Reserved" |
@MikeCharikov it's maybe a bit unclear, but OSR_512 and RNG_2G are cleared bits. I'll make it more explicit. PX4-Autopilot/src/drivers/magnetometer/qmc5883l/QMC5883L.hpp Lines 108 to 111 in 6ee2d79
I've added some clarification in #21693, can you fix that a try and we'll continue debugging from there? |
Thanks, will try to test it ASAP |
Similar to #14383, this PR is a cleanup/rewrite of the QST QMC5883L driver.
TODO: