lebarsfa / razor-9dof-ahrs

AHRS Firmware for the SparkFun 9DOF Razor IMU and SparkFun 9DOF Sensor Stick
Other
21 stars 4 forks source link

Gyroscope Calibration Values Always Approximately Zero #1

Closed ssamm95 closed 6 years ago

ssamm95 commented 6 years ago

Hi lebarsfa,

I am using the razor-9dof-ahrs Arduino sketches with the 9DoF Razor IMU M0 from SparkFun, and have encountered a problem when calibrating the gyroscope. I have been following the tutorial, and I am able to successfully calibrate both the accelerator and magnetometer and place these values in the appropriate spot in Razor_AHRS.ino. However, when I try to find gyroscope bias as described in the tutorial, all the values are approximately zero (see below) even after waiting for more than 10 seconds.

....

gyro x,y,z (current/average) = 0.00/-0.00 -0.01/-0.01 0.01/0.01 gyro x,y,z (current/average) = 0.00/-0.00 -0.01/-0.01 0.01/0.01 gyro x,y,z (current/average) = 0.00/-0.00 -0.01/-0.01 0.01/0.01 gyro x,y,z (current/average) = -0.00/-0.00 -0.01/-0.01 0.01/0.01 gyro x,y,z (current/average) = 0.00/-0.00 -0.01/-0.01 0.01/0.01 gyro x,y,z (current/average) = -0.00/-0.00 -0.01/-0.01 0.01/0.01 gyro x,y,z (current/average) = 0.00/-0.00 -0.01/-0.01 0.01/0.01

...

I am not sure why this is happening. Is it possible there is no noise present or detected in my environment? I have two 9DoF Razor IMU M0s and have encountered the same results on both chips, so I don't think the sensor is faulty. The data coming from the IMU is pretty accurate (according to Processing), however, there is a small noticeable drift in yaw. Do you have any suggestions of how this issue can be addressed?

lebarsfa commented 6 years ago

Hello, I did not make extensive tests yet but I remember that I did not see more gyro bias, so I would say that it is because the M0 gyros are maybe significantly better than previous Razor versions and/or they are already factory calibrated (note that the gyros bias that we try to compensate is the one internal to the sensor, assuming that there are no vibrations in the environment)...

About the drift in yaw, this is normal if you disabled the fusion with the magnetometers (DEBUG__NO_DRIFT_CORRECTION set to true), in that case you will get a quite random yaw value after an hour. Otherwise, the drift could be due to a magnetic perturbation in the environment of the device (and that magnetic perturbation was probably not here when the magnetic calibration was made, or the magnetic calibration was made elsewhere).

To try to debug more, you can try to play with the following options : _ DEBUGNO_DRIFTCORRECTION : if set to true, the magnetometers are not used any more, but in that case the yaw will drift significantly after several minutes due to natural gyros drifts. DEBUG__USE_DMPM0 : the M0 has some auto-calibration features, if set to true it seems that when no movement is detected, it can automatically readjust internally the gyro bias estimations, in that case you need to reset to 0 the calibration values that you measured manually, they would be meaningless. DEBUGUSE_ONLY_DMP_M0 : if set to true, the fusion algorithm in the Arduino code is not used any more, the internal M0 algorithm values are used for the pitch and roll, and only the magnetometers are used to estimate the yaw.

But if that yaw drift is always limited to around 2 degrees after an hour, it is probably normal, the M0 is still a low-end AHRS device and if you really need a better accuracy you will probably have to pay more for a better AHRS (see e.g. the accuracy of a 2000-4000€ AHRS : https://www.xsens.com/products/mti-g-710/ or https://www.sbg-systems.com/products/miniature-inertial-systems-overview (which advertises a better accuracy, but this always depends on several conditions) ) or use other techniques...

ssamm95 commented 6 years ago

Yes, you could be correct. Maybe the M0 gyro is quite stable in addition to the factory calibration. I believe the slight drift in yaw could be attributed to a hard-iron error I saw evident in magnetometer calibration. I will try to follow your debugging suggestions and report back with the results.

Thank you so much for your help!