Shop OBEX P1 Docs P2 Docs Learn Events
BoeBat Tracking to the Left or Right — Parallax Forums

BoeBat Tracking to the Left or Right

JohnFronJohnFron Posts: 1
edited 2005-04-16 15:03 in Robotics
We have a problem with our BoeBot - when we attempt to go in a straight line over a distance, it tracks to the left or the right. The servos were centered appropriately, and we using the correct PULSOUT offset to make the wheels spin at the same speed. We thought it was the rubberband treads, but we still had the same problem when we removed them. Any ideas of what we should look at?

Comments

  • Steve JoblinSteve Joblin Posts: 784
    edited 2005-04-13 20:17
    Several factors will make the BOEBot veer left or right over a long straight distance.· These factors include:

    1.· Alignment of the servos - The folds of the metal BOEBot body that create the verticle surfaces that you mount the servos on may be slightly off from true perfect 90 degrees and may not be perfectly parallel.

    2.· Servo speed - due to slight differences in the manufacturing process, the motors and/or electronics may have slight differences that cause very slight speed differences that will pull the BOEbot left or right.

    I actually use a "callibration" variable in my programs even thought my servos were both "centered".· By adding or subtracting a small amount, I was able to get my BOE to go straight for up to 15 or 20 feet!

    The code looks like this

    Adjustment····· var···· Nib

    Adjustment· = 2

    pulsout output_pin, 850+Adjustment
  • edited 2005-04-14 01:27
    Chapter 4, Activity #2 of Robotics with the Boe-Bot v2.2 explains why and guides you through straightening the Boe-Bot's forward travel. If your Boe-Bot was purchased recently, chances are that's the book that came in the box. Robotics with the Boe-Bot v2.2 is also available for free download from www.parallax.com -> Downloads -> Stamps in Class Tutorials.

    One servo going a little faster than the other is the most common culprit for a slight lilt in the Boe-Bot's forward travel.· If the servos aren't actually going the same speed, the goal is to slow down the faster one so that the slower one can keep up. Here is a program for continuous forward motion with both servos turning full speed:

    [color=green]' {$STAMP BS2}[/color]
    [color=green]' {$PBASIC 2.5}[/color]
     
     
    [color=blue]DO[/color]
     
      [color=blue]PULSOUT[/color][color=black] 13, 850[/color]
      [color=blue]PULSOUT[/color][color=black] 12, 650[/color]
      [color=blue]PAUSE[/color][color=black] 20[/color]
     
    [color=blue]LOOP[/color]
    
    


    Let's say your Boe-Bot is veering to the right. If we slow the left wheel down some, it should straighten out the Boe-Bot's path. Even though the Boe-Bot I tested for this post was only veering slightly to the right, the program that straightened out its path has a seemingly large adjustment to the left servo's pulse width.
    [color=green]' {$STAMP BS2}[/color]
    [color=green]' {$PBASIC 2.5}[/color]
     
     
    [color=blue]DO[/color]
     
      [color=blue]PULSOUT[/color][color=black] 13, 810[/color]
      [color=blue]PULSOUT[/color][color=black] 12, 650[/color]
      [color=blue]PAUSE[/color][color=black] 20[/color]
     
    [color=blue]LOOP[/color]
    
    


    Why such a big change? There's a graph of servo speed vs. pulse width on page 115 that hints at why. The pulse values you are sending the servos are somewhat outside of the speed control range to make sure that both really are going full speed. Once you get down to 820 or so, there starts to be some more noticeable changes in speed. Beyond 800, the speed control is pretty linear.

    If it turns out that the right wheel is the one you want to slow down, keep in mind that the rule for slowing down a servo is to give it pulse widths closer to 750. So, instead of 650, try 680 as a first guess, then adjust the value upward to slow the servo down, or downward to speed the servo up.·

    Once you're pretty sure of your numbers, you can declare some constants for your program. That way, if the servos performance changes over time, you can adjust values at the beginning of the program that will in turn adjust the arguments in every PULSOUT command. Here is an example:
    [color=green]' {$STAMP BS2}[/color]
    [color=green]' {$PBASIC 2.5}[/color]
     
    [color=black]CcwLeft  CON 810[/color]
    [color=black]CwRight CON 650[/color]
     
    [color=blue]DO[/color]
     
      [color=blue]PULSOUT[/color][color=black] 13, CcwLeft[/color]
      [color=blue]PULSOUT[/color][color=black] 12, CwRight[/color]
      [color=blue]PAUSE[/color][color=black] 20[/color]
     
    [color=blue]LOOP[/color]
    
    


    In terms of tuning, you may also want to declare CcwRight and CwLeft constants for tuning backward travel. You can also add PIN declarations, like ServoLeft PIN 13 and ServoRight PIN 12. Then you can replace all instances of 13 in the program with ServoLeft, and all instances of 12 in the program with ServoRight.· If you ever need to plug your servos into different servo ports, this will also make it possible to adjust single values at the beginning of your program that in turn update all the program's PULSOUT commands.

    Post Edited (Andy Lindsay (Parallax)) : 4/14/2005 1:50:36 AM GMT
  • gelfling6gelfling6 Posts: 60
    edited 2005-04-15 23:35
    Okay, I understand adjusting the pulsout rate, but I seem to be having a similar problem..
    and it only happens at the same place, (several locations of same place), with two different Robots
    (Both the BOE-BOT, and a TAB Build Your Own Sumo-Bot), but not elsewhere.. freaked.gif

    case in point.. At home, both will track a perfect straight line. (give or take a few degrees.)
    However, at work, (for those who don't know, I work at a schoolbus garage, and I occationally
    bring the bots to amuse & inspire the Kindergarten kids, on the bus.)
    both seem to track to the right.. I looked at the frame of the BOE, and one side seemed a little
    out of square, but once I bent it into place, it still tracked right.. Okay, Re-calibrate the servos..
    still tracking right. Yes, I even tried adjusting the pulsout rate.. Guess what? shocked.gif

    Now, It even happens with the TAB Robotics 'Build Your own Sumo-Bot'.. Now, I know there's
    that chance that DC motors won't always spin at the same rate, but, at home, no problems.
    At work, it drifts right in a nearly perfect arc.. But, Here's where it gets even weirder! freaked.gif

    I took them outside, out onto the parking lot. (without the busses charging around. Personally, the BOTs
    seem to drive better than some of my co-drivers. smilewinkgrin.gif ) the right turn arc, is tighter!
    inside, it would move off about 5-6 inches from straight after 3 feet.. Outside, it would turn almost a good
    1-foot drift!

    Sounds like a case for the X-Files, but it's a definate case of fact being stranger than fiction!

    Stephen (gelfling6)
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-04-16 14:49
    Sounds like a different traction on different surfaces -- that or weight distribution, or slope of the surfaces.
  • bishopbishop Posts: 82
    edited 2005-04-16 15:03
    yeah..its probably traction.
    there are a few things you could try...
    add some weight to the bot.
    use a compass module to check for bearing deviation.
    put a pot dial on top to use as input for an adjustment variable (as demonstrated above). When you notice the variable steering for the different surfaces, you could just dial in the corrected variable.
    just a thought.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    **************

    daniel woolston
    Teksystems Inc.
    www.danwoolston.com
    **************
Sign In or Register to comment.