Shop OBEX P1 Docs P2 Docs Learn Events
Boe-bot wall detection problems (IR) — Parallax Forums

Boe-bot wall detection problems (IR)

filurfilur Posts: 5
edited 2005-04-01 00:26 in Robotics
Hello!
My name is Johan and I'm new at this forum. I have worked with my boebot for many weeks now, but I have run in to a problem that i cannot solve. I'm using a sony remote to control the robots movements. But here comes the tricky part: I cant make it detect walls with the IR sensors when its driving. Is this possible? Im not very good at this and I was wondering if you could help me out here. I have attached the code. If you could modify it so it works the way i said i would be more than happy. Sorry for my english.

// Johan

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-12 15:47
    From looking at your code, your robot doesn't check anything to make it detect a wall. What hardware do you have for this purpose? I assume you are using the IR

    FREQOUT IR_Pin, 38500
    PULSIN IR_Decoder, CheckVal

    Syntax -- but I don't see it anywhere in your code.
  • Steve JoblinSteve Joblin Posts: 784
    edited 2005-03-12 18:40
    If your robot works with a Sony Remote Control, it is because the IR Receiver (and code) are working.· If your robot does not detect walls, it could be one of three things... 1.· The IR Led's are not working; 2. the IR Receiver is not working; or 3. the code is not working.

    You know that the IR Receiver is working (from using it with a Remote Control), therefore, it is either because the IR Led's are not working (or installed incorrectly (backwards), or you code is not correct.· Check both of these.
  • Aristides AlvarezAristides Alvarez Posts: 486
    edited 2005-03-12 23:14
    Hello Johan,
    ·
    I'm assuming that you already completed the experiments on the "Robotics with the Boe-Bot, Student Guide" (http://www.parallax.com/detail.asp?product_id=28154).
    ·
    It seems that your code is not checking the IR sensors to detect obstacles, but just listening to the instructions you send with your remote control.
    ·
    We have a brand new book that covers extensively the use of IR remote with the Boe-Bot.
    ·
    Please take a look at this page and download the book "IR Remote for the Boe-Bot" (for free as usual).
    http://www.parallax.com/detail.asp?product_id=28139
    ·
    This book will guide you step by step, from just receiving signals from an IR remote control to advance programming as Autonomous Navigation with Remote Speed Control.
    ·
    Regards,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aristides Alvarez
    Education and Technical Support Manager
    aalvarez@parallax.com
    Parallax, Inc. www.parallax.com
  • filurfilur Posts: 5
    edited 2005-03-13 13:07
    Hello again. I forgot to mention one thing: I haven't tried to make it detect the walls in the code that i attached, which you probably noticed. I would like to combine the code above with the code from "DisplayBothDistances.bs2". If the "distanceleft" < 1 then you should be able to make it run any furher forward. But when you have backed away from the wall and distanceleft > 1 you should be able to use the move forward button again. Sorry i didn't make myself clear enough in my previous post. If you could help me modify my code so it works like the way i said i would appreciate it a lot! Thanx in advance!

    // Johan
  • Aristides AlvarezAristides Alvarez Posts: 486
    edited 2005-03-13 19:14
    Hello Johan.

    Please check the book I provided the link on my previous post.
    All what you're asking for is covered there.

    You don’t only need a sample of working code.
    You also need to understand how each piece work by itself and how to integrate all pieces together in one single and complex program.

    That's the only way to learn to write your own code and that's what we try to teach through our Stamps in Class program books.

    Otherwise you'll always have to rely on code that someone else wrote.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Aristides Alvarez
    Education and Technical Support Manager
    aalvarez@parallax.com
    Parallax, Inc. www.parallax.com
  • gelfling6gelfling6 Posts: 60
    edited 2005-04-01 00:26
    bear with me folks, I'm yet another newbie..

    I think I have a bare-metal approach.. Yet another robot, using the bs2, The TAB Robotics version of the Sumo-Bot,
    has a program for solving a maze, by constantly taking a quick right to look for the wall, if detected, turn back, and go
    foward a few steps, Else, keep turning right a little till wall detected, then follow, or, if something detected to left, turn left
    till it's avoided..

    It's still quirky, but try this little number I whipped up for the BOE, to mimmick the behaviour..
    it does tend to SNAFU when it gets too close to a wall, but it does keep a 1-foot distance when
    it does as it's supposed to.. If anyone can improve on it, be my guest! I'd like to see it work flawless!!

    Just re-read original post.. It may also hitting a problem I noticed when using the BOE, and the TAB-Sumo..
    The TAB Sumo's IR remote, sends a serial IR pulse, that tends to interfere with the BOE's ability to
    track a wall by IR reflection, because it is getting the IR signals from (a) itself, (b) the remote.

    Anyways, forgive me.. It won't allow uploading as an attachment, so... there goes the forum... here comes the code.

    ' Robotics with the Boe-Bot - MazeSolver.bs2
    'Based roughly on the TAB Robotics version of the Sumo-Bot
    '4th behaviour, Follow along the right wall, to solve a maze
    'Assemble Boe-Bot as you would for Fast IR Roaming (pages
    '237 - 239), for the IR LED's & IR Detectors
    ' By Stephen Griswold (gelfling6@hotmail.com)

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    forx VAR Word
    counter VAR Word
    irDetectLeft VAR Bit
    irDetectRight VAR Bit
    pulseLeft VAR Word
    pulseRight VAR Word

    DO

    'first, detect if anything to the left

    FREQOUT 8, 1, 38500 'send blip to left IR LED
    irDetectLeft = IN9 'and detect with left IR detector
    FREQOUT 2, 1, 38500 'send blip to right IR LED
    irDetectRight = IN0 ' then detect on right IR detector

    IF irDetectLeft = 0 THEN 'OBJECT LEFT, TURN LEFT A FEW TIMES.
    pulseLeft = 650
    pulseRight = 650
    counter = 30
    ELSEIF irDetectRight = 0 THEN 'Wall detected to right,
    pulseLeft = 650 'only turn slightly left
    pulseRight = 650
    counter = 10
    ELSEIF (irDetectLeft = 0 AND irDetectRight = 0) THEN 'Wall directly ahead
    pulseLeft = 650 ' Turn around to avoid
    pulseRight = 650
    counter = 60
    ELSEIF (irDetectLeft = 1 AND irDetectRight = 1) THEN 'no objects, but not detecting
    pulseLeft = 850 ' wall. turn right slightly
    pulseRight = 850
    counter = 20
    ENDIF

    movement:

    FOR forx = 1 TO counter
    ' Apply the pulse
    PULSOUT 13,pulseLeft
    PULSOUT 12,pulseRight

    NEXT
    ' now move slightly forward
    FOR forx = 1 TO 20
    PULSOUT 13,850
    PULSOUT 12,650
    NEXT

    LOOP
    END

    Post Edited (gelfling6) : 4/1/2005 12:38:30 AM GMT
Sign In or Register to comment.