Shop OBEX P1 Docs P2 Docs Learn Events
Newbie Question - Balancing Servos — Parallax Forums

Newbie Question - Balancing Servos

RazmearRazmear Posts: 6
edited 2005-06-22 06:16 in Robotics
Howdy,
I'm a new BOE-Bot owner and am enjoying the projects very much.
One issue I have is the BoeBot will only go straight if I set the servos at 13: 801 ; 12:650 or in reverse 13:699 ; 12: 850
Due to the 'speed curve' where rpm changes more rapidly in the middle zones than the end, this mismatch makes ramping almost imposible (or at least to complex for me to bother with at this point). It seems obvious that servo 12: is a bit on the weak side.
So is there a 'hardware' adjustment that can be made to beter synch the speed of the 2 servos, or am I better off getting the 2 free servo deal and replacing the existing servos and using the old ones for a gripper or other project down the line?

Any ideas would be appriciated,
eb

Comments

  • edited 2005-06-22 03:41
    You must be talking about the buy a Parallax Servo Controller and get 2 free servos deal.· Yes, that's one option.· There's another deal on our home page right now - the Super Servo Sale.· At $6.95 per continuous rotation servo, well, that's beats any price I've ever seen.· The servo quality is good too (modified Futaba S148), so now would be the time to get a few spares.·
    ·
    As for solutions to the ramping problem, there are many software and hardware solutions.· Here are two software examples, followed by a hardware + software suggestion.·
    ·
    This first approach·(ProportionalRamping.bs2) simply uses the fact that your step size needs to be twice as large to get to the full speed mark for the servo connected to P12.· While it's a nice and simple solution, it's also somewhat flawed because the power curves are probably more complex than a simple multiply-by-2.· Even so, it's still worth a try.
    ·
    [color=green]' ProportionalRamping.bs2[/color]
     
    [color=green]' {$STAMP BS2}[/color]
    [color=green]' {$PBASIC 2.5}[/color]
     
    RampStepLeft   CON     1
    RampSTepRight  CON     2
     
    counter        VAR     Byte
    pulseLeft      VAR     Word
    pulseRight     VAR     Word
     
    pulseLeft = 750
    pulseRight = 750
     
    [color=green]' Ramp up[/color]
     
    [color=#0000ff]FOR[/color] counter = 1 [color=#0000ff]TO[/color] 50
      pulseLeft = pulseLeft + RampStepLeft
      pulseRight = pulseRight - RampStepRight
      [color=#0000ff]PULSOUT[/color] 13, pulseLeft
      [color=#0000ff]PULSOUT[/color] 12, pulseRight
      [color=#0000ff]PAUSE[/color] 20
    [color=blue]NEXT[/color]
     
    [color=green]' Ramp down[/color]
     
    [color=#0000ff]FOR[/color] counter = 1 [color=#0000ff]TO[/color] 50
      pulseLeft = pulseLeft - RampStepLeft
      pulseRight = pulseRight + RampStepRight
      [color=#0000ff]PULSOUT[/color] 13, pulseLeft
      [color=#0000ff]PULSOUT[/color] 12, pulseRight
      [color=#0000ff]PAUSE[/color] 20
    [color=blue]NEXT[/color]
    
    


    The BASIC Stamp has a number of features designed to deal with a world that's not as simple as multiplying by 2.· With this second approach (RampingWithLookup.bs2), you can customize values in LOOKUP commands to suit the behavior of each servo.· Just find values that make it drive straight ahead at each increment in the list.· The LOOKUP command supports lists with up to 256 elements, so increasing each movement to 50 custom steps is no problem.· Just remember to make the FOR...NEXT loops take as many steps as there are elements in each LOOKUP command.
    ·
    [color=green]' RampingWithLookup.bs2[/color]
     
    [color=green]' {$STAMP BS2}[/color]
    [color=green]' {$PBASIC 2.5}[/color]
     
    counter        VAR     Byte
    pulseLeft      VAR     Word
    pulseRight     VAR     Word
     
    pulseLeft = 750
    pulseRight = 750
     
    [color=green]' Ramp up (briefly)[/color]
     
    [color=blue]FOR[/color] counter = 1 [color=blue]TO[/color] 11
     
      [color=blue]LOOKUP[/color] counter, [noparse][[/noparse]750, 755, 760, 765, 770, 775,
                       780, 785, 790, 795, 800], pulseLeft
      [color=blue]LOOKUP[/color] counter, [noparse][[/noparse]750, 740, 730, 720, 710, 700,
                       690, 680, 670, 660, 650], pulseRight
     
      [color=blue]PULSOUT[/color] 13, pulseLeft
      [color=blue]PULSOUT[/color] 12, pulseRight
     
      [color=blue]PAUSE[/color] 20
     
    [color=blue]NEXT[/color]
     
    [color=green]' Ramp down (briefly)[/color]
     
    [color=blue]FOR[/color] counter = 1 [color=blue]TO[/color] 11
     
      [color=blue]LOOKUP[/color] counter, [noparse][[/noparse]800, 795, 790, 785, 780, 775,
                       770, 765, 760, 755, 750], pulseLeft
      [color=blue]LOOKUP[/color] counter, [noparse][[/noparse]650, 660, 670, 680, 690, 700,
                       710, 720, 730, 750, 750], pulseRight
     
      [color=blue]PULSOUT[/color] 13, pulseLeft
      [color=blue]PULSOUT[/color] 12, pulseRight
     
      [color=blue]PAUSE[/color] 20
     
    [color=blue]NEXT[/color]
    
    

    ·
    A third (hardware + software) approach would be to use feedback in the form of optical encoding.· The Boe-Bot Digital Encoder kit·makes it possible to read the holes in the Boe-Bot wheel as they pass by IR pairs similar to the ones used in Chapters 7 and 8 in Robotics with the Boe-Bot.· It's basically infrared object detection applied to the holes in the Boe-Bot wheels.· Your program can then determine the speed of each wheel, and adjust the PULSOUT commands to P13 and P12 accordingly.

    Post Edited (Andy Lindsay (Parallax)) : 6/22/2005 4:10:14 AM GMT
  • RazmearRazmear Posts: 6
    edited 2005-06-22 04:18
    Thanks for the detailed reply!!!
    I took another look at the PSC and I can't think of a need to make 16 servos do the same thing at once, I had thought it was broken into two sides that would mirror the existing P12, P13 with 8 servos each. (was thinking 16 wheeled monster bot, or a pair for a 4 sided snake bot)
    I probably will end up getting another set of servos as I'm sure they will find some use soon enough, but will try the lookup stepping in the time being.

    Thanks agian for the tips,
    eb
  • Kevin B SlaterKevin B Slater Posts: 49
    edited 2005-06-22 06:16
    Razmear,
    · The PSC will do much more than make sixteen servos do the same thing.· Each channel is independent, you can have sixteen servos in sixteen different positions.· With different ramping values on each channel.· The PSC would be overkill for a simple BOE-BOT, I would suggest taking Andy's code and experimenting with it.· When it comes to robotics with the BOE-BOT, Andy is the man!

    · If you need a couple extra servos then the PSC is a good deal, I bought one for just that reason.

    Kevin
Sign In or Register to comment.