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 / 1868
1867  |  1869
Subject: 
Re: IR-based proximity measurement
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Sun, 11 Jun 2006 22:51:47 GMT
Viewed: 
10813 times
  
In lugnet.robotics.rcx.nqc, Ralph Toepper wrote:

Brian, thanks for your advice.

   You're welcome - it's a fun problem. At least partially because it's one of
the few times I've had to worry about the speed of bytecode execution under the
standard firmware (see below).

we only need six samples to
hunt the burst bright maximum.

   Given what you are transmitting and how you are looking for reflections, yes,
it seems six measurements "captures" the whole pulse. But there are some
assumptions there...

  SendSerial(0,15);
  while( cnt<10 )
  {
     eyeon = SENSOR_1;
     AddToDatalog(  eyeon  );
     cnt = cnt + 1;
  }

...you're sending a bunch of data bytes. *If* you could get a valid reflection
from a shorter pulse, you could use a shorter pulse, right? So the
(next)question is, how fast can you sample the light sensor? The above code
samples it once per loop, but there's a lot of overhead in a loop: copying the
sensor to a variable, then copying the variable into the datalog, incrementing a
counter, testing the counter to compare it to the end-of-loop condition, etc.
Try "unwrapping the loop" to get the highest-frequency sampling possible:

SendSerial(0,8);
AddToDatalog(eyeon);
AddToDatalog(eyeon);
AddToDatalog(eyeon);
AddToDatalog(eyeon);
AddToDatalog(eyeon);
[etc.]

When I did this, I actually used one RCX to send IR pulses, and a second RCX
with a light sensor that did nothing but as rapidly as possible write to the
datalog. That resulted in a sample every 3 ms, with SendMessage(255) taking
about 45 ms, and SendSerial(0,4) at 4800 baud resulting in a bright IR pulse
just 9 ms long (that's about the shortest I've found use for... I've gone
shorter, but the chance of "missing" a bright reflection gets too high).

burst brightness depends on battery power.

   It might, but I've never noticed any drop-off. I suspect that if the
batteries have enough voltage to power the motors, there's still more than
enough to saturate the IR transmitter.

--
Brian Davis



Message is in Reply To:
  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)

13 Messages in This Thread:


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

Custom Search

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