PDA

View Full Version : Bug (?) in Target.cpp in TwoColorTrackingDemo


Mike Mahar
02-02-2009, 08:48 AM
We were getting very different tracking behavior when we were looking for a target with pink below green than when we were looking for pink over green. It turns out that the function FindTwoColors was comparing the relative areas of the two blobs when the position was set to ABOVE but not making the comparison when the position was set to BELOW.

There's a comment in the code that says that the comparison doesn't seem to be necessary but we are finding that it is. The green color description seems to be pretty generous and that any green of almost any shade was being accepted. If the actual target was set so that pink was above green and we were looking for geen above pink, FindTwoColor was returning true if there was almost any green in the background that appeared above the pink. That includes exit signs, posters on the wall, dark green objects on shelves, etc. Once we added a call to SizesRelative to the BELOW case, our problems went away.

I suspect the arena environment will be visually very noisy. Let's just hope that "The Pink Team" (very pink t-shirts) and "The Big Mo" ( florescent green t-shirts) don't sit one above each other in the stands. We'll have a bunch of robots trying to leave the field to dump moon rocks on them during autonomous.