Android implementation of Madgwick sensor fusion algorithm

I tried to port the Sebastian Madgwich ( ) sensor fusion algorithm to Android, but the first results seem to be wrong and the resulting quaternion moves all over the place when the phone is stable. One problem might be that I cannot try three sensors (gyroscope, accelerometer and magnetometer) at the same time, but it looks like the Android sensor manager doesn't allow this. Has anyone succeeded in porting the algorithm with great success? thank you in advance


source to share

1 answer

I haven't implemented this in Android, but I have work on an iPad 2 for an augmented reality app that I'm working on for my thesis. To make it run smoothly, I found that it is best to set the refresh rate for the built-in sensors to a frame rate (so 30Hz for me), but it's probably worth experimenting to see what works best for your device.

I'm not sure exactly what you mean by flying all over the place, but sensor drift will likely cause a noticeable error - my objects slowly rotate randomly when the device is at rest. Very annoying but something you have to accept when using the IMU.

Also, make sure you update the quaternion after you have received a new read from all sensors, instead of each sensor, each new one reads separately.



All Articles