Driving Boe-Bot Straight
I am currently working my way through the "Robotics with the Boe-Bot" book using the Boe-Bot kit.· This is my first robot, though I have a fair amount of experience in writing computer programs.· One problem I am running into is that my Boe-Bot does not go in a straight line.· First, I will try to explain my understanding of how the control of the rotational servos work and what I think the problem is.· Hopefully, someone can point out to me if I am offbase.
The servos receive a pulse from the stamp controller.· The length of the pulse determines the direction and speed of rotation.· A pulse length 500 units (1 ms) means to turn counterclockwise at full speed.· A pulse length of 1000 units (2 ms) means to clockwise at full speed.· A pulse length of 750 units (1.5 ms) means to stay still.· The servos do not operate at exactly the same speed, even given the same input.· So, if I give my Boe-Bot the command:
DO
PULSOUT 12, 1000
PULSOUT 13, 500
PAUSE 20
LOOP
it SHOULD travel in a straight line but it actually doesn't because the servos are exact.· I have looked around on this forum and saw a thread that suggested that this can be compensated for by slightly adjusting the values.· For example, perhaps:
DO
PULSOUT 12, 950
PULSOUT 13, 510
PAUSE 20
LOOP
will result in a straighter line.· However, I have tried this and the results do not seem to be constant.· I assume this could be due to fluctuations in the amount of electricty being drawn from the batteries, or imperfections in the surface the Bot-Bot is traversing, or even just due to the mechanics of the servos.· While I feel like I am gaining a good understanding of the principles involved, it is a little bit disappointing that my Boe-Bot is not doing exactly what I was trying to do.
Will this improve as I learn more techniques or is it just the nature of the beast?
The servos receive a pulse from the stamp controller.· The length of the pulse determines the direction and speed of rotation.· A pulse length 500 units (1 ms) means to turn counterclockwise at full speed.· A pulse length of 1000 units (2 ms) means to clockwise at full speed.· A pulse length of 750 units (1.5 ms) means to stay still.· The servos do not operate at exactly the same speed, even given the same input.· So, if I give my Boe-Bot the command:
DO
PULSOUT 12, 1000
PULSOUT 13, 500
PAUSE 20
LOOP
it SHOULD travel in a straight line but it actually doesn't because the servos are exact.· I have looked around on this forum and saw a thread that suggested that this can be compensated for by slightly adjusting the values.· For example, perhaps:
DO
PULSOUT 12, 950
PULSOUT 13, 510
PAUSE 20
LOOP
will result in a straighter line.· However, I have tried this and the results do not seem to be constant.· I assume this could be due to fluctuations in the amount of electricty being drawn from the batteries, or imperfections in the surface the Bot-Bot is traversing, or even just due to the mechanics of the servos.· While I feel like I am gaining a good understanding of the principles involved, it is a little bit disappointing that my Boe-Bot is not doing exactly what I was trying to do.
Will this improve as I learn more techniques or is it just the nature of the beast?
Comments
That's the not so good news. The good news is that Boe-Bot has a lot of options to add hardware to give feedback. I recently added wheel encoders to my Scribbler and another robot, and I won't go back to using open loop control. Counting pulses is a snap and driving nearly straight lines became easy.
As Martin alluded, there are accessories that can help. For example, the Boe-Bot Digital Encoder Kit is a simple add-on that can provide the necessary feedback for the directional accuracy you seek.
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
I went crazy and ordered a Ping, Ping mounting bracket, and a compass module. I also had a BCM gripper. To use all this I was going to need more I/O pins than I had free on my Scribbler switchboard modification.
Mike Davey was kind enough to dig up one of his CBA robot kits with wheel encoders and line following module. The CBA has the BS2e so the EPROM is much larger than Scribbler's or a stock Boe-Bot. I want to try to write to the EPROM as the robot maps its environment.
My son and I have been working on it for a few hours each Saturday since mid-March and we're close to finishing. After using Mike's calibration program I realized how good an idea his trim pots are, and wish I used them for my Scribbler modification. His calibration program is pretty cool because he over samples the encoders to determine the ratio of light and dark readings.
Both robots are BS2 based I can move programs between them with some tweaks for servos versus a motor controller and the I/O pin allocations.
I plan to post a video of all this when I get time.
For i = 1 to 100
Pulsout right,850
pulsout left,650
pause 18
next
if u wants to make it run for small time make ur loop smaller to 10 and also make ur pulsout comand small for smaller rotation.
Then it will make smaller moves.