Question

My question is probably very simple but it could also be the case that I am completely wrong - therefore I decided to ask. In the end I will calculate my phone's orientation with the help of data from the gyroscope sensor. I know that I should use something like Kalman filter or complementary filter to cope with gyro drift. I will do this in a second step but the problem I am asking here is the same for both approaches. So, the real question is the following:

From the gyroscope I only get angular changes (after integration). So what I need is some initial value, I can add the currently measured change to. But how do I get this starting point? Do I use accelerometer and magnetometer to determine the phone's orientation? Or this there any better way?

If it matters, I use Android for this and have an implementation to determine the phone's orientation with the help of accelerometer and magnetometer but it is very inaccurate.

Was it helpful?

Solution

Use an arbitrary orientation as inital oritentation.

Any reasonable filter has to recover from that and quickly converge to the actual orientation.

I used the filter described in the Direction Cosine Matrix IMU: Theory. I took care of the integral windup by bounding the TotalCorrection (page 27). Works like a charm!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top