Help please: Robot keeps going into a circle
robotlover4ever
Posts: 2
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.
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
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.
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."
First check your electrical connections and then try testing each servo by itself.