Shop OBEX P1 Docs P2 Docs Learn Events
Need assistance — Parallax Forums

Need assistance

CJWCJW Posts: 77
edited 2010-04-18 13:54 in BASIC Stamp
Hi,

I would like to know how to combined gripper and navigating with infrared headlights. can any1 guide me. Thank you

regards,
James

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-17 14:51
    If you look at the sample code for navigating with IR, you'll see that it really consists of some code that needs to be executed periodically, say a couple of times a second. The code generates a series of pulses of IR light at different frequencies and sees which pulse frequencies cause the detector to react. This gives an indication of roughly how far away the IR reflection is. This code can be used as a subroutine. Whenever you need a distance to the nearest object, you call that subroutine and you get a number some short time later.

    The gripper is something that has an "open the gripper" and a "close the gripper" action. Each can also be made into a subroutine.

    If your question is "Now what?", then you have to spend some time defining what you want your robot (presumably a BoeBot) to do. How do you want your robot to respond to obstacles and under what circumstances (distances detected by IR)? How do you want to use the gripper? What rules do you want to define for its use? Once you figure out some rules, you can reduce them to a program that uses the subroutines I've outlined. You may also have some actions like "turn right 90 degrees", "turn left 90 degrees", "move forward a specified distance (actually some period of time)".
  • CJWCJW Posts: 77
    edited 2010-04-17 15:40
    Hi Mike,

    I have do some programming. can u help me check any error. I also figuring how the item to go straight, left, right, backward. Below is my programming:

    ' BOEGripperIF.bs2 SIMPLE BOE-Bot Gripper Test Using Infra Red Detection

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    DEBUG "Program Running!"



    irDetectLeft VAR Bit ' Variable Declarations..
    irDetectRight VAR Bit
    pulseLeft VAR Word
    pulseRight VAR Word
    pulseGrip VAR Word

    DEBUG "Testing piezospeaker..."
    FREQOUT 4, 2000, 3000 ' Signal program start/reset..

    DEBUG CLS,
    "IR DETECTORS", CR,
    "Left Right", CR


    DO ' Main Routine..

    FREQOUT 8, 1, 38500 ' Check IR Detectors..
    irDetectLeft = IN9

    FREQOUT 2, 1, 38500
    irDetectRight = IN0
    ' Gripper Action..
    IF (irDetectLeft = 1) AND (irDetectRight = 1) THEN 'Gripper IF..
    HIGH 10
    HIGH 1

    pulseGrip = 1000 ' Close Gripper


    ELSE
    LOW 10
    LOW 1
    pulseGrip = 500 ' Open Gripper

    ENDIF


    DEBUG CRSRXY, 2, 3, BIN1 irDetectLeft,
    CRSRXY, 9, 3, BIN1 irDetectRight

    PAUSE 20 '(we PAUSE otherwise the servo hums,
    'gotta give the program time to run.)

    PULSOUT 13,pulseLeft ' Apply the pulse..
    PULSOUT 12,pulseRight
    PULSOUT 14,pulseGrip
    LOOP



    Yours Sincerely,
    James
  • FranklinFranklin Posts: 4,747
    edited 2010-04-17 15:59
    James, Have you loaded the code and tested it yet? That's how you will know if it works or not.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • CJWCJW Posts: 77
    edited 2010-04-17 16:50
    Hi Stephen,

    I load the thing but i felt is not stable, i can't upload the video inside. I have recorded the video to post here but they wrote this " You cannot upload files that use MIME type : video/x-ms-wmv." So how i load the video to show you.

    Yours Sincerely,
    James
  • Mike GreenMike Green Posts: 23,101
    edited 2010-04-17 17:03
    You cannot post video here. You can use a service like YouTube to host the video, then post a link to that here.

    It may be better to describe what you observe. A video by itself is often not very useful. You would need a description anyway.
  • CJWCJW Posts: 77
    edited 2010-04-18 13:54
    Hi,

    when it run it able to open and close even the Led. I can't let my robot move straight, right,left and backward.

    Yours Sincerely,
    James
Sign In or Register to comment.