Shop OBEX P1 Docs P2 Docs Learn Events
how can i make my robot go faster? — Parallax Forums

how can i make my robot go faster?

lobolobo Posts: 100
edited 2005-12-03 20:29 in BASIC Stamp
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.

Comments

  • Russ FergusonRuss Ferguson Posts: 206
    edited 2005-12-03 14:33
    Lobo:

    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...
  • JonathanJonathan Posts: 1,023
    edited 2005-12-03 16:09
    Lobo,

    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
  • JonathanJonathan Posts: 1,023
    edited 2005-12-03 16:13
    Ooops! I didn't see the 100mS pause at the end!! Get rid of that!! That would explain the whole thing right there.

    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
  • lobolobo Posts: 100
    edited 2005-12-03 20:29
    guys i just read the replys i will try to do what ya sugested in a little bit. stay tuned thanks
Sign In or Register to comment.