Android Sensor Coordinates

  • Thread starter Lawrence D'Oliveiro
  • Start date
L

Lawrence D'Oliveiro

The diagram of the linear sensor coordinate system here
<http://developer.android.com/reference/android/hardware/SensorEvent.html>
seems to be wrong.

I have a test program running on my HTC Desire (Android 2.2), showing me
values from the accelerometer. As it lies horizontally, face-up on my desk,
the Z value is positive (around 9.8, as you would expect). But that diagram
says that positive Z is up, not down.

I tilt the phone to the left, and the X value increases. Tilt to the right,
it decreases. But the diagram says positive X is to the right, not the left.

Tilt it up, the Y value increases. Hold it vertical, with the display upside
down, and the Y value shows negative. Again, completely the opposite to the
diagram.
 
L

Lawrence D'Oliveiro

The device's deviation from free-fall is an acceleration upwards, due to
the upwards force the desk exerts on the device.

That’s a point...
 
B

BGB

The accelerometer is something that measures acceleration, not tilt. You
want an inclinometer if you want to measure tilt.

although...

with the information provided thus far, once could still infer tilt via
the accelerometer...

if one treats the read value as a vector, then one can normalize it, and
have a "this way up" vector.
then, one can look at the X and Y coordinates to know the relative tilt
in each direction.
 
L

Lew

Peter said:
BGB said:
[...]
although...

with the information provided thus far, once could still infer tilt via
the accelerometer...

Absolutely. The information is there. It's just not being presented as such.
If you make an assumption about the accelerometer-equipped device as a whole
not being accelerated, and further assume that it's being used on the surface
of the planet, the constant acceleration due to gravity provides a frame of
reference from which tilt can be inferred from the observed acceleration.

One can even filter the data (similar to seen in the documentation) to attempt
to determine tilt from a device that is in fact being subject to some other
(relatively constant) acceleration.

But, all that inference comes at a price, both computationally and in
precision. There's a reason that the Wiimote, in spite of having a reasonably
accurate three-axis accelerometer, derives partial tilt information from the
IR transmitter bar instead.

Thanks, you guys, for that incredibly interesting and helpful discourse.

Android's as on topic as anything else about Java in this group, AFAICS,
besides which the algorithmic insights are universal and unquestionably of use
to the Java programmer.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top