Autonomous 2010 FRC

Just started work on autonomous and we have a few questions about CircleTrackerDemo and the Tracker Class:

First: Does anybody have the NetBeans CircleTrackerDemo working? If you do, we would love to take a look.

Second: How are you finding the soccer balls in autonomous? “If !carpet, then ball” seems error prone; does it work for anybody?

Third: What exactly does the CircleTrackerDemo do (Java to English translation please)?

Thanks,
Drew – Team 614

First of all, it works out of the box. and I noticed it cant track a soccer ball and it makes a green circle around the target and pink circle arount the other circle like stuff on the dashboard

We haven’t hooked up the gyro, so hopefully the demo will work once we do.

Are you saying it can find elliptical shapes but not a soccer ball? That seems oddly contradictory…

We know and expect the soccer to produce a circular shape, so we see a circle. The balls cast shadows and the edge is not well controlled, so the algorithm for detecting a strong edge between light and dark around the ball will often fail at some point. For that reason, the circle detection isn’t a great way to spot the balls.

I’ve posted info on ni.com/first discussing a pretty effective that looks for circular holes in the carpet. The carpet is pretty consistent and can be masked using color or even better, luminance. You can invert the mask, remove small particles, remove edge particles, and you are ready to get a particle report. Some of the fields you can ask for in the report compare perimeter distance to area, and if you think about the math, that is a pretty good filter for circular shapes. You may want to put in a few other filters and fiddle with the range, but you can build a particle based ball tracker pretty easily.

Also keep in mind that the camera needs to be mounted so that it can see the carpet in front of it.

Greg McKaskle

Greg,

I haven’t been able to find the imaq functions you talk about using through the FRC Java API. Do we need to make our own native interface for these or am I just not looking in the right place?

I can’t be certain, but I believe they are there in the Java interface as they are pretty common functions.

The first would be to get the lunimance plane, same as the ellipse finder it looks to be the getLuminancePlane() method. You can do this based on color, but I’m not sure that is much more effective than the faster luminance approach. Second you’ll want to thresholdHSL() or threshold ??? to get a BinaryImage type. The other particle filtering functions will be unique methods on a BinaryImage.

I’ll help more if you could point to a doxygen or similar function reference for the Java WPILib. I wasn’t able to locate one.

Greg McKaskle

The methods are definitely available in Java, we use them. Look in the ColorImage and MonoImage classes and you will find everything you need.

I don’t see any particle filter, thresholding functionality, or shape detection (except for ellipse detect) functionality. Where are they?

I was able to find this documentation online. I don’t have Java installed, you I’d assume you have class documentation installed with the source.

http://team2648.com/javadoc/edu/wpi/first/wpilibj/image/BinaryImage.html

This lists the particle report functions, but I don’t see the small particle filters or the edge exclusion which will also be useful.

Greg McKaskle

Are you talking about the ellipse detection methods or the small particle filtering and other morphology/binary processing functions in the NI vision library?

From what I can tell only a select few of the vision methods (that they thought would be helpful for tracking the target) were made available in the Java library.

The lower level stuff is called from Java by methods that are just wrappers for the call to the real functions (ala what JNI gives you) which I assume are written in C or LabView and are sitting in a .so somewhere. If you look in the NIVision class you will see what I mean, for instance MeasureParticle calls imaqMeasureParticle. I am not sure what is available in LabView so I don’t know what percentage of functionality is exposed to Java, but everything to do ball detection is certainly there, and you can use the higher level methods in ColorImage and MonoImage.

<ideasrule>
I don’t see any particle filter, thresholding functionality, or shape detection (except for ellipse detect) functionality. Where are they?

Not sure exactly what you are looking for here, the particle reports in the demo are filtered by user written code that compares the information returned to what is expected and generates a number that is compared to a threshold value. But I don’t get the feeling that is what you mean.

Are you looking to detect the edges yourself?