I am doing project on odometry using raspberry pi. I know that encoder motor will tell me how much distance my robot has covered, but I have no idea ho to implement completely. I just need guideline about which steps to follow. Till now I have interfaced motor with raspberry pi and counted the number of rotation. I have questions as follow?

How to plot map of odometry using which language and library?

If you know anything, just give me guideline about steps to follow.

  • $\begingroup$ Welcome! Please only ask one question. I edited your post and removed the second part about ros. You can ask about that in a separate question. Still, your question is somewhat unclear as you did not describe your robot at all, which makes it impossible to answer. Please edit your question and add that information. Thanks. $\endgroup$ Commented Jul 30, 2016 at 10:48
  • $\begingroup$ Are you using a 2-motor differential drive robot, or one with some sort of car steering mechanism? $\endgroup$
    – Andy
    Commented Aug 1, 2016 at 8:54

1 Answer 1


You could maybe use Matlab to plot the position of your vehicle? This is how I'm trying to do that: I have a 'logging'-program running on the Raspberry Pi that counts each sampling time the pulses from the encoders. This I log in a file. This file I upload in Matlab to calculate X and Y coordinate and the angle under which the vehicle is standing, assuming the vehicle starts at coordinate (0,0) and angle 0°. These are the formula's I use. With 'triangle'-r and 'triangle'-l I mean the distance traveled by left and right wheel (can be calculated using pulses in log file and diameter of the wheel). Distance '2L' is the distance between the 2 wheels.

enter image description here

I wrote a matlab GUI in which I can browse a data file (from the Pi), calculates the X and Y position every sampling period and plot this is an XY graph.

Ps: you didn't mention it, but I suppose you have a differential drive vehicle?!

  • 2
    $\begingroup$ Please note that you can insert mathematical formulas into your post with mathjax. This has the advantage that it can be edited more easily than an image. For example $$\Theta_{k+1} = \Theta_{k} + \omega$$ gives $$\Theta_{k+1} = \Theta_{k} + \omega$$. You can also right click on any formula to see the code (Tex commands) that were used to create it. As this is close to Latex, it's a handy skill to have. $\endgroup$ Commented Jul 31, 2016 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.