Let's Make Robots!

How to make your robot drive strait

Simple way of correcting a very anoying problem

 

If you ever made a tracked robot you most likely had this problem: my robot wont go in a strait line !!!! what can i do ?

Well ... there is a simple solution and it doesnt envolve modifing you robot ! 

A simple code will allmost completely fix the problme !

The problem is that one track goes faster then the other so the solution is to slow one of them down with is realy easy.

The normal code to make your robot go forwards looks like this :

main:

high 7 : high 5 : low 4 : low 6

goto main

 

Now the code will need a bit of tweeking depending on with track goes to fast, in my case it is the one on the left witch is high 7. To slow it you need to pause it fora bit depending on your robot.

 

main:

high 7 : high 5 : low 4 : low 6

pause 1

low 7  : high 5 : low 4 : low 6

pause 3

high 7 : high 5 : low 4 : low 6

goto main

 

Now the problem is this might slow it down too much, the solution? Slow the other one down a bit. The timeing is a bit of guess work but will figure it out. 

 

main:

high 7 : high 5 : low 4 : low 6

pause 1

low 7  : high 5 : low 4 : low 6

pause 3 'This is the time you should change.

high 7 : high 5 : low 4 : low 6

pause 1

high 7 : low 5 : low 4 : low 6

pause 1 'This is the time you should change.

high 7 : high 5 : low 4 : low 6 

goto main 

goto main

 I will post a video onece I record one.

Hope this helped somebody! 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

What I do before I mess with the programming is, I'll take the gearbox a part and make sure the gears have no molding bits, or rough edges that will bind them while turning. I also add a bit of grease on the gears, and a drop of thin oil on the motor bearings. Sometimes I'll even go as far as to sand the sides of the gears then add nylon washers to better center the gears.

This typically makes them run a lot closer speeds, then I mess with my code to make them exact.

Taking it apart is the best thing to do but in some cases you no longer have acces to the gears so this in an alternatif
I think that George Strait is straight.

As a last resort this is a viable method. Good idea.

What your doing is basically a crude form of pulse width modulation. If you use the picaxes PWM feature then the chip will do this for you. Admittedly, depending on how you wired this in the first place it may need some re-wiring.

 

I've seen PMW writen in a lot of places but nevre knew what it was, just needed to read the manual! This is for people who are new to programming and whant a simple way to do the same thing.   

The picaxe editor has a wizzard that does the hard calculations for you. It is worth playing with. I usually adjust the frequency setting so that 500=50%. this makes the math easy and gives you an accuracy of 0.1%.

In many cases you can connect the PWM outputs to the enable pins of your motor control IC (L293D or a L298N) and then control your motors the same way as normal except the speed is controlled by the PWM outputs.

You can then adjust the PWM settings by trial and error until the robot goes straight or use wheel encoders to automatically correct.

 

i tryed using the wisard and it only lets me use PWM's on pin 1 an 2, my motors are driven by pins 4,5,6,7. So from what i can understand it wouldnt work.
i think you need hpwm for what oddbot's saying
No, pins 1 & 2 connect to the enable pins on the L293D
i searched for enable pins on the 3 Picaxe manuals and the L293D datasheet but i couldnt fin what it means.