-
Notifications
You must be signed in to change notification settings - Fork 157
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
DMP_FEATURE_SEND_RAW_GYRO is not catered for in dmp_read #13
Comments
Thank you very much for your suggestion. We will start to reproduce this bug and reply to you within a week. |
Hello, we did reproduce your feedback. According to the official instructions of TDK,DMP_FEATURE_SEND_RAW_GYRO and DMP_FEATURE_SEND_CAL_GYRO are mutually exclusive, DMP_FEATURE_LP_QUAT and DMP_FEATURE_6X_LP_QUAT are also mutually exclusive. We will add the check of mutually exclusive parameters. Thank you very much for your suggestion. |
hi @hepingood, The MPU6050 lack of docs drives me mad :). But yes, that was my reading of the docs too.... Question: For calibration, there is a doc The document is not incorrect as such, but it does not describe an accurate way to determine the offsets to write to the hardware registers, or exactly what the hardware registers do. The code in the document simply does not work well.... In the Arduino driver, the 'adjust' these hardware offsets using a PID loop, and this is one way of overcoming the shortcoming of the document. Read on to understand why a PID loop works... The reason the document's approach to determining the offsets is incorrect is that MEASURED offsets have been scaled AFTER they have had the hardware offset applied. The simple scheme to set the HW offsets correctly is to MEASURE the hardware scaling for acceleration X,Y,Z first, then measure the current offsets, then scale these offsets by the measured scale, and adjust the hardware offsets appropriately. I do this by: Using this method, the hardware offset registers can be set relatively accurately, and from then on, the DMP will receive raw acceleration values close to 'zero'. The advantage here is that although the DMP ALSO has acc offset values which can be set the raw acceleration offsets output in the DMP fifo are not adjusted by the DMP offset values :(. These hardware offsets could be stored and restored every boot. I assume that they should only change if the device is subjected to shock. However, considering that my factory offsets for Z result in an output of 0.3g, either invensense do a bad job of factory calibration, or they may change more frequently. There is a hint somewhere of 'fine tune scale' registers (0-3?) but I have not played with those yet. If you are using the MPU6050 in production, I hope the above is interesting and useful... best regards, |
Thank you very much. |
it gets better.... You can read the fine tune registers, and so do not need to measure the scale factor (assuming fine scale scaling it is the same for every device). This means you only need to take one set of average readings to calibrate, multiply the differences you want to apply by the factory scale (read from the fine tune registers), and bingo, the calibration is perfect. But note the notes on gyro scale and orientation. Using the gyro offsets is great if your device will primarily be in one orientation... but if using in all orientations, a much more complex calibration scheme may be beneficial for gyro values. |
Thank you very much. We will carefully study your research and improve the MPU6050 driver in the next routine update. |
Version
latest?
Describe the bug
ok, odd one, because I reporting this based on a javascript port that I am doing.
So please test to see if you can reproduce.
If you set DMP_FEATURE_SEND_RAW_GYRO without DMP_FEATURE_SEND_CAL_GYRO, the dmp sends 8 + 6 bytes rather than 6 bytes of gyro data. Then dmp_read has a incorrect packet length and data postions.
e.g. data out for
is
20 00 00 00 12 ec ef 17
+ff af 00 0d ff d6
+00 00 00 02
If you add DMP_FEATURE_SEND_CAL_GYRO, then it reverts to 6 bytes only
ff af 00 0d ff d6
+00 00 00 02
.Suggest:
and reading the 8 bytes first.
I do not know the nature of the 8 bytes..... and I do not know if this is an issue in the C driver.
Reproduce
run the dmp example, and ask for DMP_FEATURE_SEND_RAW_GYRO without DMP_FEATURE_SEND_CAL_GYRO.
Data output may be incorrect. (check fifo size is a multiple of expected packet size, if not then there is an issue).
Expected behavior
calculated packet size in dmp_read should be correct, and data read from the right packet loactions.
Additional context
I have been porting the driver to Javascript using pigpio-client to drive the i2c, and came across this issue whilst trying to understand calibration, hence why the code above is not C :).
The text was updated successfully, but these errors were encountered: