Question

I've been testing sensor data on Android and I noticed weird behavior when phones screen is pointing toward gravity (upside-down). When I obtained data from TYPE_ORIENTATION sensor azimuth is having wrong values and minor shifts causes major changes. Is it somehow related with Euler's rotation representation and numerical singularity? Is there any workaround to have correct compass azimuth values even though phone is upside down?

Was it helpful?

Solution

It looks like this is a normal behaviour and is related to the last z-axis component called magnetic inclination. x-axis component is what typical compass shows and point toward the north pole. X and Y components are much smaller than Z component that's why when device is rotated this component is projected to device x and y-axis yielding wrong results.

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