Shop OBEX P1 Docs P2 Docs Learn Events
Newbie Boe-Botter ... — Parallax Forums

Newbie Boe-Botter ...

rHOnDOrHOnDO Posts: 6
edited 2005-01-26 20:36 in Robotics
I just got my Boe-Bot Saturday afternoon and the USB-Serial cable by 10pm. Since then, BOE and I have been constant companions. I played with just the BOE for hours, and finally assembled the robot (with tank treads of course) Sunday evening. Of course, I have a few questions.

1) While playing and testing servos, I discovered my servos have different rotational rates. I figured out how to match them both by adjusting the pulsewidth of one (as an absolute value or as a percentage), but it only works for one speed, although I could figure out the values for other speeds by trial and error. Naturally, I'd like to ramp the accel/deceleration of the bot, and would like to program different turn rates, but the algorithm for calculating this "speed offset" must be more complicated (log? parabolic?) than my basic math skills. I couldn't find anything in the book about this (skimming). Suggestions?

2) I'm a bit frustrated with constantly having to plug in a serial cable, download the program, unplug and test, edit program, repeat. Ultimately I'd like a martian-rover setup where I can communicate commands via RF. Is there an RF appmod that would allow me to upload the program via RF? Or must the basic program be running on the Stamp and it just deals with input via RF?

3) I haven't yet depleted a set of batteries (AA), but am considering upgrading the bot's power source. I'm thinking of using rechargable (NiCad or NiMH?) batteries from an RC setup ... either 6 or 7.2V ... and possibly an on-board charger. If I used the 7.2V would it boost the speed of my servos (which seem a bit slow with the tank tread mod). Any other worries about upgrading the batteries? (like the added weight of the batteries further degrading the performance of the servos)

Thanks in advance.

A stoked bot owner,

