Pregunta

Which sensor is needed to make an app where an arrow on the display is always pointing to the ground? My app is always in landscape. Ive tried to use the Orientation sensor but it only works if Im holding my smartphone in portrait mode. The more I move my device to landscape values become instable und doesnt point to the ground anymore. To be more specific, in portrait mode I can use y-axis (roll) to find out the angle, but the more Im rotating my device to landscape mode it doesnt work anymore with the y-axis.

Maybe its the wrong sensor or its a question of some trigonometry functions?

Any ideas? Please help me.

¿Fue útil?

Solución

Ive found the solution.

The problem described is also known as Gimbbal Lock. See here and here.

For me the solution can be found here and is the trivial sentence:

Using the camera (Y axis along the camera's axis) for an augmented reality application where the rotation angles are needed: remapCoordinateSystem(inR, AXIS_X, AXIS_Z, outR);

This way I can do what I want to do because the Gimbbal Lock is lying in a position where it doesnt argue me.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top