Position Calculation of Small Model of A Car Using Accelerometer + Gyroscope
Position Calculation of Small Model of A Car Using Accelerometer + Gyroscope
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:
v e l _ n e w=v e l _ o l d+(a c c _ o l d+(( a c c _ n e w-a c c _ o l d)/2 . 0))*S A M P L I N G _ T I M E ; p o s _ n e w=p o s _ o l d+(v e l _ o l d+(( v e l _ n e w-v e l _ o l d)/2 . 0))*S A M P L I N G _ T I M E ; v e l _ o l d=v e l _ n e w ; p o s _ o l d=p o s _ n e w ; a c c _ n e w=m e a s u r e dv a l u ef r o ma c c e l e r o m e t e r
The above formulae are based on etis.ensea.fr/~pierandr/cours/M1_SIC/AN3397.pdf However this is giving horrible error.
this
document:
http://perso-
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 [1 ] 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?
[1 ] http://www.y outube.com/watch?v =C7 JQ7 Rpwn2k [+1] [2012-06-18 16:59:24] Ali It won't work, [1 ] these sensors are not accurate enough to calculate the position. The reason is also ex plained in the v ideo y ou are referring to. The best y ou could do is to get the v elocity based on the rpm of the wheels. If y ou also know the heading that belongs to the v elocity , y ou can integrate the v elocity to get position. Far from perfect but it should giv e y ou a reasonable estimate of the position. I do not know how y ou could get the heading of the car, it depends on the hardware y ou hav e. [1 ] http://stackov erflow.com/a/7 835988/341 97 0
Hi Ali. We cannot im plem ent dead reckoning (calculating rpm of the wheels) due to space lim itations for wheelencoders. Also right now we can forget about the heading. Let us assum e that the car m ov es along a straight line in known direction. I just want to know how m uch the car has m ov ed from its starting position using accelerom eter and gy roscope data. How could I m inim ize the error? - GuiccoPiano I repeat: it won't work, these sensors are not accurate enough to calculate the position. Sorry ... :( - Ali Hi.I get y our point Ali. But this is m y project and I hav e to try . Right now m y accuracy is som ething like this: if I
www.stackprinter.com/export?format=HTML&service=stackoverflow&question=11087076 1/2
1/29/13
m ov e the sensor say 4 0 cm along a straight line and just use accelerom eter data (assum ing that I just get Linear Acceleration), I get totally random v laues for position if I repeat the test. For exam ple: test 1 : Position = 51 cm , test 2 : Position = 4 6 cm , test 3 : Position = 7 6 cm , test 4 : Position = 1 9 cm , test 5 : Position = 1 09 cm . Can I get m ore closer or atleast constant error using gy ro? - GuiccoPiano
1
www.stackprinter.com/export?format=HTML&service=stackoverflow&question=11087076
2/2