how can i make my robot go faster?
lobo
Posts: 100
I need help my robot goes real slow. It makes that chuchu train sound as it is going foward. I know there is nothing wrong with the basic stamp 2 or the servos because when i use a simple program to pulsout the two servos to go foward the robot moves fast and smooth.
The problem i think is in the program i am using. Please look over my program and see whats causing my robot to go so slow.
I'am a beginner in pbasic so please excuse me if my program is not perfect or correct. i like pbasic and i am trying my best to learn.
The problem i think is in the program i am using. Please look over my program and see whats causing my robot to go so slow.
I'am a beginner in pbasic so please excuse me if my program is not perfect or correct. i like pbasic and i am trying my best to learn.
Comments
I think that your code will run faster if you remove the·DEBUG and decrease the PAUSE that are at the end.
Try the attachment and let me know...
I think the problem is that the servos must receive a pulse every 20mS or so to operate smoothly. The commands:
FREQOUT 8, 1, 38500
IR1 = IN9
FREQOUT 5, 1, 38500
IR2 = IN7
FREQOUT 2, 1, 38500
IR3 = IN0
FREQOUT 14, 1, 38500
IR4 = IN15
PULSOUT 12,500
PULSOUT 13,1000
will take 10mS plus execution time assuming a BS2. There is 1/2 of your available time right there. As was noted above removing the DEBUG command will help. If you still don't get smooth operation, then you may have to split up the IR detection routine. Perhaps something like:
Check the IR sensors before moving.
Select which direction to move.
Check two sensors
If they are different from the first reading, stop and check the other two
If not, keep moving and check the second pair
What exactly are you trying to do with your robot? It might help us figure out a way to help.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
If you have a second Stamp around, you can us it to see how long your control loop takes to run. Simply add a HIGH on a spare pin at the top of the loop, and low at the bottom. Use the PULSIN command on the second Stamp to see how long the routine takes. Sort of a poor man's 'scope.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot