All around 360 compensation
expilu opened this issue · 1 comments
Can TiltCompensationUtil be used to get a stabilized compass heading no matter what is the current device orientation? How?
Something like this app does: https://play.google.com/store/apps/details?id=fi.finwe.gyrocompas
Yes, in the trivial case you can do something like:
compensateTilt(magnetic, getRotationFromAcceleration(acceleration));
You can also use one of the orientation sensors fusions with the caveat that the base orientation of the sensor fusion must be oriented with the direction of the device you are trying to measure (this is 'built in' to the acceleration sensor because the sensors are physically mounted. A gyroscope can measure orientation from any arbitrary base orientation). If you assume the heading should come from the positive Y axis of the device, you can look at CompassExplorer. Please note that the project is still a work in progress. You will want to set the 'calibrated' flag to 'false'.
If you are trying to compensate for tilt under dynamic conditions (say a vehicle that is accelerating in some arbitrary direction) you are going to put a lot of consideration into how your sensor fusion is constructed.