Shop OBEX P1 Docs P2 Docs Learn Events
SumoBot won't go straight — Parallax Forums

SumoBot won't go straight

Hi,
I have a sumoBot that I'm just trying to get up and running. I'm having trouble getting it to go in a straight line. It starts off veering significantly to the Left. You can see by the comments in my code what I have tried. Is there another way to fine tune things
' -----[ Constants ]-------------------------------------------------------

LFwdFast     CON        1000                                            ' left motor fwd; fast
LFwdSlow     CON        800                                             ' left motor fwd; slow
LStop        CON        750                                             ' left motor stop
LRevSlow     CON        700                                             ' left motor rev; slow
LRevFast     CON        500                                             ' left motor rev; fast
RFwdFast     CON        500                                             ' right motor fwd; fast
RFwdSlow     CON        714   'Veers left at 713 and veers right at 714 ' right motor fwd; slow
RStop        CON        750                                             ' right motor stop
RRevSlow     CON        800                                             ' right motor REV; slow
RRevFast     CON        1000                                            ' right motor rev; fast

' -----[ Variables ]-------------------------------------------------------

pulses       VAR        Byte                    ' servo pulses counter

' -----[ Initialization ]--------------------------------------------------

Reset:
  LOW LMotor                                    ' initialize motor outputs
  LOW RMotor
  PAUSE 2000                                    ' time to disconnect cable

' -----[ Program Code ]----------------------------------------------------

Main:
  FOR pulses = 1 TO 255           'testing
    PULSOUT LMotor, LFwdSlow
    PULSOUT RMotor, RFwdSlow
  NEXT

Comments

  • ercoerco Posts: 20,250
    It shouldn't be that sensitive. First, make sure your batteries are NEW when you are calibrating. Everything changes as they wear down, so seek "pretty good", not perfect. Next, make sure they are nulled/stopped at at 750, adjust using the pot inside the servo.

    Is it a slight veer left at 713 and a slight veer right at 714? Then change LFwdSlow to ~798 and retest. You should be able to find a L/R pair that gives you a pretty straight path at various speeds, forward and reverse.
Sign In or Register to comment.