Shop OBEX P1 Docs P2 Docs Learn Events
Help with Collision Avoidance Code (Boe Bot with BS2 Stamp) — Parallax Forums

Help with Collision Avoidance Code (Boe Bot with BS2 Stamp)

Turbo240Turbo240 Posts: 3
edited 2009-04-04 14:27 in Learn with BlocklyProp
I am working on a program for the Boe Bot that uses the PING))) eyes to detect walls. When the Boe Bot detects a wall to the left it executes a right turn fine. But, when it detects a wall to the right it won't execute a left turn correctly. Here is my code, any help is greatly appreciated.

Thanks.

Edited. Code is attached to the post below.

Post Edited (Turbo240) : 3/27/2009 2:09:17 PM GMT

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-03-27 04:14
    You need to ATTACH your actual code using the attachment manager so we can see what you are really running. As is your robot will go in circles instead of forward. Also if you could explain what you mean by not correctly. Could you let us know what it does you don't expect?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Turbo240Turbo240 Posts: 3
    edited 2009-03-27 14:06
    When I run the program, the Boe Bot will go straight until it detects a wall in front of it. Once the wall is detected it will then look left and then right to see which way is free of obstacles. If there is a wall to the left it will detect it and execute a right hand turn, and then continue going straight until it finds another wall. Then the process repeats, and will do fine as long as it only makes right turns. But, if a wall is detected in front of it and then looks left and right and finds there is a wall to the right it will turn left,but then stop and check left and right, turn left, stop and check left and right, turn left, and continues that sequence as if it were stuck in a loop.
  • SRLMSRLM Posts: 5,045
    edited 2009-03-27 15:22
    I wrote some code for something similar a long time ago, and posted it to the completed projects forum. You can take a look here:

    http://forums.parallax.com/showthread.php?p=741023

    Basically, it just avoids objects that it sees or feels.
  • Turbo240Turbo240 Posts: 3
    edited 2009-03-30 14:32
    Thanks for the info.
  • Rich GreenRich Green Posts: 11
    edited 2009-04-04 14:27
    Do a search for Daves_Quack_Code_v0.5.bs2, it avoids walls quite well. My Boe Bot sometimes wanders around my shop for hours without running into anything.
Sign In or Register to comment.