Shop OBEX P1 Docs P2 Docs Learn Events
mini sumo problem — Parallax Forums

mini sumo problem

BOB55BOB55 Posts: 36
edited 2007-12-27 02:20 in Robotics
Im trying to build a mini sumo bot using a homework board, but I can't figure out how to connect the QTI's to the servos. How do·I connect the QTI's?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-12-26 18:51
    Are you using the minisumo kit from Parallax or building your own? The manual should show/tell you how to do it. What specific problem are you having?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • BOB55BOB55 Posts: 36
    edited 2007-12-26 18:53
    im building my own, but using the same parts from the kit
  • FranklinFranklin Posts: 4,747
    edited 2007-12-26 19:04
    get this www.parallax.com/Portals/0/Downloads/docs/prod/robo/sumobotman.pdf and read chapter 3

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • BOB55BOB55 Posts: 36
    edited 2007-12-26 19:53
    Thanks, that helped a lot for the QTIs, but now I need to find out how to connect the servos to the microcontroller so that they work with the QTIs.
  • FranklinFranklin Posts: 4,747
    edited 2007-12-26 21:48
    That should also be in the document.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • BOB55BOB55 Posts: 36
    edited 2007-12-27 00:51
    Ok I found out how to connect the servos, but now instead of going reverse the servo goes reverse then fowards until the QTI is over a black area.

    Post Edited (BOB55) : 12/27/2007 12:57:13 AM GMT
  • FranklinFranklin Posts: 4,747
    edited 2007-12-27 01:23
    attach your code so we can look at it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • BOB55BOB55 Posts: 36
    edited 2007-12-27 02:20
    Here's the code I used, its the same one from the book.



    ' 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
Sign In or Register to comment.