Shop OBEX P1 Docs P2 Docs Learn Events
Sumobot help!!!!!!! — Parallax Forums

Sumobot help!!!!!!!

madroboter9000madroboter9000 Posts: 18
edited 2007-05-26 21:05 in BASIC Stamp
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!!!!

Comments

  • JonathanJonathan Posts: 1,023
    edited 2007-05-25 01:50
    That code is not intended to actually move the sumobot. It's just to test the sensors. That is why it has a debud statement instead of the commands nedded to move the 'bot. Continue on with the book, you'll get there. :-)

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-25 01:58
    guys it is supposed to make the robot move 3.1 is the one which does the test....also are the numbers okay......plz help
  • JonathanJonathan Posts: 1,023
    edited 2007-05-25 02:03
    The code you attached will not make the robot move. Your left sensor seems to read a little low on black. All the rest seems fine. In any case, the robot will not move with the code you posted.

    HTH,

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • JonathanJonathan Posts: 1,023
    edited 2007-05-25 02:05
    Also, just in case you didn't know, all of the code is on the disc that came with the 'bot. Or if you don't have the disc, you can download it from the website, so you don't have to type it all in. Although typing it in is a help to understand the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-25 02:10
    okay than i do i make sure my left has more black.....what do i do after 3.2??????i tried 3.3 it doesn't work!!!!!!!!!!!what do i do!!!!this is my first robot
  • JonathanJonathan Posts: 1,023
    edited 2007-05-25 03:08
    3.3 should make the robot move. Did you type it in? If so, you might want to use the code from the disc, you might have made a mistake.

    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
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-25 05:01
    Okay the robot is just frozen it just isn't moving a dang bit....should i just go on to the leb step.....or does this step really matter?
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-25 05:11
    sorry i am doing 3.2.....my robot......does not move...it make a clicking noise.................also where should i place the robot?????on the ring on the white line????how do i make this work?????on the debug terminal 1 it is showing rx instead of tx how do i fix this????
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-25 05:17
    battery are fresh and wire are connected properly
  • JonathanJonathan Posts: 1,023
    edited 2007-05-25 13:03
    Mad,

    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
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-25 23:37
    okay...so i did the motor test the bot did not move that is good right?????this is my first robot plz help
  • JonathanJonathan Posts: 1,023
    edited 2007-05-26 01:25
    No, that is not good. If you loaded the Motor_Test_2.2, the 'bot should move. Things to check would be the wires connected to the servo motors. Make sure they are inserted the right way and snug. Did you calibrate the motors? The 'bot may not move properly if not.

    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
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-26 05:36
    yes in the 2.2 motor test!!!!everything went fine!!!!!!!!!!!i said i am having trouble in the 3.1-3.3 test!!!!my sensors are connected fine....but i have no clue what is going on.....on the 3.1 code where it test out the sensor it shows rx blinking instead of tx.....i need help fast!!!!!.....also my motor did not move in the pulse code test....in the motor 2.1 test the tires did not move....in the 2.2 test
    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
  • LSBLSB Posts: 175
    edited 2007-05-26 14:36
    Try adding a Debug "Robot Reset" line near the top of your program. It may be that the Stamp is resetting when the motors "click" on.
  • FranklinFranklin Posts: 4,747
    edited 2007-05-26 15:41
    You might also take out the 5 second delay at the start just while you are testing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • madroboter9000madroboter9000 Posts: 18
    edited 2007-05-26 21:05
    which code would this be???????
Sign In or Register to comment.