# How to determine relative position using accelerometer and gyro data

I am designing a robot, and need to track the distance and direction of the robot motion, Nothing in 3D, I only need x,y and angle in x y plane.

My question :

1. Is it possible to use gyro and accelerometer with kalman filtering or any other methods to track this? (I do not have motor encoders)

My constraints : I do not have space to include a gps (due to power requirements) or motor encoders (due to motor support)

• I am also curious on how this is done. Commented Feb 23, 2011 at 7:34
• possible duplicate of How to determine position from gyroscope and accelerometer input? Commented Feb 23, 2011 at 13:59
• @Kellenjb - significant overlap, to be sure. Commented Feb 24, 2011 at 0:45

You can integrate acceleration to obtain velocity data, and you can further integrate velocity to get position. Integration is just the process where you just cumulatively add something up. For example, if you get a new acceleration reading every 0.1 second, you assume the acceleration was constant over the last 0.1 second; you then find the change in velocity over that same time interval by adding 0.1 seconds * acceleration to the current velocity estimate, and repeat this every time a new acceleration reading comes in.

This is what's known as 'dead reckoning', and it has some down sides. Most important is that because you basically are just adding up measurements across time, any errors (e.g., noise) in that data also accumulates, so your approximation of where you are, where you're headed, and how fast you're going all degrade over time.

• Nice answer! Commented Feb 23, 2011 at 12:06
• Also the clock drift will start to really show up after a long time of use. This is typically fixed by having a GPS resync every so often, but as @srinathhs said, theres no power for a GPS on this system. Commented Feb 23, 2011 at 14:02
• If i use kalman filtering , will it be accurate enough? Commented Feb 23, 2011 at 16:14
• @srinathhs - depends on your accuracy requirements, of course. i know kalman filters are supposed to improve this kind of system, but i don't have enough experience with them to be able to tell you. fwiw, it's not inconceivable that you could get what need without it. Commented Feb 24, 2011 at 0:44
• Using Kalman filtering (properly) will be just about the best you can do: Kalman filters are (within a mathematical framework that reasonably, if not perfectly fits this kind of application) optimal filters. It will work much better than just dump "integration" (but it can be seen as a smart way of integrating your sensor outputs). Still, whatever you do, you will have drifts that you need to compensate some way: In the long term, your calculated velocities and positions will divert ever more from the real ones, unless you have more inputs (GPS or wheel sensors) or assumptions.
– user30985
Commented Nov 24, 2013 at 11:55

for trackin the distance u need position sensors .I hope u have a model in matlab or anyother software for validating ur sensor results. As,in u need to simulate a working model and then validate it. Give velocity as input and get acceleration as output by means of a DAQ(data aquistion)and then connect the sensors to this daq.the power supplied will not be more than 24-volts ,since the position sensor can be run at low frequencies.

I hope this helps/...