1

I am currently trying to understand the sensor values I get from code similar to this. The yaw/azimuth value seems to be okay. The problem is the pitch value, because I get -90° when the device is upright and tilting back and forward lead to the same values. Lets say i tilt by 45° forward - the value is -45°, so its the same like tilting the device 45° backward. Like this I cannot determine the device pitch in 360°. Can somebody help me with that?

Community
  • 1
  • 1
intA
  • 497
  • 2
  • 10
  • 23

1 Answers1

0

Taken from http://developer.android.com/reference/android/hardware/SensorListener.html:

All values are angles in degrees.

values[0]: Azimuth, rotation around the Z axis (0<=azimuth<360). 0 = North, 90 = East, 180 = South, 270 = West

values[1]: Pitch, rotation around X axis (-180<=pitch<=180), with positive values when the z-axis moves toward the y-axis.

values[2]: Roll, rotation around Y axis (-90<=roll<=90), with positive values when the z-axis moves toward the x-axis.

Note that this definition of yaw, pitch and roll is different from the traditional definition used in aviation where the X axis is along the long side of the plane (tail to nose).

So Pitch -180° - 180° instead of 0° - 360°. The difference is forward shows -45° and backward should show 45°, right?

Community
  • 1
  • 1
TryTryAgain
  • 7,632
  • 11
  • 46
  • 82
  • Thanks TryTryAgain! The problem is, that forward and backwards it shows -45°, so there is no difference. – intA Dec 30 '11 at 11:14
  • What values do you get when going around in a complete 360°? Does it ever show you the positive side of 180? – TryTryAgain Dec 30 '11 at 11:33
  • Yes there are positive values. Up = -90°, Up 45° forward = -45°, Up 45° backward = -45°, Down = 90°, Down 45° forward = 45°, Down 45° backward = 45°. Hope this is clearly written ;-) So there is noch 180 degree... – intA Dec 30 '11 at 11:40