Monday, November 28, 2011

Travails of the dreaded light sensors Part I

Let us review a bit.

We have a few things which are causing us headaches.  Headaches only because we have to REALLY use our grey matter.  AKA, use our brains.

Last year we followed a black and white edge.  Recall the proportional line follower and our desire to be at 50% intensity.  And, the lines we used to align to were surrounded by WHITE!  Well, this year things are different.

The two major killers for us this year are:
  • We are using the crude NXT-G calibration block which is limited to calibrating just one port.  All the other ports have to use the "master" port calibration.  We have seen this causes inaccuracies.  As info, we calibrate P1, P2 has to deal with whatever P1 read.
  • The mat has COLOR and the white and black areas are small targets relative to last year's lines and it therefore impacts the viability of our ATL (advance to line) strategy.
So, we really have to think outside the box.  I believe we assumed we could simply re-use last year's code and did not give much more thought to it.  Myself included.  But, when it failed to work, we need to LOOK and not just react in frustration.

What we have done:

Perhaps I helped a little bit too much, but I wrote a program to read BOTH intensity and raw light sensor readings from each light sensor (or port) to the display.  This was HIGHLY educational for the team.  The team could now SEE how some areas of the brown would give us 0 intensity.  Madness, but if you are willing to put up with the crude NXT-G calibration block, these are the cards you are dealt and we must learn how to play to win.

On Monday we found we could get 100 intensity light reading on brown for PinkBacteria.  So, we went for a "sniff for black first" strategy.  Today, we seem to find 15 intensity in brown.  HUH??!?!?!  This is still a bit concerning but tonight I feel like we were really watching and thinking, more than Monday.

Very odd stuff but I am not discouraged.  At least now we UNDERSTAND what is eating our lunch.  I can live with that much easier than resigning ourselves to being unable to understand or even correctly identify the variable causing us pain.  You need to understand this too! If you don't, ASK QUESTIONS!

As of tonight we have at least three options.

Option A (MB_ATB4):

This program sniffs for black first on brown.  We had black set at 20 intensity or lower.  It would find values less than 20 and turn one motor...Lost Advance To Black (LATB).  But....after tweaking the threshold down to 3, it works great for the brown, light blue and dark blue.

Option B (MB_ATB5) Now MB_Max

Because of he insanity we were having with 20 intensity failing, Max made a ATB5 which sniffs for white, like 90 intensity!  And then advance to black, etc etc.  It too worked well.

Option C (Use both depending on which works best on the various 'non white' backgrounds)

We may find that one or the other works better on the various backgrounds and use different MBs for each program.  Testing is required.

So, at the risk of making this way too confusing, we now UNDERSTAND what is going on. We may not like it but we understand.  If we were really good, we'd log the two sensors readings during the run and then analyze the data and use this to help us decide what threshold to use for match2.  My point, we need to watch what happens and know what to look for.

See Part II for more drama.

No comments:

Post a Comment