I'm using an Android device to get the heading(azimuth, or yaw angle).
Android API used the Accelerometer value + the mganetic field to compute a matrix rotation, the azimuth is then extracted form that matrix (aka SensorManager.getOrientation(...)) But the result is very inaccurate! especially if the phone is perturbed by some magnetic stuff.
And then I have the Gyroscope, If I integrate the value of the gyro trough time, I'm able to get an actual Angle, but like everybody knows :p, this is subject to drift... after 10 seconds even tough I'm not moving the angle drifted of 10°...
So here I have in one side the result of the accel + magneto, it's quite crap near magnetic field and on the other side I have the result of the gyro that are really good, but drift over time...
So my question is, is there an easy or smart way to combine the two results together to get a kind of "robust" heading estimation? I say easy because I know there is kalman filters.. but even tough i read the theory 50 times I can't get a damn thing :).
Thank you!
When combining 3D accelerometers and 3D gyroscopes, the complementary (or Kalman) filter initially uses the gyroscope for precision as it is not vulnerable to external forces. Long term the accelerometer data is used because it does not drift. These values are integrated over time.
Uses of a gyroscope or accelerometer The main difference between the two devices is simple: one can sense rotation, whereas the other cannot. In a way, the accelerometer can gauge the orientation of a stationary item with relation to Earth's surface.
Accelerometer Versus GyroscopeAccelerometers measure linear acceleration (specified in mV/g) along one or several axis. A gyroscope measures angular velocity (specified in mV/deg/s). If we take our accelerometer and impose a rotation to it (i.e., a roll) (Figure 8), the distances d1 and d2 will not change.
3-axis gyroscopes measure angular rate and are usually combined with an accelerometer in a common package to allow advanced algorithms like sensor fusion (for orientation estimation in 3D space).
Gyroscopes measure angular velocity, how fast something is spinning about an axis. If you're trying to monitor the orientation of an object in motion, an accelerometer may not give you enough information to know exactly how it's oriented.
As far as I know, either the Kalman filter or something similar is implemented in the SensorManager. Check out Sensor Fusion on Android Devices: A Revolution in Motion Processing.
You are trying to solve a problem that is already solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With