I know similar questions have been asked before, but I have researched for hours now and have not been able to find a viable solution.

I have a Raspberry Pi 4 and the Adafruit LSM9DS1 IMU, which has a gyroscope, an accelerometer, and a magnetometer. I am trying to build a VR headset and find the 3D orientation of the IMU. What would be the best way (simplicity, lack of complicated math, and performance wise) to correct for gyroscopic drift using sensor fusion? I barely have any knowledge of quaternions, so a solution with Euler angles would be preferred.


1 Answer 1


I can propose you two solutions to solve your problem:

  • The first one is a not easy to implement with a MEMS but it works: A Kalman filter (maybe more a Extended Kalman filter for navigation). The advantage of this method is that it can gives you the covariance for each state of your model. The disavantage is that you need to implement the model of the sensor (MEMS). You can find models on internet relative to your sensor.
  • The second possible solution is called 'complementary filter'. The goal of this filter is to 'estimate' (even if there are no covariances about the data compared to the Kalman Filter) the angles with the gyro data and the accelerometers data. It is easy to implement but less precise compared to a Kalman Filter in my opinion. You will find below an article dealing with it, plus a github with it. https://www.researchgate.net/publication/336208125_A_Fast_and_Robust_Algorithm_for_Orientation_Estimation_using_Inertial_Sensors

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.