Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #2713

Android Orientation Sensor

From Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand>
Newsgroups comp.lang.java.programmer
Subject Android Orientation Sensor
Followup-To comp.lang.java.programmer
Date 2011-04-02 15:56 +1300
Organization Geek Central
Message-ID <in639a$p2v$1@lust.ihug.co.nz> (permalink)

Followups directed to: comp.lang.java.programmer

Show all headers | View raw


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.

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Android Orientation Sensor Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-04-02 15:56 +1300
  Re: Android Orientation Sensor Patricia Shanahan <pats@acm.org> - 2011-04-01 20:30 -0700

csiph-web