The 'forward' time on the Tab SUMOBOT is determined by the number of times that the 505 receives the forward instruction. Each forward instruction should have a pause between between it. The pause can be up to 180. A pause that is longer than 180 caused our robots to have choppy·movement.
The total 'forward' time is:
· 'forward'·command to 505
+· pause 180
~ 180 m sec
*··10 loop iterations (number of times this loop is performed).
~ 1800 m sec
I have attached some code with comments which may be interesting.
i now understand exactly how to make my bot do everything but one thing, how do you tell how many times to loop, you said the command "DO" makes it loop ten times, how do you change the number of times it loops
The comment after the 'DO' is not correct. The 'DO'/'LOOP' will be infinite.
DO ' Do the loop 10 times
RobotData = RobotForward ' Move forward
GOSUB RobotSend
PAUSE PauseTime ' Wait msecs between RobotSend commands
LOOP ' Repeat Again
It should have been:
FOR sendCmd = 0 TO 9 ' Do the loop 10 times
RobotData = RobotForward ' Move forward
GOSUB RobotSend
PAUSE PauseTime ' Wait msecs between RobotSend commands
NEXT
its not working correctly, when i send it to the bot it doesn't stop after the allotted number of loops it just goes on forever, it send the forward command forever
I think that the·attached file should be complete. I have not tested it. I hope it is useful.
I encourage you to read through the·CD that came with the robot. It will take you through·several code writing execises.·The manual on the CD·is not as well written as the Parallax material but it is the only way for you to learn how your TAB SUMOBOT works.
In case you weren't aware of it, there is a Yahoo Group which deals exclusively with the Tab Robot Kit. Here is a link to that Yahoo Group: http://groups.yahoo.com/group/tabrobotkit/
i don't mean to bother u again, but i've read almost everything that comes on theat cd, and really doesn't have anything that relates to what i'm trying to do, and your latest isn't working, i've tried to tweak with it and i can't get it, and the yahoo groups is useless
I didn't look through your coding all that thoroughly, but there is definitely a NEXT statment missing after your FOR statement. Additionally, I don't see anywhere that the variable CountMoves is incremented or decremented or even referenced anywhere in your coding except in tha FOR statement mentioned above. Lastly, you are probably going to drop right into the RobotSend coding. The RobotSend coding is a sub-routine, and it should only be accessed by a GOSUB statement.
I'd clean up at least that much before you try toactually troubleshoot it any further.
everything is functioning right except for the countmoves command, no matter what i set countmoves equal to, it just loops the forward command forever, i can't get it to work
I also found that the code would not stop the·robot.
I modified·the code to·make·it·stop after the forward commands. I also tested it on my TAB SUMOBOT.·The·sub-routine had been a part of the main program logic. When the context came to the 'Return' statement it caused the program to start over again. I choose to use an endless loop before the subroutine but you could just as easily use a 'goto' to skip over it and have more code.
Comments
The total 'forward' time is:
· 'forward'·command to 505
+· pause 180
~ 180 m sec
*··10 loop iterations (number of times this loop is performed).
~ 1800 m sec
I have attached some code with comments which may be interesting.
DO ' Do the loop 10 times
RobotData = RobotForward ' Move forward
GOSUB RobotSend
PAUSE PauseTime ' Wait msecs between RobotSend commands
LOOP ' Repeat Again
It should have been:
FOR sendCmd = 0 TO 9 ' Do the loop 10 times
RobotData = RobotForward ' Move forward
GOSUB RobotSend
PAUSE PauseTime ' Wait msecs between RobotSend commands
NEXT
Don't forget to declare variable 'sendCmd'.
My son has some of his TAB SUMOBOT code posted on our WEB page. Please have a look at it.
I encourage you to read through the·CD that came with the robot. It will take you through·several code writing execises.·The manual on the CD·is not as well written as the Parallax material but it is the only way for you to learn how your TAB SUMOBOT works.
In case you weren't aware of it, there is a Yahoo Group which deals exclusively with the Tab Robot Kit. Here is a link to that Yahoo Group:
http://groups.yahoo.com/group/tabrobotkit/
Regards,
Bruce Bates
'
' { $STAMP BS2 }
'|||||||||||||||||| Variables ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PauseTime VAR WORD ' Create a 16 Bit Variable
CountMoves VAR NIB ' Create a 4 Bit Variable
RobotData VAR BYTE ' Data Byte to Send to/Receive from Robot
'||||||||||||||||||| Constants ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RobotStop CON 0 'Stop the Robot
RobotForward CON 5 ' Move Forward for 200 msecs
RobotReverse CON 6 ' Move Reverse for 200 msecs
RobotLeft CON 7 ' Turn Left for 200 msecs
RobotRight CON 8 ' Turn Right for 200 msecs
RobotPWM0 CON 11 ' PWM = 0% Duty Cycle
RobotPWM1 CON 12 ' PWM = 1st "Notch"
RobotPWM2 CON 13 ' PWM = 2nd "Notch"
RobotPWM3 CON 14 ' PWM = 3rd "Notch"
RobotPWM4 CON 15 ' PWM = 100% Duty Cycle
LED CON 11 ' LED, Negative Active On
SC CON 14 ' Define the Serial communications Clock Pin
SD CON 15 ' Define the Serial communications Data Pin
'|||||||||||||||||||| Main Code |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
debug "forward"
HIGH SC ' Set the I/O Bits As O/P - Required by the 505
HIGH SD ' and High - Required by the 505
HIGH LED ' Turn off the LED
PauseTime = 80 ' msecs between commands
PAUSE 100 ' Time for the electronic circuits to startup
RobotData = RobotPWM0 ' Set the speed to 0 of 4 since Behavior 1 will probably start.
GOSUB RobotSend
RobotData = RobotPWM4 ' Set the speed to 0 of 4 since Behavior 1 will probably start.
GOSUB RobotSend
FOR CountMoves = 0 TO 1 ' Do the loop # times
RobotData = RobotForward ' Move forward
GOSUB RobotSend
PAUSE PauseTime ' Wait msecs between RobotSend commands
RobotData = RobotStop ' Stop the Robot
GOSUB RobotSend
RobotSend: ' Send the Byte in "RobotData"
LOW SC ' Hold Low for 1 msec before
PAUSE 1 ' Shifting in Data
SHIFTOUT SD, SC, LSBFIRST, [noparse][[/noparse]RobotData]
HIGH SC
return
I didn't look through your coding all that thoroughly, but there is definitely a NEXT statment missing after your FOR statement. Additionally, I don't see anywhere that the variable CountMoves is incremented or decremented or even referenced anywhere in your coding except in tha FOR statement mentioned above. Lastly, you are probably going to drop right into the RobotSend coding. The RobotSend coding is a sub-routine, and it should only be accessed by a GOSUB statement.
I'd clean up at least that much before you try toactually troubleshoot it any further.
Regards,
Bruce Bates
I'll invite the guys who designed the robot into this discussion.
Ken Gracey
Parallax, Inc.
I modified·the code to·make·it·stop after the forward commands. I also tested it on my TAB SUMOBOT.·The·sub-routine had been a part of the main program logic. When the context came to the 'Return' statement it caused the program to start over again. I choose to use an endless loop before the subroutine but you could just as easily use a 'goto' to skip over it and have more code.
The·code is attached.