Best practices for moving items with accelerometer.

Discussion in 'iOS Programming' started by detz, Oct 10, 2008.

  1. detz macrumors 65816

    Jun 29, 2007
    Anyone play around with this yet, what works best in terms of user experience? Lets take an example of just moving an image around the screen, would it be best to just move the image if the phone was tilted in a direction or would that be a pain to the user to have to hold the phone in that direction?
  2. chrisesposito macrumors member

    Mar 23, 2008
    I'm using the device as a wireless 3D controller for an app running on another system, but the user experience issues have significant overlap with yours, I think.

    One of the things we found we needed was a button that toggled whether or not the iPhone app paid attention to changes in the device's position and orientation. There are motions / gestures a user will make that really don't have much meaning as far as the app is concerned - picking it up, putting it down for a moment, moving it to the other hand, etc., so having a button on the interface that shuts off the motion interpretation was quite practical.

    The other major issue we found was filtering and dealing with drift. As nice a piece of hardware as this is, it isn't a tactical-grade IMU (Inertial measurement Unit) of the sort you might find in commercial aviation or military hardware, so the acceleration data is a bit noisy and prone to drift over time. For example, even when you think you are holding the device still, there are still small amounts of tremors and random noise that in an unfiltered data stream get interpreted as random acceleration, and after doing the numerical integration wind up as random velocity and position changes. The math here can get somewhat complicated (look up Kalman filters, as an example), but a simple trick is to establish floor filters - any acceleration or orientation data that is beneath a certain threshold is clamped to zero. This makes it easier to ensure that when you are holding the device still, the application effectively gets a 'no motion' signal.


Share This Page