Shop OBEX P1 Docs P2 Docs Learn Events
Help please: Robot keeps going into a circle — Parallax Forums

Help please: Robot keeps going into a circle

robotlover4everrobotlover4ever Posts: 2
edited 2013-11-15 14:34 in Robotics
I created a code for a robot to go through this maze thing that I had built for it. The problem? It keeps going in circles. It can't be a problem with the code because the code has worked on my friends robot, but it won't work on mine. At first, I thought it was a battery problem.. but new batteries hasnt solved anything.

Whats the problem?

Here is the code for my robot.


[/FONT]
[FONT=arial]' {$STAMP BS2}[/FONT]
[FONT=arial]DEBUG "Program Running!"[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]counter        VAR     Word[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FREQOUT 4, 2000, 3000                       ' Signal program start/reset.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 220                      ' Number of pulses - run time.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650                            ' Left servo full speed ccw.[/FONT]
[FONT=arial]  PULSOUT 12, 825                            ' Right servo full speed cw.[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40                      ' Number of pulses - run time.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650                            ' Left servo full speed ccw.[/FONT]
[FONT=arial]  PULSOUT 12, 750                            ' Right servo full speed cw.[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 45[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 845[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 750[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 120                      ' Number of pulses - run time.[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650                            ' Left servo full speed ccw.[/FONT]
[FONT=arial]  PULSOUT 12, 825                            ' Right servo full speed cw.[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 750[/FONT]
[FONT=arial]  PULSOUT 12, 850[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 95[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 750[/FONT]
[FONT=arial]  PULSOUT 12, 850[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 67[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 37[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 750[/FONT]
[FONT=arial]  PULSOUT 12, 850[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 25[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 750[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 35[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 40[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 750[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]FOR counter = 1 TO 210[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]  PULSOUT 13, 650[/FONT]
[FONT=arial]  PULSOUT 12, 825[/FONT]
[FONT=arial]  PAUSE 20[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]NEXT[/FONT]
[FONT=arial]
[/FONT]
[FONT=arial]END

Comments

  • davejamesdavejames Posts: 4,047
    edited 2013-11-15 08:33
    Hello robotlover4ever - welcome to the Forum!

    FYI - the double post in the Basic Stamp area is a no-no according to the Forum Guidelines and has been removed.

    http://forums.parallax.com/showthread.php/134682-Forum-Guidelines


    ...and maybe some basic information concerning what type of robot, servos, anything else might help us help you in determining the problem.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2013-11-15 08:42
    Whenever using servos in a robot be sure they are first calibrated. Servos like those from Parallax have a calibration trimpot inside them.

    You want to write a small program that sends "centering" pulses only. If you are using the Parallax continuous rotation servos there is an example of this in the documentation -- see the section "BASIC Stamp Calibration Code - for all BS2 models."
  • GenetixGenetix Posts: 1,754
    edited 2013-11-15 14:34
    One of your servos might not be working. The robot will turn if one servo doesn't move.
    First check your electrical connections and then try testing each servo by itself.
Sign In or Register to comment.