Subject:
|
Re: IR collision avoidance
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 24 Feb 1997 16:13:07 GMT
|
Original-From:
|
[jwalden@]NoMoreSpam[vsymphony.com]
|
Viewed:
|
2197 times
|
| |
 | |
Hey Chris,
Thanks for the ideas, one questiom?. Can you pass along the Radio
Shack part numbers? It seems like there are older and newer RS parts
out there, what are you using?
JTW
In your message you said:
> 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
|
| (...) I don't have the RS part numbers, but I bought them within the last few months so if there are "old" and "new" ones mine are probably "new". I checked out the RS web page and found that what they currently have is RS part number 276-137, and (...) (28 years ago, 24-Feb-97, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:   
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|