Android Orientation Sensor

  • Thread starter Lawrence D'Oliveiro
  • Start date
L

Lawrence D'Oliveiro

This one’s an odd one. The values it returns are three angles in degrees:
and azimuth, an elevation, and a “rollâ€.

I thought this might be based off a gyroscope of some sort, but no, it seems
it’s computed from the magnetic field sensor detecting magnetic north,
adjusted by the geomagnetic model
<http://developer.android.com/reference/android/hardware/GeomagneticField.html>,
presumably using my last GPS fix for the location.

So azimuth is rotation around a vertical axis from true north, while
elevation is also measured from the direction to true north. The “rollâ€
value seems to be trying to detect tilting of the phone around its long
axis, but the values only go up to ±90° before decreasing in magnitude
again. So it’s not a full-circle angle.

The documentation for the sensor data
<http://developer.android.com/reference/android/hardware/SensorEvent.html>
says

Note: This sensor type exists for legacy reasons, please use
getRotationMatrix() in conjunction with remapCoordinateSystem() and
getOrientation() to compute these values instead.

Trouble is, none of those API calls mentioned actually reads any sensor
values
<http://developer.android.com/reference/android/hardware/SensorManager.html>,
they only perform computations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top