1

The AppleDeveloper guide seem to imply that UIAccelerationValue can range between a double value of -1.0 and +1.0.

I have logged the values from a real device whilst "shaking" with crazy gestures my iPod touch and got x values above 2.0 (e.g. +2.1, -2.1) and NO y value above 2.0f.

  • Could anyone explain this?
  • Has anyone identified the MAX and MIN values for UIAccelerationValue?

My take on this is that Apple has implemented some algorithm that approximates the force of gravity and takes as 1.0 values that are above a standard speed approximation (e.g. have values 9.8 m/s of speed).

  • Any other guesses?
mm24
  • 9,280
  • 12
  • 75
  • 170
  • You may be misunderstanding a part of the documentation. Nowhere does is say that the value ranges between -1.0. and 1.0, as far as I can see. – Matt Gibson Apr 15 '13 at 15:28

1 Answers1

3

You may be misunderstanding a part of the documentation. Nowhere does it say that the value ranges between -1.0. and 1.0, as far as I can see. It says that:

The device accelerometer reports values for each axis in units of g-force, where a value of 1.0 represents acceleration of about +1 g along a given axis. When a device is laying still with its back on a horizontal surface, each acceleration event has approximately the following values:

"g" is used in a particular technical sense here; 1 g is one standard gravity; a phone accelerating faster than this will register readings higher than 1. Violent shaking in the hand is easily enough to cause acceleration and deceleration values higher than 9.8m/s2.

Matt Gibson
  • 37,886
  • 9
  • 99
  • 128
  • 1
    Cool, thanks for the answer, I hadn't found that piece of documentatin. Good to have confirmation of the range they use. So I can deduce that there are no MAX values as the accelleration can be quiet high (2g, 3g etc..). I was intending to use this to show some HUD graphics to calibrate the controller of a game along the x and y axis. – mm24 Apr 15 '13 at 15:40
  • 2
    Yup, indeed: the maximum values may even be dependent on the accelerometer hardware. Of course, if your iPhone ever registers a significantly high g, the chances are good it'll be too broken by the impact to report the value :D. You may also want to look into using a low-pass filter algorithm to "clean up" the values by filtering out sudden motions -- see perhaps [this question and its answers](http://stackoverflow.com/questions/6942626/accelerometer-low-pass-filtering). – Matt Gibson Apr 15 '13 at 15:48
  • very useful comment. I was using a rudimental filter by allowing the user to set the sensitivity of the accellerometer (by default "change if value is >0.5f" ). Do you have any suggestion for calibrating the values at level start? I am currently allowing the user to do so by setting a UIAccelerometer value and making the difference with the current UIAccellerometer input.. – mm24 Apr 15 '13 at 21:17