position calculation of small model of a car using accelerometer + gyroscope

Upload: bryan-o

Post on 14-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Position Calculation of Small Model of a Car Using Accelerometer + Gyroscope

    1/2

    1/29/13 Position calculation of small model of a car using Accelerometer + Gyroscope

    www.stackprinter.com/export?format=HTML&service=stackoverflow&question=11087076 1/2

    Position calculation of small model of a car using Accelerometer +Gyroscope

    [0] [1] Guicc oPiano

    [2012-06-18 16:28:18]

    [ position acc elerometer gy roscope inertial-navigation ]

    [ http://stackoverflow.com/questions/11087076/position-calculation-of-small-model-of-a-

    car-using-accelerom eter-gy roscope ]

    I wish to calculate position of a small remote controlled car (relative to starting position). The carmoves on a flat surface for example: a room floor. Now, I am using an accelerometer and agyroscope. 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 thecomponent 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 Fusionon 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 fromgyroscope. How do I convert it into acceleration so that I can subtract it from the output ofaccelerometer?

    [1] http://www.yo utube.com/watch?v =C7 JQ7 Rpwn2k

    [+1] [2012-06-18 16:59:24] A li

    It wo n't work, [1] these sensors are not acc urate enough to c alculate the po sition.

    The reason is also explained 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 veloc ity, yo u can integrate the velocity to get position. Far from perfect but it should

    give y ou a reasonable estimate of the position.

    I do not know how y ou co uld get the heading of the car, it depends on the hardware yo u have.

    [1] http://stackover flow.com/a/7 835988/34197 0

    Hi Ali. We cannot implement dead reckoning (calculating rpm of the wheels) due to space limitations for wheel-encoders. Also right n ow we can forget about the heading. Let us assume t hat t he ca r m ov es 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 gy roscope data. How could I m inim ize the error? - GuiccoPiano

    I repeat: it won't work, t hese sensors are not accu ra te enough t o calcu late th e position. Sorry ... :( -Al i

    Hi.I get y our point Ali. But this is my project and I hav e to try . Right now my accura cy is someth ing like this: if I

    http://www.youtube.com/watch?v=C7JQ7Rpwn2khttp://perso-etis.ensea.fr/~pierandr/cours/M1_SIC/AN3397.pdfhttp://www.sparkfun.com/products/9623http://stackoverflow.com/a/7835988/341970http://www.youtube.com/watch?v=C7JQ7Rpwn2khttp://perso-etis.ensea.fr/~pierandr/cours/M1_SIC/AN3397.pdfhttp://www.sparkfun.com/products/9623
  • 7/30/2019 Position Calculation of Small Model of a Car Using Accelerometer + Gyroscope

    2/2

    1/29/13 Position calculation of small model of a car using Accelerometer + Gyroscope

    www.stackprinter.com/export?format=HTML&service=stackoverflow&question=11087076 2/2

    mov e the sensor say 40 cm along a straight line a nd just use accelerometer data (assum ing that I just get Linear

    Accelerat ion), I get tota lly random v laues for position if I repeat the test. For exam ple: test 1 : Position = 51 cm ,

    test 2 : Position = 46 cm , t est 3 : Position = 7 6cm , t est 4 : Position = 1 9 cm , t est 5 : Position = 1 09 cm . Can I get

    m ore closer or at least constan t error using g y ro? - GuiccoPiano1