AnsweredAssumed Answered

6DOF GY KALMAN Yaw drift

Question asked by Carlos Fernando on Sep 17, 2015

First after all I want to thank you for making open source such a complete and optimized sensor fusion library.



I am running on a MCU (without an RTOS) your sensor fusion library, utilizing an accelerometer and gyroscope from different vendors. I specifically make use of the fRun_3DOF_G_BASIC and fRun_6DOF_GY_KALMAN functions. I created a program that runs on the PC and displays a 3D cube changing its orientation based on the quaternion orientation  calculated by the MCU and sent to the PC via Wifi.



Using the fRun_3DOF_G_BASIC function the cube behaves correctly but using the fRun_6DOF_GY_KALMAN's a posteriori orientation quaternion "fqPl", the cube behaves strangely on the jaw (z-axis). Initially if we put the sensors still on a table first there is no drift (cube not spinning on the z axis) but as we move it or shake it, even we put the sensors again on the table, the starts spinning very quickly on the z-axis. Then, if we tilt the sensors, the spinning speed gets reduced.


Debugging the code I realized that the element [2][2] of the covariance matrix P+ "fPPlus9x9[9][9]" increases very fast and it decreases when I tilt the sensors.



I'm not an expert in this subject but I guess this constant spinning over the z axis is due to the bias and drift of the gyroscope (which is not calibrated before Kalman) since the accelerometer cannot provide information to compensate the z axis (yaw) when the sensor is parallel to the table. Is this a limitation of 6axis Gyro/Acc Fusion configuration?


Also I wonder if the Kalman Constants (kalman filter noise variances, initialization of Qw covariance matrix, linear acceleration time constant) included in the code pay a role in this problem, since I haven't change them despite using other sensors, since I cannot find similar values on the datasheets.


Thank you very much!