Driving Straight with a Raspberry Pi Initio Robot @Raspberry_Pi #piday #raspberrypi

from Driving Straight with a Raspberry Pi Initio Robot @Raspberry_Pi #piday #raspberrypi

by Kelly

Initio


Martin O’Hanlon’s latest project with his Raspberry Pi Initio Robot is to get it driving in a straight line!


(via raspberrypipod)



I’ve been continuing my Raspberry Pi Robot project (see previous post) and the next challenge was to create some functions to allow my robot to be autonomous.


First challenge… Drive in a straight line! Not as easy as it seems. You put both motors onto 100% power forward and it veers slightly to the right (or in my case it does!). The reason is simple the motors which drive the left and right wheels don’t turn at exactly the same rate.


What to do. Well the Initio robot chasis I have is fitted with wheel encoders which ‘tick’ when the wheels go round to show how far they have moved, so if I wanted to make the robot go straight I needed to make left and right wheels moved the same distance.


So, I turn both motors on and count the encoder ticks, if the left one is getting ahead I slow it down a bit, unless the right catches up and vice versa!



Read more.




998 Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!



Comments