Re: Gyroscope/DeviceMotion events

Hi Steve,

On 03/08/2010, at 7:35 PM, Steve Block wrote:

> Dean, In your first email you mentioned that it would be good to use a
> gyro to supply the direction of gravity in the Accelerometer event, to
> allow it to be subtracted from the measured acceleration. We hadn't
> previously considered a gyro but this sounds like a useful addition.
> Are you still keen to add it? It's probably best to add three new
> optional acceleration values to the acceleration event for the actual
> device acceleration (ie without gravity).

Right. Without giving gravity you need to calculate it yourself with a filter on the incoming data. Accelerometers are noisy so you won't get a great result.

iOS 4.0 exposes a fairly complete interface for this on iPhone 4.0 (which is the first model with a gyro). You get a data structure that includes:

- attitude (the device orientation, but not in real world space. You have to save the value and use it as a reference)
- gravity vector
- acceleration in x, y, z
- rotation rate around x, y, z

Each of these are handy in different circumstances. 

I wondered if I should request a way to expose orientation from a reference frame. Real world orientation is useful in some applications (eg. augmented reality) but often you don't need it. For example, a game just wants to know the change in orientation. Then there is the fact that it requires extra work to get the real world orientation in the implementation I'm on :) This could be exposed by a boolean flag on the DeviceOrientation event. But, this isn't a big deal.

Dean

Received on Tuesday, 3 August 2010 10:49:08 UTC