Sumobot help!!!!!!!
madroboter9000
Posts: 18
OKAY HERE IS THE PROBLEM...I HAVE A SUMBOT KIT AND I AM ON THE 3.2 PART WHERE U SEE THE QTI SENSORS IN ACTION......I TYPED UP THE CODE GOT IT IN MY ROBOT BUT MY ROBOT DOESN'T MOVE!!!!!ARE THESE GOOD NUMBERS FOR MY QTI SENSORS????? LEFT QTI BLACK-1032 LEFT QTI WHITE-98-99 RIGHT QTI BLACK
1515-1516 AND ON WHITE 84...i have attached a file look at it!!!!
1515-1516 AND ON WHITE 84...i have attached a file look at it!!!!
Comments
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
HTH,
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Assumig you used the premade code, what exactly is the 'bot doing or not doing? To help we need details. Could be anytthing...
For one thing, are the batteries good? All plugs in the right place?
Details...
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
I'm a little confused. If you are trying the 3.2_Line_Sensor_Read code, the robot is NOT supposed to move. If you are using 3.3 it SHOULD move. #.2 shouldn't make anything click, all it should do is debug your QTI sensors's output.
What happened when you did 2.2_Motor_Test? Did the 'bot move? I'm assuming you did the motor alignment as well. The servos may not work properly until you do.
With the 3.3_Simple_Sumo, you should place the bot in the black part of the ring. It should travel forward until it finds the white rim of the ring, then turn back towards the center.
I wouldn't proceed with the IR sensors stuff until you get your 'bot to move.
HTH,
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Also, are you still typing in the code? If so, the problem may well lie there. If you typed it yourself, post it so we can take a look.
Try to put as much detail as you can in your replies. It will allow us to help you much faster. Without details like what code you are using, what happened and what you have tried, it is tough for us to give advice.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
the robot moved!!!!!!
' SumoBot-2.1-Motor-Align.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
LMotor PIN 13 ' left servo motor
RMotor PIN 12 ' right servo motor
'
[noparse][[/noparse] Constants ]
LStop CON 750 ' left motor stop
RStop CON 750 ' right motor stop
'
[noparse][[/noparse] Initialization ]
Reset:
LOW LMotor ' initialize motor outputs
LOW RMotor
'
[noparse][[/noparse] Program Code ]
Main:
DO
PULSOUT LMotor, LStop ' stop left
PULSOUT RMotor, RStop ' stop right
PAUSE 20
LOOP
END
' SumoBot-2.2-Motor-Test.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
LMotor PIN 13 ' left servo motor
RMotor PIN 12 ' right servo motor
'
[noparse][[/noparse] 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 700 ' right motor fwd; slow
RStop CON 750 ' right motor stop
RRevSlow CON 800 ' right motor rev; slow
RRevFast CON 1000 ' right motor rev; fast
'
[noparse][[/noparse] Variables ]
pulses VAR Byte ' servo pulses counter
'
[noparse][[/noparse] Initialization ]
Reset:
LOW LMotor ' initialize motor outputs
LOW RMotor
PAUSE 2000 ' time to disconnect cable
'
[noparse][[/noparse] Program Code ]
Main:
FOR pulses = 1 TO 65 ' fwd slow, ~12 inches
PULSOUT LMotor, LFwdSlow
PULSOUT RMotor, RFwdSlow
PAUSE 20
NEXT
FOR pulses = 1 TO 30 ' pivot 90 on left wheel
PULSOUT LMotor, LStop
PULSOUT RMotor, RFwdSlow
PAUSE 20
NEXT
FOR pulses = 1 TO 25 ' fwd fast
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RFwdFast
PAUSE 20
NEXT
FOR pulses = 1 TO 60 ' pivot 180 on right wheel
PULSOUT LMotor, LFwdSlow
PULSOUT RMotor, RStop
PAUSE 20
NEXT
FOR pulses = 1 TO 50 ' fwd fast
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RFwdFast
PAUSE 20
NEXT
FOR pulses = 1 TO 55 ' spin turn - clockwise
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RRevFast
PAUSE 20
NEXT
Hold_Position:
DO
PULSOUT LMotor, LStop
PULSOUT RMotor, RStop
PAUSE 20
LOOP
END
' SumoBot-3.1-Line-Sensor-Test.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
LLinePwr PIN 10 ' left line sensor power
LLineIn PIN 9 ' left line sensor input
RLinePwr PIN 7 ' right line sensor power
RLineIn PIN 8 ' right line sensor input
'
[noparse][[/noparse] Variables ]
lLine VAR Word ' left sensor raw reading
rLine VAR Word ' right sensor raw reading
'
[noparse][[/noparse] Program Code ]
Main:
DO
GOSUB Read_Left
GOSUB Read_Right
DEBUG HOME,
"Left ", TAB, "Right", CR,
"
", TAB, "
", CR,
DEC lLine, CLREOL, TAB, DEC rLine, CLREOL
PAUSE 100
LOOP
END
'
[noparse][[/noparse] Subroutines ]
Read_Left:
HIGH LLinePwr ' activate sensor
HIGH LLineIn ' discharge QTI cap
PAUSE 1
RCTIME LLineIn, 1, lLine ' read sensor value
LOW LLinePwr ' deactivate sensor
RETURN
Read_Right:
HIGH RLinePwr ' activate sensor
HIGH RLineIn ' discharge QTI cap
PAUSE 1
RCTIME RLineIn, 1, rLine ' read sensor value
LOW RLinePwr ' deactivate sensor
RETURN
'Mini_Sumo_3.2_Line_Sensor_Read.BS2
'{ $STAMP BS2}
'{ $PBASIC 2.5}
'----[noparse][[/noparse]I/O Definitions]
LLinePwr PIN 10 'left line sensor power
LLineIn PIN 9 'left line sensor input
RLinePwr PIN 7 'right line sensor power
RLineIn PIN 8 'right line sensor input
'
[noparse][[/noparse]Variables]
lLine VAR Word 'left sensor raw reading
rLine VAR Word 'right sensor raw reading
lineBits VAR Nib 'decoded sensors value
lbLeft VAR lineBits.BIT1
lbRight VAR lineBits.BIT0
'
[noparse][[/noparse]Program Code
Main:
GOSUB Read_Line_Sensors
DEBUG HOME, "LR", CR, 'show sensor readings
BIN2 lineBits, CR, CR
SELECT lineBits
CASE %00 'display actions
DEBUG "Continue forward" , CLREOL
CASE %01
DEBUG "Spin Left", CLREOL
CASE %10
DEBUG "Spin Right",CLREOL
CASE %11
DEBUG "Back up and turn around", CLREOL
ENDSELECT
GOTO Main
END
'
[noparse][[/noparse]Subroutines]
Read_Line_Sensors:
HIGH LLinePwr 'activate sensors
HIGH RLinePwr
HIGH LLineIn 'discharge caps
HIGH RLineIn
PAUSE 1
RCTIME LLineIn, 1, lLine 'read left sensor
RCTIME RLineIn, 1, rLine 'read right sensor
LOW LLinePwr 'deactivate sensors
LOW RLinePwr
'convert readings to bits
LOOKDOWN lLine, >=[noparse][[/noparse]1000, 0], lbLeft '0=black,1=line
LOOKDOWN rline, >=[noparse][[/noparse]1000, 0], lbright
RETURN
' SumoBot-3.3-Simple-Mini-Sumo.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
LMotor PIN 13 ' left servo motor
RMotor PIN 12 ' right servo motor
LLinePwr PIN 10 ' left line sensor power
LLineIn PIN 9 ' left line sensor input
RLinePwr PIN 7 ' right line sensor power
RLineIn PIN 8 ' right line sensor input
StartLED PIN 0 ' display start delay
'
[noparse][[/noparse] 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 700 ' right motor fwd; slow
RStop CON 750 ' right motor stop
RRevSlow CON 800 ' right motor rev; slow
RRevFast CON 1000 ' right motor rev; fast
'
[noparse][[/noparse] Variables ]
lLine VAR Word ' left sensor raw reading
rLine VAR Word ' right sensor raw reading
lineBits VAR Nib ' decoded sensors value
lbLeft VAR lineBits.BIT1
lbRight VAR lineBits.BIT0
pulses VAR Byte ' counter for motor control
temp VAR Byte
'
[noparse][[/noparse] EEPROM Data ]
RunStatus DATA $00 ' run status
'
[noparse][[/noparse] Initialization ]
Reset:
READ RunStatus, temp ' read current status
temp = ~temp ' invert status
WRITE RunStatus, temp ' save for next reset
IF (temp > 0) THEN END ' run now?
Start_Delay:
HIGH StartLED ' show active
PAUSE 5000 ' start delay
LOW StartLED ' LED off
'
[noparse][[/noparse] Program Code ]
Main:
GOSUB Read_Line_Sensors
' sumo movement
BRANCH lineBits, [noparse][[/noparse]Go_Fwd, Spin_Left, Spin_Right, About_Face]
Go_Fwd:
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RFwdFast
GOTO Main
Spin_Left:
FOR pulses = 1 TO 20
PULSOUT LMotor, LRevFast
PULSOUT RMotor, RFwdFast
PAUSE 20
NEXT
GOTO Main
Spin_Right:
FOR pulses = 1 TO 20
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RRevFast
PAUSE 20
NEXT
GOTO Main
About_Face:
FOR pulses = 1 TO 10 ' back up from edge
PULSOUT LMotor, LRevFast
PULSOUT RMotor, RRevFast
PAUSE 20
NEXT
FOR pulses = 1 TO 30 ' turn around
PULSOUT LMotor, LFwdFast
PULSOUT RMotor, RRevFast
PAUSE 20
NEXT
GOTO Main
END
'
[noparse][[/noparse] Subroutines ]
Read_Line_Sensors:
HIGH LLinePwr ' activate sensors
HIGH RLinePwr
HIGH LLineIn ' discharge caps
HIGH RLineIn
PAUSE 1
RCTIME LLineIn, 1, lLine ' read left sensor
RCTIME RLineIn, 1, rLine ' read right sensor
LOW LLinePwr ' deactivate sensors
LOW RLinePwr
' convert readings to bits
LOOKDOWN lLine, >=[noparse][[/noparse]1000, 0], lbLeft ' 0 = black, 1 = line
LOOKDOWN rLine, >=[noparse][[/noparse]1000, 0], lbRight
RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen