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.
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.