0

I would like to know whether it is possible to write code that would let you know whether the user is walking or not (with their iphone tucked in their pocket) and towards which direction they are walking.

More specifically :

  • I'm not interested in calculating distance travelled
  • I'm not interested in counting steps, etc.

What I'm interested in is detecting movement and immobility, distinguishing between the two, and also distinguishing between forward and backward movement.

I know that with the use of the compass in iPhone 4S one can detect orientation, but what about backward movement?

Let's say I start walking, then I stop and then I start walking backwards ( without taking a 360 degree turn..)

Do you think it's possible to manipulate data coming from accelerometer/gyroscope/compass in such a way as to be able to trigger events in my code accordingly?

To give you a more concrete example :

Imagine I want my iPhone(in my pocket) to start playing music as soon as (how fast could the response be really?) I start walking and then stop as soon as I stop walking. And then play a video as soon as I start walking backwards (without turning 360).

4

1 回答 1

0

No. There is no way to guarantee which direction the iPhone is facing, and noise in the accelerometer will prevent long-term calibration. You could nullify the noise with a 3-way gyroscope, but it takes an extremely fast processor to manage the algorithm.

You could certainly tell if the person is moving, simply by taking the sums of the accelerometer's axes and checking if it's greater than a threshold, but as to which direction, that is not a possible task. You could certainly play music while you walk, but there would be no discretion as to the direction.

于 2012-01-29T04:41:14.137 回答