I'm going to presume you don't care about where the origin of the
world coordinate system is, but rather, you want to rotate the
coordinates to make it independent of phone orientation.

Even if you do care, it's the first step, anyway!

The key thing to realize is that you have two references available:
gravity, and the magnetic field. Over nearly all the earth's surface,
these are nearly orthogonal. (You don't need them to be actually
orthogonal, but if they're nearly aligned, they aren't useful).

Let's consider that you start up, and find the sensors give you a
total acceleration vector with magnitude of 10.8 m/s^2.

That is not enough to tell you exactly what your acceleration is --
but it does set some bounds on it. You could be accelerating straight
up at 1.0 m/s^2, adding to the acceleration of gravity. You could be
in free-fall, with a rocket propelling you at 10.8 m/s^2. Or you could
be in a power dive at 20.6 m/s^2 The possibilities form a spherical
surface in a configuration subspace, where phone orientation and
device acceleration combine to give an observation of 10.8 m/s^2.

But now combine that with future observations, and make some
reasonable assumptions. Assume a maximum velocity, for example. And a
maximum rate of rotation. If you tie your phone to a stick, and put
the stick on a motor, and rotate it so it experiences a constant 10.8
m/s^2, the magnetic field will be observed to rotate around the
device.  This is enough to constrain the situation! The intersection
of each of the configuration spaces INCLUDING the magnetic fields
being aligned in the same direction, will give you the down direction,
and the magnetic field direction, which establishes the phone's
coordinate system's rotation from the world coordinate system.

That assumes a continuous set of observations. Of course, we have a
series of discrete observations; that's where the assumptions of a
maximum velocity, a maximum peak acceleration (no fair using a
baseball bat!), and a maximum rate of rotation come in. The latter two
basically allow us to act as if we had continuous data.

The "maximum velocity" one is a bit trickier. You could be on an jet
aircraft, for example. But do you care about the aircraft speed? Or,
if it is at rest on your tray table, do you want the velocity to be
zero?

If the acceleration magnitude is 9.8 m/s^2 for an extended period with
low low-frequency noise, you may want to consider that you are
effectively at rest (on a vibrating surface), rather than at 800 km/s
on an airplane.

This is a whole lot easier (and more accurate) if your phone includes
rate gyros!

On Jan 7, 4:19 pm, Moustafa <m.alzan...@gmail.com> wrote:
> Hi All,
>
> I've been working in an Android project that makes use of
> accelerometer values.
>
> However the output of accelerometer is defined in terms of the phone's
> coordinate system. but I need them to be in the world's coordinate
> system ,,
>
> does any body know a method to convert the output values of
> acceleometer to be in terms of the world's coordinates ?
>
> Regards,
>
> Moustafa

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to