Shop OBEX P1 Docs P2 Docs Learn Events
Sumo Bot Issue — Parallax Forums

Sumo Bot Issue

simmel65simmel65 Posts: 4
edited 2012-06-27 13:53 in Robotics
So I put together a sumo bot and can't get it straight. It veers to the right. We had it set for

PULSOUT 13, 850
PULSOUT 12, 650

It veered to the right.

Changed it to a few times then got to....

PULSOUT 13, 804
PULSOUT 12, 650

and it still veered right the same amount, then

PULSOUT 13, 803
PULSOUT 12, 650

made it veer left!

Changed the batteries and the servo and it has not resolved the issue.

Any suggestions?

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2012-06-24 18:18
    Did you center the servos? Continuous rotation servos usually need to be centered to not move on a pulse of 750. After you do that they still tend to veer to one side, but it can be corrected with a slightly longer pulse to one side.
  • simmel65simmel65 Posts: 4
    edited 2012-06-24 18:22
    Yes they are centered. That is what is strange...
  • ercoerco Posts: 20,256
    edited 2012-06-24 19:22
    Something's hinky. Please show us your entire program, and a video if you can. Youtube is fine.
  • simmel65simmel65 Posts: 4
    edited 2012-06-26 07:07
    Here is the code and a video that runs it. Had to pick it up at each pause so it wouldn't run into the wall, but you get the idea Now the breaking point is at 787/788

    http://www.youtube.com/watch?v=cg13e3HmKVM

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    counter VAR Word

    PAUSE 1000

    FOR counter = 1 TO 2000
    PULSOUT 13, 850
    PULSOUT 12, 650
    NEXT 'veers to the right

    PAUSE 3000 'stop 3 sec's

    FOR counter = 1 TO 2000
    PULSOUT 13, 788
    PULSOUT 12, 650
    NEXT 'still right

    PAUSE 3000 'stop 3 sec's

    FOR counter = 1 TO 2000
    PULSOUT 13, 787
    PULSOUT 12, 650
    NEXT 'veers left :(


    END
  • ercoerco Posts: 20,256
    edited 2012-06-26 08:26
    That is a strange jump. What changes happened between your first post (803/804 breakpoint) and now (787/788)?

    Is anything rubbing on your drive wheels? I don't have a Sumobot, but I'm quite familiar with BoeBot. I'm assuming they're similar. Is there a caster ball on this, or do you have a bulldozer-style blade dragging on the ground? Have you tried swapping your servos L/R?
  • ercoerco Posts: 20,256
    edited 2012-06-26 11:06
    At any rate, you have a non-linear servo response in at least one servo: strange, but not a deal breaker, as long as it functions consistently. Try leaving the servo on pin 13 alone (keep that pulsout constant) and tweak the other servo pulsout on pin 12 to get it to drive straight. When you get into accurate pulsout calibrations for matching servo speeds, you'll want to use a nice stable set of freshly-charged NiMH batteries. Alkaline batteries' voltage drops off linearly with use. They're a frustating variable you don't need in the mix. You might need to add a 5th NiMH cell since those are ~1.3V, either use the BoeBoost module or wire in an extra AA holder on your own. And add a jack or connector so you can connect a trickle charger easily to keep your batteries topped up.
  • simmel65simmel65 Posts: 4
    edited 2012-06-26 21:38
    Great advice. My son is helping me and said the plow was not straight and he thinks that solved the problem. We also try fresh batteries and test later this week and get back to you. Really appreciate the help here!
  • W9GFOW9GFO Posts: 4,010
    edited 2012-06-27 05:25
    First off, servos should receive a signal once every 20 milliseconds. You are missing the standard "PAUSE 20" in your code.

    Try this;
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    counter VAR Word
    
    PAUSE 1000
    
    FOR counter = 1 TO 2000
    PULSOUT 13, 850
    PULSOUT 12, 650
    PAUSE 17                      ' use "20" if you like but 17 will get it closer to a pulse every 20 milliseconds.
    NEXT
    

    Second, if it still goes one way or the other with a change in value of only one (787 vs 788) you could alternate between the two like this;
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    counter VAR Word
    
    PAUSE 1000
    
    FOR counter = 1 TO 1000
    
    PULSOUT 13, 788
    PULSOUT 12, 650
    PAUSE17
    
    PULSOUT 13, 787
    PULSOUT 12, 650
    PAUSE17
    
    NEXT
    

    Third,... there is no third.
  • ercoerco Posts: 20,256
    edited 2012-06-27 13:53
    W9GFO wrote: »
    First off, servos should receive a signal once every 20 milliseconds. You are missing the standard "PAUSE 20" in your code.

    Good catch, Rich. I'm assuming that got edited out of the code listing since his video showed the bot moving...

    And a great suggestion to try alternating 787/788. I think there may be another issue, but I'd be interested to hear the results if simmel65 can try it out and report back.
Sign In or Register to comment.