Shop OBEX P1 Docs P2 Docs Learn Events
Driving Boe-Bot Straight — Parallax Forums

Driving Boe-Bot Straight

FooWhoFooWho Posts: 17
edited 2010-04-18 08:41 in Robotics
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?

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2010-04-17 11:14
    Out of the box Boe-Bot is an open loop system as there is no feedback and what you experience is a normal problem. You'll get better at it with practice, and calibrating your pulses, but without feedback it will always be an issue. The amount of difference between servos can vary by speed (fast versus slow) and people often have multiple correction factors for different speeds. With Scribbler I found time spent at a speed made a difference too.

    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.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-04-17 16:38
    FooWho,

    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
  • FooWhoFooWho Posts: 17
    edited 2010-04-17 19:49
    Thanks for the replies.· I will continue trying to refine my pulse values and order the Digital Encoder kit.· It is a lot of fun to put the Boe-Bot together and learning to write programs for it.· Part of the reason I decided to get the Boe-Bot was that I saw that there were lots of "add-on" packs that could be used to enhance it in various ways.· Looks like that is part of the solution.
  • ercoerco Posts: 20,256
    edited 2010-04-17 23:29
    @Martin_H: So you DID get your Scribbler encoders working! Please share your findings and a video! I also did it and it was quite a labor of love.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Martin_HMartin_H Posts: 4,051
    edited 2010-04-18 01:59
    Erco, yes I got them working a while ago, but I've gotten side tracked on the second robot I alluded to above.

    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.
  • FooWhoFooWho Posts: 17
    edited 2010-04-18 08:05
    Thanks for the information!· I have continued to try and adjust the pulse widths and have managed to get my Boe-Bot to drive reasonably straight.· I completed the chapter on navigating using the whiskers tonight and was very pleased watching my Boe-Bot drive around the house and change course after bumping into something!··My cats are very intrigued by Boe-Bot and will follow him, though they run away if Boe-Bot changes course and is moving towards them.· smile.gif
  • SandhuamarinderSandhuamarinder Posts: 85
    edited 2010-04-18 08:41
    To move boe bot straight u have to give pulsout out 850 and pulsout 650 one would run clockwise and one will run anti clockwise as it is assembeled but they will make the boe bot run straight.

    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.
Sign In or Register to comment.