Bill

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-01-25 02:07
    Bill, are you servos centered?· Do you have the adjustment hole for centering the servos (So they don't rotate either way when pulsed at 1.5mS)?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • rHOnDOrHOnDO Posts: 6
    edited 2005-01-25 05:44
    Yep ... I've centered them twice (so yes, they have the adjustment hole). Just as an example, here are the couple of settings (puslewidth) where I've figured out where the servos are equal.

    leftServo = 850
    rightServo = 690

    leftServo = 650
    rightServo = 807

    bill
  • ToddHToddH Posts: 34
    edited 2005-01-25 17:45
    Hey bill - good questions about the servos. I got my BoE-Bot kit yesterday and have the same issue. The servo's are centered now and I have the magic numbers to make it run in a straight line, but how do I take these numbers into account when I want to ramp up/down the speed of the servos yet maintain my straight line.

    My other question is about mounting a giant laser and circular saw blade to the Bot to complete my Robot-of-death... but that will have to wait - LOL
  • edited 2005-01-25 18:07
    1) There are two common solutions for matching servo speeds.· One is a software adjustment, and the other is a combination of hardware and software.·

    Using just software, the LOOKUP command is probably the most efficient way to match your servo speeds.· Assuming you completed the last activity in Chapter 3 of Robotics with the Boe-Bot, you will have graphs of both servo speeds vs. pulse widths.· You can use these to determine matching PULSOUT durations.··Then, place the pairs of pulsout durations in LOOKUP commands to set the values of variables that control the pulse·durations for each servo.· Here is an example program (below and attached)·that you can use to test this with your Boe-Bot.· Use the values from your graphs in Chapter 3, activity 4 in place of the generic ones in the LOOKUP commands.· There should be a noticeable improvement at 10 different speeds.· You can also expand this; the LOOKUP command accepts up to 256 different values.

    While this solution works to some extent, the best solution is the Boe-Bot Digital Encoder Kit.· The example programs in the kit's documentation demonstrate how to read the passage of the holes on the inside of the Boe-Bot wheel and adjust the servo pulse durations to get the desired speed/distance.

    2) Not at present.· According to FlexiPanel IR Hardware Data Sheet (.pdf), a prototype exists, so it might not be too long before we see a product that performs this function.

    3) Yeah, if you can get a 6 V rechargeable battery, that would work well.

    [color=#008000]' LookupTableServoPulseControl.bs2[/color]
    [color=#008000]' {$STAMP BS2}[/color]
    [color=#008000]' {$PBASIC 2.5}[/color]
     
    [color=#000000]speed          VAR     Word[/color]
    [color=#000000]distance       VAR     Word[/color]
    [color=#000000]counter        VAR     Word[/color]
    [color=#000000]pulseLeft      VAR     Word[/color]
    [color=#000000]pulseRight     VAR     Word[/color]
     
    [color=#0000ff]DEBUG[/color] [color=#ff0000]"Speed ranges from -100 to 100 ",[/color]
    [color=#ff0000]      "with 0 -> STOP.  Distance can ",[/color]
    [color=#ff0000]      "be 1 to 65534."[/color][color=#000000], [/color][color=#800080]CR[/color][color=#000000], [/color][color=#800080]CR[/color]
     
    [color=#0000ff]DO[/color]
     
      [color=#0000ff]DEBUG[/color] [color=#ff0000]"Enter speed:    "[/color]
      [color=#0000ff]DEBUGIN[/color] [color=#000080]SDEC[/color][color=#000000] speed[/color]
     
    [color=#000000]  speed = speed + 100 MAX 200[/color]
    [color=#000000]  speed = speed / 20[/color]
     
      [color=#0000ff]LOOKUP[/color][color=#000000] speed, [noparse][[/noparse]650, 670, 690, 710, 730,[/color]
    [color=#000000]                 750,[/color]
    [color=#000000]                 770, 790, 810, 830, 850], pulseLeft[/color]
     
      [color=#0000ff]LOOKUP[/color][color=#000000] speed, [noparse][[/noparse]850, 830, 810, 790, 770,[/color]
    [color=#000000]                 750,[/color]
    [color=#000000]                 730, 710, 690, 670, 650], pulseRight[/color]
     
      [color=#0000ff]DEBUG[/color] [color=#ff0000]"pulseLeft:  "[/color][color=#000000], [/color][color=#000080]DEC[/color][color=#000000] pulseLeft, [/color][color=#800080]CR[/color][color=#000000],[/color]
            [color=#ff0000]"pulseRight: "[/color][color=#000000], [/color][color=#000080]DEC[/color][color=#000000] pulseRight, [/color][color=#800080]CR[/color][color=#000000], [/color][color=#800080]CR[/color]
     
     
      [color=#0000ff]DEBUG[/color] [color=#ff0000]"Enter distance: "[/color]
      [color=#0000ff]DEBUGIN[/color] [color=#000080]DEC[/color][color=#000000] distance[/color]
      [color=#0000ff]DEBUG[/color] [color=#ff0000]"Running..."[/color][color=#000000], [/color][color=#800080]CR[/color][color=#000000], [/color][color=#800080]CR[/color]
     
      [color=#0000ff]FOR[/color][color=#000000] counter = 0 [/color][color=#0000ff]TO[/color][color=#000000] distance[/color]
     
        [color=#0000ff]PULSOUT[/color][color=#000000] 13, pulseLeft[/color]
        [color=#0000ff]PULSOUT[/color][color=#000000] 12, pulseRight[/color]
        [color=#0000ff]PAUSE[/color][color=#000000] 20[/color]
     
    [color=#0000ff]  NEXT[/color]
     
    [color=#0000ff]LOOP[/color]
    
    




    Post Edited (Andy Lindsay (Parallax)) : 1/25/2005 6:21:41 PM GMT
  • rHOnDOrHOnDO Posts: 6
    edited 2005-01-25 21:30
    Thanks Andy.

    1) My understanding is the Digital Encoder Kit does not work with the tank tread kit ... but your LOOKUP command looks promising. I had anticipated building an array like this and accessing it through and index (PBASIC doesn't support hashes does it?).

    3) Any thoughts on what it would take to provide/build and onboard charging circuit that I could just plug into to charge the batteries?

    bill
  • rHOnDOrHOnDO Posts: 6
    edited 2005-01-25 21:33
    ToddH said...
    Hey bill - good questions about the servos. I got my BoE-Bot kit yesterday and have the same issue. The servo's are centered now and I have the magic numbers to make it run in a straight line, but how do I take these numbers into account when I want to ramp up/down the speed of the servos yet maintain my straight line.

    My other question is about mounting a giant laser and circular saw blade to the Bot to complete my Robot-of-death... but that will have to wait - LOL


    Todd;

    Let me know when you get the laser and saw blade operational ... I'm working on the "killAllHumans" subroutine now.

    bill
  • rHOnDOrHOnDO Posts: 6
    edited 2005-01-26 06:41
    Andy;

    This is what that LOOKUP matrix looks like:

    LOOKUP speed, [noparse][[/noparse]850, 830, 810, 790, 770, 750, 730, 710, 690, 670, 650], pulseLeft
    LOOKUP speed, [noparse][[/noparse]684, 691, 700, 713, 729, 750, 766, 785, 798, 805, 809], pulseRight

    bill
    Andy Lindsay (Parallax) said...
    1) There are two common solutions for matching servo speeds. One is a software adjustment, and the other is a combination of hardware and software.


    Using just software, the LOOKUP command is probably the most efficient way to match your servo speeds. Assuming you completed the last activity in Chapter 3 of Robotics with the Boe-Bot, you will have graphs of both servo speeds vs. pulse widths. You can use these to determine matching PULSOUT durations. Then, place the pairs of pulsout durations in LOOKUP commands to set the values of variables that control the pulse durations for each servo. Here is an example program (below and attached) that you can use to test this with your Boe-Bot. Use the values from your graphs in Chapter 3, activity 4 in place of the generic ones in the LOOKUP commands. There should be a noticeable improvement at 10 different speeds. You can also expand this; the LOOKUP command accepts up to 256 different values.




    While this solution works to some extent, the best solution is the . The example programs in the kit's documentation demonstrate how to read the passage of the holes on the inside of the Boe-Bot wheel and adjust the servo pulse durations to get the desired speed/distance.




    2) Not at present. According to [noparse][[/noparse]color=#800080>FlexiPanel IR Hardware Data Sheet (.pdf), a prototype exists, so it might not be too long before we see a product that performs this function.



    3) Yeah, if you can get a 6 V rechargeable battery, that would work well.


  • edited 2005-01-26 07:49
    Wow, that's interesting. Usually, there is a slight change in servo speed between clockwise and coutnerclockwise. In this case, it looks like one servo is just plain faster than the other. I've seen that in servos occasionally, though it might be worthwhile to double-check that left tread and make sure it's not binding anywhere. Otherwise, it looks good.

    Those LOOKUP tables definitely save some time. I'm glad they worked.

    It'll be interesting to find out if there is drift due to battery level and/or usage. Keep us posted.
  • ToddHToddH Posts: 34
    edited 2005-01-26 20:06
    This is my first experience with robots / servos (besides "what is a microcontroller?"). Is it common that servos have different top-speeds?
  • rHOnDOrHOnDO Posts: 6
    edited 2005-01-26 20:36
    ToddH said...
    This is my first experience with robots / servos (besides "what is a microcontroller?"). Is it common that servos have different top-speeds?

    Todd - I can't answer about the servos, because I'm a newbie too .... but here is quick hack I did to figure out my "servor matrix" .... I used releativley long run times (600+) because I'm using tank treads and I figured out how long it would take so the slow servo would end up back in the same spot (multiple rotations). Then I just "trial-and-error" tested until I got the fast servo to match.

    ' Robotics with Boe-Bot - ServoMatrix.bs2
    ' Matrix of equivalent speeds
    
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    GOSUB BeepUp
    
    counter       VAR Word
    speedL           VAR Word
    speedR           VAR Word
    time              VAR Word
    
    DO
      DEBUG CR, "Servo matrix:", CR,
            "Left:  850 830 810 790 770 750 730 710 690 670 650", CR,
            "Right: 684 691 700 713 729 750 766 785 798 805 809", CR,
          "Time:          624 730 436     462 735 636 611 603", CR, CR
    
        DEBUG "Left servo (650-850):"
        DEBUGIN DEC speedL
    
        DEBUG "Right servo (", DEC 1500-speedL, "):"
        DEBUGIN DEC speedR
    
        DEBUG "Time to run: "
        DEBUGIN DEC time
    
        FOR counter = 1 TO time
    ' Left is on pin 13, right is on pin 12
          PULSOUT 13, speedL
          PULSOUT 12, speedR
          PAUSE 20
        NEXT
    
        GOSUB BeepDown
    
      DEBUG CLS, "RESULTS", CR,
            "  Left: ", DEC speedL, CR,
            "  Right: ", DEC speedR, CR,
        "  Time: ", DEC time, CR
    
    LOOP
    
    END
    
    ' ------ Subrountines ------
    ' ----- BeepUp -----
    BeepUp:
        FOR counter = 2000 TO 4000 STEP 500
          FREQOUT 4, 60, counter
        NEXT
    RETURN
    ' --------------------------------
    
    ' ----- BeepDown -----
    BeepDown:
        FOR counter = 4000 TO 2000 STEP 500
          FREQOUT 4, 60, counter
        NEXT
    RETURN
    ' --------------------------------
    
    

    Post Edited (rHOnDO) : 1/27/2005 4:39:24 AM GMT
Sign In or Register to comment.