How to get the initial orientation for calculations using a gyroscope?

My question is probably very simple, but it may be that I am completely wrong, so I decided to ask. In the end, I will calculate my phone orientation using the data from the gyro sensor. I know that I should use something like a Kalman filter or an additional filter to deal with the gyro drift. I will do this in the second step, but the problem I ask here is the same for both approaches. So the real question is this:

From the gyroscope, I get only angular changes (after integration). So I need some initial value, I can add the current measured change. But how do I get this starting point? Do I use an accelerometer and magnetometer to determine the orientation of the phone? Or is this the best way?

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

+4
source share
1 answer

Use an arbitrary orientation as the initial orientation.

Any reasonable filter should recover after this 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 shutdown by restricting TotalCorrection (p. 27). It works like a charm!

+1
source

Source: https://habr.com/ru/post/1391170/


All Articles