To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1803
1802  |  1804
Subject: 
Re: Running IR in the background
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Tue, 27 Mar 2001 20:21:11 GMT
Viewed: 
1390 times
  
Hannes,

I got it to work last night.  I'm modifying Markus Noga rover.c code
(included when you download legos files) to include support for IR port and
(passive) light sensor.  Great code to look at if you're just learning
C/C++.  Basically, the active sensor does a poor job of detecting obstacles
and is too sensitive to changes in ambient light levels.  I noticed using
ds_passive the values were much more stable (around 77-78) in almost any
normal lighting environment.  Even as I lowered the lights in the room the
values still seemed to stay around 77-78.  This may have something to do
with Marcus Noga processed light level routine in dsensor.h.  I thought at
first it just changes hex into dec, but apparently it changes  the entire
scaling and range of the light values.  It may be possible to get more
fidelity out of the original raw values...

Anyway, I am somewhat new to C/C++ and eventually figured out a way to make
the wait_event function exit even though waiting criterion (if touch
SENSOR_1 or touch SENSOR_3 pressed) had not been satisfied.  I will have to
send you Markus Noga code with my changes tonight or tomorrow (I don't have
it with me now).

I am able to set the range of the IR port to far (still not very far) and
pulse the IR port  as rapidly as I want to.  Light sensor (passive) detects
reflected IR pulses from obstacles.  I usually get values 80-85 when
obstacle present.  Light values increse as object gets closer.

Next project is to write code that increases sound tones as object gets
closer and/or slow motors down as object gets closer.

EFFECT:   Robot able to detect and avoid most obstacles (clear obstacles
seem to be a problem, white obstacles are not a problem) in its path 3-4
inches away.  For clear obstacles bumper used as last resort.  It seems
(although I have not tried it yet) that if you have a faster robot you just
need to pulse and sample quicker to avoid collision.

Hope this helps.  Ne1 with more insight about wait_event function please help.

V/r
Clayton


In lugnet.robotics.rcx.legos, Michael Ash writes:
On Tue, 27 Mar 2001, Clayton Epps wrote:

Did you ever get any help with your question (below)?  I'm trying to use = • the
IR port on RCX along with light sensor (passive) as collision detection
device.  Having the same problems you're having.

Commentary below.

In lugnet.robotics.rcx.legos, Hannes Naud=E9 writes:
Hi all

Is there any way to switch the IR LED on and leave it on. (as a kind of = • a
headlight for the light sensor.)

Alternatively, what is the easiest way to just send a comtinuous string = • of 0's
so it's on at least a lot of the time, without taking all the processor = • time.
I've been using lnp_logical_write() for all my IR up to now ,but it is a
blocking function so control only returns after the IR is allready off a=
gain.

I must have missed this one the first time around. lnp_logical_write()
will block, but it should only block the thread it's called from. Put your
send-zero loop in a separate thread and I think you should be set.

--=20
"From now on, we live in a world where man has walked on the moon.
And it's not a miracle, we just decided to go." -- Jim Lovell

Mike Ash - <http://www.mikeash.com/>, <mailto:mail@mikeash.com>



Message has 1 Reply:
  Re: Running IR in the background
 
(...) Congratulations! Could you post your source code here, to compare with the solution that we previously submitted to an almost identical question? We use an active light sensor reading in one taks, with a different task bangin zeroes using (...) (23 years ago, 28-Mar-01, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Re: Running IR in the background
 
(...) Commentary below. (...) I must have missed this one the first time around. lnp_logical_write() will block, but it should only block the thread it's called from. Put your send-zero loop in a separate thread and I think you should be set. (23 years ago, 27-Mar-01, to lugnet.robotics.rcx.legos)

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