To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1866
1865  |  1867
Subject: 
Re: IR-based proximity measurement
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 9 Jun 2006 12:02:38 GMT
Viewed: 
10292 times
  
In lugnet.robotics.rcx.nqc, Ralph Toepper wrote:

can anybody tell me, what i did wrong?

   Well, there were a couple of typos, but only one I found that was critical.
If you are using a "max-picking LIDAR" method, you do *not* want to divide by
the number of samples. The variable "eyeon" in your code should end up with the
brightest return, not the average... but when you divide eyeon by the number of
samples, it suddenly contains a very small number that you don't want.

A couple of other points...

// initialize the 16 byte serial data buffer
// with all 1's. Sending all 16 bytes in a row
// should give a long IR blast
int dummy = 0;
repeat (16) {SetSerialData(0, 0xff); dummy = dummy + 1;}

   I'm not sure why you have a counter variable here, as you are always setting
the first byte (and in this code only the first byte) of the serial data to
0xFF. I think what you were trying to do was set the first 16 bytes to 0xFF.
Also, ironicly, the RCX transmits 0xFF as an almost entirely IR *dark* serial
message (this threw me for a loop for quite some time, until I found it
documented in the original RCX internals website). So setting those serial bytes
to 0x00 might be better.

repeat(avreps) // average some passive readings
{
  eyeoff = (eyeoff + SENSOR_1);
}

   I'm not sure this is needed - usually, the baseline readings don't vary much,
and you can get away with a single sample. Much faster as well.

repeat(avreps)
{
   eo = SENSOR_1; if (eo > eyeon) { eyeon = eo; } >
}

   I condensed that down a good bit, but wanted to point out that a long repeat
isn't neccessarily the best way to do this. Really, you only want to sample for
a "b=right" return while you know the IR messsage is being sent. How long does
that take? How many of those samples from the above loop are ever "bright"? Can
you shorten the loop (thus increasing the frequency of "pinging") without
loosing any valid returns?

   There's a lot of tuning that you can do to this. Your version, once I correct
by not dividing away the maximum return, does a coule of pings a second. I know
it's possible to get it up to 10-15 pings per second, at least (if you need
that).

--
Brian Davis



Message has 1 Reply:
  Re: IR-based proximity measurement
 
Brian, thanks for your advice. it has told me what is happening physically. i build a one shot measurement program to answer your questions. here is the measurement result: Distance to wall: 26 cm (at night) 7740 7696 7666 7641 7639 7613 7613 7593 (...) (18 years ago, 11-Jun-06, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Re: IR-based proximity measurement
 
(...) i have downloaded the SerialPing.nqc program hoping to get an easy to use proximity sensor. i have modified it to work with only one light sensor. but it shows always -90 on the display. ok, sometimes -89 too. can anybody tell me, what i did (...) (18 years ago, 9-Jun-06, to lugnet.robotics.rcx.nqc)

13 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