Sunday, November 20, 2011

ATL and light sensor variability discussion

Advance to Line...or Advance to White (ATW) as we call it now.  The program relies on two light sensors.  It is important these two light sensors measure reflective values identically.  But, with any sensor, LEGO or otherwise, there will be variability.  Put two thermometers next to each other and tell me if they give exactly the same reading!

We have another obstacle which is the fact the NXT-G 2.0 software's built in calibration block only enables us to calibrate one port, one sensor.  So, if we calibrate P3, these values will be used for our second light sensor that may be plugged into P2.  That's not optimal.  So we have mfg variability and software with a limitation.

What other variables can you think of?  Ambient light, brown vs blue, non solid dark color, flash bulbs, battery power, solar flares????  Our challenge as engineers is to reduce the impact of variables on our robot.

Raw values vs calibration values in NXT-G.  I read that the light sensors have a raw value range of 0 to 1024.  Dark is 0 and bright is 1024.  Personally I have taken a brick and put in this little program with the brick connected to the computer and watched the reflection value.  I still get 0 to 100.  I put it up to a light bulb and I get the max value of 100.  If you can figure out RAW please let me know.  I am assuming the below test program ensures I get a "non calibrated" reflectance value.  Educate me if I am wrong.

(update:  OK, we figured out how to get RAW values.  You need to expand the data ports and you will find a 'intensity' which is based on a scale 0 to 100 and you will see RAW.  Use this raw data plug and output it to your screen and poof!  We now know where to get raw LS readings!)

Experiment on XMAS1.

Justin and I tested the calibration program we used at the last regional.  I have not examined it closely to ensure it is correct, that is your job.  But here are some results after testing on the brown to white in front of pink bacteria.

Uncalibrated (UNC)
             dark        light         Threshold
Left         52           63                57.5
Right       53           66                59.5
Post calibration block (CAL)
Left          0            78
Right       24           98
Variance  24           20

Add some new light sensor shades Justin and I made.....

Uncalibrated (UNC)
               dark     light          Threshold
Left           50           63                56.5
Right         57           66                61.5
Post calibration block (CAL)
Left            0           82
Right        14         100
Variance   14           18

I'm just reporting the data and I'm not going to draw any conclusions.  That is your job.  Due to some of the "oddness" it would be good to repeat the testing a few times and see if we get the same results.  I would caution that the current light sensor calibration program might say left sensor when it is actually right.  Thus you don't want to jump to the conclusion of why the bot tended to line up a little to the left before it went forward for pink bacteria.  You would want to dig into the calibration program and follow the wires on the bot before you start down that road.

Why the exploration or quest to understand?

Well, encourage all of you to practice thinking about what happened vs. just getting mad at what happened.  That is a VERY HARD skill to learn, just ask an adult!  Those who think about why things happen vs. just reacting to things that happen are going to do well in life.  Focus the anger and frustration at figuring out why something failed.  And, with Google, forums, books, built in help on sofware, mentors, I can assure you most problems can be solved if you put in the effort!

But do we have time?  I'd like to explore using the File Access block to store readings and calculate a threshold value for each light sensor port and eliminate one of our variables.  It is unclear to me that shielding the light sensors buys us that much on our home mat.  It might buy us more at the competition mat.  Hummmm.

Reference material for this post.
Brian Davis' excellent tips document on how to use File Access blocks.
Some forum discussion on independently calibrating light sensor ports.
(12/11)  Another reference item to explore using File Access block.

Here are the light sensor shields in place.  You can't even see when the orange light turns on.  The team can decide if the design could benefit from shading in the back.


Click on either picture for full size image.

A picture from below.  It would seem to be in the clear and relatively strong.  I am sure it can be made stronger.  It will change the weight distribution on the robot a little.  We'll have to see if it causes the robot to behave differently due to weight.

No comments:

Post a Comment