Shop OBEX P1 Docs P2 Docs Learn Events
Boe-Bot newbie...problem with corners — Parallax Forums

Boe-Bot newbie...problem with corners

MrMikeMrMike Posts: 4
edited 2014-05-12 13:06 in Robotics
I hope this post doesn't waste anyone's time.· I'm fairly new to this whole thing.· I have a Boe-Bot, bought the whole kit with the book, etc., and have been learning the code.· I have my boe-bot set up to navigate via IR detectors.· For the most part it works great, but when it gets in a corner, it starts freaking out (obviously, because as each IR detector sets to 1 it tries to correct its direction) but it ends up twitching side to side.· Is there a way to overcome this?· I checked on the chapter, regarding the whiskers, and it gives code for escaping corners, but I think because the inputs are different, it doesn't work.· I tried implementing a counter and a for..next loop and ended up making my bot blind, because after I downloaded the code, the bot began running into things as if it didn't "see".

I've tried doing some research, but am not having much luck.· Any information is greatly appreciated.

Comments

  • FredRobotManFredRobotMan Posts: 2
    edited 2005-09-17 04:43
    A general programming approach to resolve your ploblem would involve asking how can the code determine when it is stuck. You have programmed sensors to sense a condition, when the condition is met, the program follows the instructions (algorithm) you provided it. So, look at your code and follow it through the progression. Your code works like this maybe, Sensor A condition is met - respond (turn right), check Sensor - B condition, If met > respond (turn left). When will it go forward when it is stuck in a corner? or in other words when does it execute the code to move forward when it is stuck? It shouldn't. Example. Sensor A tripped, stop, check sensor B, is it tripped also? If so, run turn around routine. So, look at your code, look and understand the sequence of how the sensors are tripped. Finally, have an escape (turn around) routine.
  • Jeffrey C.Jeffrey C. Posts: 17
    edited 2005-09-22 00:22
    You could also try the whisker program, but change the inputs to your IR detectors. You can still use the program with minor changes, but it is pretty simple once you get the inputs right and change whiskers to IRs. I don't think this makes sense, I hope the other guy's helps more. I'm pretty new too!
  • edited 2005-09-22 04:00
    When your Boe-Bot is stuck in a corner with IR, it is rapidly detecting left, both, right, both, right, left, etc... It's pretty random, so looking for a particular sequence won't work all that well. I think they way to detect this kind of "stuck" is to declare a couple of counter variables, and track the ratio of turn pulses to forward pulses. When the program counts 200 turn pulses, but only 40 forward pulses, it's probably stuck, so call a subroutine that makes the Boe-Bot do an about-face. (The 200 to 40 ratio is just a guess.) Your code will also have to clear the number of turns when numbers indicate that the Boe-Bot is not stuck.

    One way to determine your turn to forward pulse ratio is to let the Boe-Bot run for a while as it counts turns vs. forwards while stuck in a corner. Embed the roaming program in a FOR...NEXT loop that only has it roam for 2000 pulses. After the FOR...NEXT loop, the program should move on to a DO...LOOP that uses the DEBUG command to display the turn pulse count and the forward pulse count. After the Boe-Bot stops moving, connect it to your Debug Terminal and see what the numbers turned out to be. Repeat that exercise in a healthy roaming situation to find ratios that indicate that the Boe-Bot is not stuck.
  • MrMikeMrMike Posts: 4
    edited 2005-09-22 22:49
    Ah, yes...that makes sense.· The problem is, I couldn't figure out how to tell it count when it got stuck, but counting turns make a LOT of sense.· I'm going to go try that tonight after work.· Thank you very much, this gives me a direction to go in!!!· I'll update with my results (as well as code)

    Thanks again!!

    Mike
  • 1001110011 Posts: 1
    edited 2005-09-23 12:42
    i had some corner problems when i programmed the bot to ramp its turns based on the distance from an object.
    i found that turning the ir transmitters and detectors more to the sides made it much easier for the bot to navigate its way out of corners. the only situation was when it was facing directly into the corner and perfectly equidistant from both walls. but having a escape routine (such as back and do a 180) for when it continually registers a hit on both ir sensors takes care of that.
  • edited 2005-09-23 18:18
    Did you get it working? The problem is similar to recognizing a T intersection in the course shown in Chapter 8, Activity 3. Sorry, I haven't found that code yet; the T intersection activity never made it to the book. I remember it was a little tricky because both counters needed to be reset to zero periodically. It was somewhere between 60 and 230, but with ramping, it might be different. If the counters are not set to zero periodically and the Boe-Bot has been roaming for a while, it will take a long time to accumulate enough turn pulses to indicate that the Boe-Bot is stuck. Also, the "stuck" detection wasn't valid until after a certain number of pulses were counted. I think maybe I started looking for the stuck ratio after 60 pulses, and reset the counters after 230 pulses.

    BTW, there's a nice ramping routine in the Boe-Bot® Robot Navigation with Accelerometer Incline Sensing post.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-23 20:04
    19,

    ·· Adjusting the IR LEDs and Detectors does often help clear up many navigation problems.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • hoela4075hoela4075 Posts: 16
    edited 2014-05-01 21:31
    Hi! I know this is an old thread and I am an absolute newbie, but I recently bought a BOE Bot and I am loving it! But I am having the same problem with it getting lost in corners with the IR roaming. I am still trying to learn the programming, and also tried to drop the roaming with whiskers escape from corners program into the IR program (thinking that it would not work). Has anyone had luck with a programming solution? I have not figured out the counting function of programming. But I did come up with a hardware solution that works 90% of the time...I made sure the "eyes" were pointed a bit up (we have carpeted floors and the Bot looks down a bit when backing up), and put two different resisters on each eye; one 1K and one 2K. That makes him a little near sighted in one eye and he rarely gets stuck in corners now...but a programming solution would also be awesome.
  • xanaduxanadu Posts: 3,347
    edited 2014-05-02 20:05
    Counting is easy. Use a blank project to get started to keep things simple. You declare a variable, set the variable, then use + * / - to increase or decrease it. You can use debug to display it.

    For the navigation make sure your IR sensors are a little offset so they aren't looking directly forward.

    Add a variable to your program called "stuck".

    At the beginning of the program but outside of your movement loop set stuck to 0.

    In your program loop for each turn routine add 1 to the stuck variable.

    In your program loop for forward and reverse routines reset the variable back to 0.

    In your program loop add a line if stuck => 10 then gosub unstuck (doesn't have to be 10, experiment with it)

    Add a routine for getting unstuck, like a 180 degree turn, at the end of that routine set the stuck variable back to 0.
  • hoela4075hoela4075 Posts: 16
    edited 2014-05-12 13:06
    I also have an Activity Bot (but I know NOTHING about its code) and it never gets confused in corners. What is built into that program that is missing from the BOE Bot?
Sign In or Register to comment.