View Single Post
  #8   Spotlight this post!  
Unread 01-10-2013, 15:23
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Plotting Location w/ Accellerometer Project


The code for trapezoidally integrating an acceleration to get distance was given in this thread in an earlier post.

If your acceleration is in a plane (the plane of the floor), use the same concept to get your position in the plane:

Given t, x, y, vx, vy, ax, and ay at some point in time, and axnew aynew at some later point in time tnew*,
compute vxnew vynew xnew and ynew as follows:
dt = tnew - t;

vxnew = vx + dt*(axnew+ax)/2;
xnew = x + dt*(vxnew+vx)/2;

vynew = vy + dt*(aynew+ay)/2;
ynew = y + dt*(vynew+vy)/2;
... where x,y is the location of the accelerometer in the fixed plane of the floor. Note that you will have to convert your accelerometer signal from the vehicle reference frame to the fixed x,y reference frame of the floor, using the gyro to do the coordinate rotation.

As stated earlier, the errors will accumulate quickly and the computed position will diverge from the true position.


*Just to be absolutely clear for those who may be new to this: tnew is not one giant step from t. It is a very small integration time step (say 20ms) later than t. The repetition of this calculation over time is known as numerical integration.


Last edited by Ether : 01-10-2013 at 15:54.
Reply With Quote