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 / 1865
1864  |  1866
Subject: 
Re: IR-based proximity measurement
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 9 Jun 2006 01:56:15 GMT
Viewed: 
10126 times
  
In lugnet.robotics.rcx.nqc, Mathew V. Jones wrote:
I'm changing the subject line in the middle of the thread. Wonder what the
server will do with that...


I tried out Brian's "Max-picking" ping method, as well as a few other things.
Here's a summary of what I found:

1) If the active sensor readings are averaged to improve the signal to noise
ratio, then using SendSerial() to send 16 continuous bytes of 1's through the IR
Comm port works better than using SendMessage to only send one byte. Not too
surprising. I reckon the SNR is around 2-4 at best, using any of the averaging
methods I tried.

2) If Max-picking is used instead of averaging, the SNR gets (finally!)
adequately high, around 7-8 depending on how you eyeball it. This is a really
great idea, and the more I think about it the more I appreciate why it works so
well in this situation. My calibration code beeps with a pitch proportional to
the estimate of proximity, and I can pretty much tell how far away from the wall
the bot is just by listening.


I put the code and some calibration figures here, if anyone's interested:

http://www.physiology.wisc.edu/jones/robotics/proximity/SerialPing.nqc
http://www.physiology.wisc.edu/jones/robotics/proximity/SendMessagePingAvg.jpeg
http://www.physiology.wisc.edu/jones/robotics/proximity/SendSerialPingAvg.jpeg
http://www.physiology.wisc.edu/jones/robotics/proximity/SendMessagePingMax.jpeg
http://www.physiology.wisc.edu/jones/robotics/proximity/SendSerialPingMax.jpeg

Cheers,

Matt

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 wrong? Here is the code:

/*
sensor.nqc /cr 2006 June 9 /lm 2006 June 9 / rt

proximity sensor, simply displaying a value i expect to be correlating with a
distance

derivied from SerialPing.nqc by Matt Jones, Sept 2005
*/

int eyeoff; // passive light sensor reading
int eyeon; // active light sensor reading
int epct; // 100*(active-passive)/passive
int disp;

task main()
{
// Set up sensors & IR Tx
SetSensorType(SENSOR_1, SENSOR_TYPE_LIGHT);
SetSensorMode(SENSOR_1, SENSOR_MODE_PERCENT);

SetTxPower(TX_POWER_HI);
SetSerialComm( (SERIAL_COMM_DEFAULT) ); // 2400 Baud, 50% duty cycle - tried other settings too, didn't seem to matter
SetSerialPacket(SERIAL_PACKET_DEFAULT); // plain data bytes

// 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;}

int avreps = 10, eo;
PlayTone( 440, 5 );
while (true)
{
eyeoff = 0; eyeon = 0;
eo = 0;

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

SendSerial(0,16); // SendSerial, here before loop seems to work best

repeat(avreps) // either average or take the maximum of several active readings ("Max-Picking", great idea suggested by Brian Davis)
{

//Either do this:
// eyeon = (eyeon + SENSOR_1); // add for averaging later

// OR do this (not both)
eo = SENSOR_1; if (eo > eyeon) { eyeon = eo; } // grab maximum
}

eyeoff = eyeoff / avreps;
eyeon = eyeon / avreps; // comment this out if grabbing maxima

// time = FastTimer(0); // Read timer at 10 ms/tick resolution

epct = 100 * (eyeon-eyeoff)/eyeoff;

disp = 100*epct;
SetUserDisplay(disp,  0);
PlayTone( 100+100*epct, 5 );
        // PlayTone( 880, 5 );
}

}



Message has 1 Reply:
  Re: IR-based proximity measurement
 
(...) 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 (...) (18 years ago, 9-Jun-06, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  IR-based proximity measurement
 
I'm changing the subject line in the middle of the thread. Wonder what the server will do with that... I tried out Brian's "Max-picking" ping method, as well as a few other things. Here's a summary of what I found: 1) If the active sensor readings (...) (19 years ago, 16-Sep-05, 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