To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 1534
1533  |  1535
Subject: 
Re: IR collision avoidance
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Mon, 24 Feb 1997 18:31:30 GMT
Original-From: 
Chris Moore <cmoore@{Spamcake}cancun.rose.hp.com>
Viewed: 
1531 times
  
This question seems to come up a lot here so I thought I'd post to the list
rather than reply individually.  Here's what I'm doing for IR collision
avoidance.

First, the hardware:
I'm using 3 Radio Shack IR LED's in parallel and 3 Radio Shack IR receiver
modules.  One pair points straight ahead, one pair is 45 degrees to the left
and one is 45 degrees to the right.  The LED is mounted directly to the top
of the metal can of the detector with some double sided tape.  The left,
center, and right detector outputs are connected to digital inputs 15, 14,
and 13.

Now the software:
I have a global for each sensor, called left_ir_blocked, center_ir_blocked,
and right_ir_blocked.  The main routine starts up a process called
check_ir() - the code for it is below.  The check_ir() code turns on the
IR transmitter, then samples each of the IR inputs 20 times.  If it sees
reflected IR more than 7 times it sets the xxx_ir_blocked variable to 1,
otherwise it sets it to 0.  The threshold of 7 out of 20 samples was arrived
at experimentally.

Finally, to do wall following, the program uses only the front and left
sensors.
It first tries to 'aquire' the wall by driving straight until either
left_ir_blocked or center_ir_blocked is true.  Then it tries to follow the
wall by keeping the left IR blocked and the center IR NOT blocked using the
following logic:
   left_ir_blocked  center_ir_blocked
       No              Don't care           Veer left towards the wall
       Yes             Yes                  Veer right to avoid hitting the
wall
       Yes             No                   Continue straight.

Hope this helps.  Here's the check_ir code:

void check_ir(void)
{
  int i;
  int left_count;
  int center_count;
  int right_count;

  while (1) {
    left_count = 0;
    center_count = 0;
    right_count = 0;
    ir_xmit_on();
    for (i=0;i<20;i++) {
      if (digital(15)) ++left_count;
      if (digital(14)) ++center_count;
      if (digital(13)) ++right_count;
    }
    if_xmit_off();
    if (left_count > 7) {
      left_ir_blocked = 1;
    } else {
      left_ir_blocked = 0;
    }
    if (center_count > 7) {
      center_ir_blocked = 1;
    } else {
      center_ir_blocked = 0;
    }
    if (right_count > 7) {
      right_ir_blocked = 1;
    } else {
      right_ir_blocked = 0;
    }
  }
}



Message has 1 Reply:
  Re: IR collision avoidance
 
Some comments and a few questions for Chris (...) We have "forward" and 45 degrees right". We wall hug to the right while you hug to the left. We ignore IR to left and use only the left contact switch for collisions (rare). (...) We had way too much (...) (28 years ago, 25-Feb-97, to lugnet.robotics.handyboard)

Message is in Reply To:
  IR collision avoidance
 
Howdy, Is there anyone out there that can explain programming IC for IR collision avoidance. I have read the mobile robots book and everything in the IC manual I downloaded and the 6.270 hardware info but still haven't got a good grasp of the best (...) (28 years ago, 22-Feb-97, to lugnet.robotics.handyboard)

6 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR