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


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

Android Orientation Sensor

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!not-for-mail
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 Sat, 02 Apr 2011 15:56:42 +1300
Organization Geek Central
Lines 29
Message-ID <in639a$p2v$1@lust.ihug.co.nz> (permalink)
NNTP-Posting-Host 118-92-92-183.dsl.dyn.ihug.co.nz
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace lust.ihug.co.nz 1301713003 25695 118.92.92.183 (2 Apr 2011 02:56:43 GMT)
X-Complaints-To abuse@ihug.co.nz
NNTP-Posting-Date Sat, 2 Apr 2011 02:56:43 +0000 (UTC)
User-Agent KNode/4.4.7
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2713

Followups directed to: comp.lang.java.programmer

Show key headers only | 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