# [racket] what initial velocity to use when calculating velocity from acceleration (peripherally moby-related...)

 From: Joe Marshall (jmarshall at alum.mit.edu) Date: Tue Nov 30 15:52:57 EST 2010

```On Mon, Nov 29, 2010 at 12:36 PM, keydana at gmx.de <keydana at gmx.de> wrote:
>
> To calculate velocity from acceleration I'd like to use Euler integration

Euler integration can be unstable.  I wouldn't discount it right away,
but you might see
artifacts in your velocity calculation.

> I cannot assume that the application is started exactly when a person starts to
> move, so the initial velocity will most certainly not be 0 but can be anything.

Correct.  However, absolutely uniform motion is an unrealistic ideal in most
terrestrial situations:  you move, you vibrate in some way.  If the
accelerometers
are measuring very little (close to zero) acceleration, and they stay that way
for some amount of time (several seconds), you can assume the phone velocity
is essentially zero.

An integrator is likely to `drift' over time.  In theory, when you
stop moving you
should have to apply exactly the same acceleration in reverse from when you
started.  In practice, however, the two accelerations won't quite
cancel (there will
be errors in measurement and error accumulation in the integrator).
You'll have to
re-zero the integration every now and then to keep it at a sane value.

Alternatively, you could use GPS or some other position data to supply an upper
bound on the velocity and acceleration and then try to correct the integration
that way.

In any case, this is an officially difficult problem which has no
known `solution'.
You're going to learn a lot!

--
~jrm

```

 Posted on the users mailing list.