[Physics] Calculate distance an accelerometer moved

accelerationdistancevelocity

I am reading accelerometer data and want to determine the distance that the accelerometer is moved. ( My question is similar to the one placed here, Calculate speed from accelerometer . I just feel as if it lacks in formulating a complete example for me to use )

How my accelerometer output looks like:

x,y,time
-1.046700,0.120410,2015-02-02 07:22:33.609

How my accelerometer moves:

My accelerometer is placed on the ankle of a person. As position changes from $1$ to $2$, the accelerometer x and y values move from second quadrant to first quadrant. The image below depicts this scenario:

enter image description here

Note, while not shown, the persons leg can go back and forth, so $z$ axis would incur some change. I don't want "what happens on the $z$ axis" to interfere with distance estimates using $x$ and $y$.

What I (think) I know and what I know:

So far I know that acceleration will be present on both of these axis, $x$ and $y$. Hence, I think I know that the total acceleration between the two axis can be represented with this formula:

$total_{accl} = sqrt(x^2 + y^2)$

Given $total_{accl}$, it would make sense to me to convert the accelerometer data measurements to $m/s^2$, and subtract standard gravity from it. Hence, I think I know that my above formula would be as follows:

$total_{accl} = sqrt(x^2 + y^2) * 9.81 – 9.81$

I know that I can get velocity from $total_{accl}$ by taking the first integral. I can do this in matlab using this funciton, trapz. And then, I can solve for distance, using $d = t * v$, where $v$ is my first integral of $total_{accl}$ ( velocity ), and $t$ the amount of elapsed time that the leg was moving.

My question:

Is my logic here correct?

I ask because when I try this method out, I get really bad error, almost $+100cm$ from the actual distance. I understand that accumulated error can be bad, but it's so big that I am questioning if I am doing this right.

UPDATE:

This post, Instantaneous velocity calculation from accelerometer, really nails down why the eventual drift and error accumulation will destroy and form of velocity and distance estimation in the example above. ( Especially as time continues )

Best Answer

The logic is, I believe, incorrect. You cannot subtract the acceleration of gravity from your readings that easily.

The major problem is that the frame of reference of the data measurement is changing: the accelerometer is rotating as the leg swings out and back. In this frame, the acceleration of gravity is constantly changing direction.

To work in the lab frame, you would need to:

  1. Find the instantaneous angle between the lab horizontal axis and the accelerometer x-axis;
  2. Convert the accelerometer x-y readings to lab horizontal and vertical readings;
  3. Subtract the acceleration of gravity from the y-value,

Then integrate numerically in both x and y directions over time to get velocities. Integrate in both directions over time again to get distance moved.

Consider using a digital camera and a strobe light... Google Harold Edgerton

Related Question