1

I wish to calculate position of a small remote controlled car (relative to starting position). The car moves on a flat surface for example: a room floor. Now, I am using an accelerometer and a gyroscope. To be precise this board --> http://www.sparkfun.com/products/9623

As a first step I just took the accelerometer data in x and y axes (since car moves on a surface) and double integrated the data to get position. The formulae I used were:

vel_new = vel_old + ( acc_old + ( (acc_new - acc_old ) / 2.0 ) ) * SAMPLING_TIME;
pos_new = pos_old + ( vel_old + ( (vel_new - vel_old ) / 2.0 ) ) * SAMPLING_TIME;
vel_old = vel_new;
pos_old = pos_new;
acc_new = measured value from accelerometer

The above formulae are based on this document: http://perso-etis.ensea.fr/~pierandr/cours/M1_SIC/AN3397.pdf

However this is giving horrible error.

After reading other similar questions on this forum, I found out that I need to subtract the component of Gravity from above acceleration values (everytime from acc_new) by using gyroscope somehow. This idea is very well explained in Google Tech Talks video Sensor Fusion on Android Devices: A Revolution in Motion Processing at time 23:49.

Now my problem is how to subtract that gravity component? I get angular velocity from gyroscope. How do I convert it into acceleration so that I can subtract it from the output of accelerometer?

Ali
  • 56,466
  • 29
  • 168
  • 265
GuiccoPiano
  • 146
  • 1
  • 4
  • 12
  • Haha.. Actually the project was over long time back. Our Professor was really sticking to the point that this position calculation is possible because some other professor had told him that his team had managed to get the position upto 95% accuracy.. But finally we managed to convince our Prof that this is not possible. In all this I had forgotten to accept the answers. So better late than never! – GuiccoPiano Mar 04 '13 at 14:39

3 Answers3

2

It won't work, these sensors are not accurate enough to calculate the position.

The reason is also explained in the video you are referring to.

The best you could do is to get the velocity based on the rpm of the wheels. If you also know the heading that belongs to the velocity, you can integrate the velocity to get position. Far from perfect but it should give you a reasonable estimate of the position.

I do not know how you could get the heading of the car, it depends on the hardware you have.

Community
  • 1
  • 1
Ali
  • 56,466
  • 29
  • 168
  • 265
  • 1
    Hi Ali. We cannot implement dead reckoning (calculating rpm of the wheels) due to space limitations for wheel-encoders. Also right now we can forget about the heading. Let us assume that the car moves along a straight line in known direction. I just want to know how much the car has moved from its starting position using accelerometer and gyroscope data. How could I minimize the error? – GuiccoPiano Jun 18 '12 at 17:17
  • 1
    I repeat: it won't work, these sensors are not accurate enough to calculate the position. Sorry... :( – Ali Jun 18 '12 at 17:45
  • Hi.I get your point Ali. But this is my project and I have to try. Right now my accuracy is something like this: if I move the sensor say 40 cm along a straight line and just use accelerometer data (assuming that I just get Linear Acceleration), I get totally random vlaues for position if I repeat the test. For example: test 1 : Position = 51 cm , test 2 : Position = 46 cm , test 3 : Position = 76cm, test 4 : Position = 19 cm, test 5 : Position = 109 cm. Can I get more closer or atleast constant error using gyro? – GuiccoPiano Jun 19 '12 at 10:46
0

I'm afraid Ali's answer is quite true when it comes to those devices. However why don't you try searching arduino dead reckoning which will cover stories of people trying similar boards?

Here's a link that appeared after a search that I think may help you:

Converting IMU to INS

Even it seems like all of them failed you may come across workarounds which will decrease errors to acceptable amounts or calibrate your algorithm with some other sensor to put it back in track as the squared error of acceleration along with gyros white noise destroying accuracy.

Gorky
  • 1,393
  • 19
  • 21
0

One reason you have a huge error is that the equation appears to be wrong.

Example: To get updated vel,use.. Velnew=velold+((accelold+accelnew)/2)*sampletime.

Looks like you had an extra accel term in the equation. Using this alone will not correct all the error....need to as you say correct for influence of gravity and other things.

shruti1810
  • 3,920
  • 2
  • 16
  • 28
Joe
  • 1