Axis Camera 206 Tracking

Hello everyone,

So, this is my first year as programming for our robot. We use C++ and I need some help with target-tracking. I was never taught because we’ve never used the reflective tape or target tracking even in previous years. So, can someone point me to some documentation on it or help me out with the code? We have the basic 206 Axis Camera already programmed (with the one line of code to send it to the DS), and we want to use it to track the reflective tape on the hoops.

Is there anyone that can help me?

Thank you,
Eagle Engineering 1138

Hello, yes- I have the same problem… Only, we haven’t used the camera at all. I can run the camera over my router by connecting to its web address only.

I did try a few things; help to truly accomplish either would be great:

FIRST (pun intended- haha) I tried to use the National Instruments Vision Assistant 2011 (for OP: this should have been installed with FRC tools).

In doing this, as I understand it, I need to use the vision assistant to create code to find my target by creating a template, using a tracking option, et all, then going to tools and selecting create c code. After, I thought I was supposed to import and include the c code in my robot project (I am using simple template as a base) and use functions in the created c file to get values I need: how large the matching section is, where it is relative to the the screen and so on.

When I tried to include the header file that was created with the vision software (after importing both files), however, I had a long list of errors associated with the machine vision and windows includes in the c and h files.

Also, the windows include leads me to believe that the program is to be run on the driver station and not in the CRIO. If that is the case, how do I set it up?

Recently, I tried to create a custom camera using
http://first.wpi.edu/Images/CMS/First/FRC_Vision_API_Specification.pdf and WPI library documentation on virtual roadside.
I am, unfortunately, having serious difficulty discerning how to actually use these functions, i.e., imaqSetImageSize() will create an error despite the variety of ways I have tried to use it. That is only one example. I could really use a more “for dummies” version of an explanation of the library or better yet, an example of it incorporated in C++ code.

If there is some outside help, that would be great. Alternatively, I hope some of what I tried works better for you. You may need: https://decibel.ni.com/content/docs/DOC-14726

Here’s some very basic code that declares an image, gets it from the camera, analyzes it for bright spots (areas with pixels brighter than 215), and loop through the results, sending them to output.

You will likely want to run this on a separate task, as it greatly slows down the main operatorcontrol loop and makes the robot drive less smoothly.

ColorImage image(IMAQ_IMAGE_RGB);

			camera.GetImage(&image);
			BinaryImage* binImage;
			binImage = image.ThresholdRGB(215,256,215,256,215,256);
			if (binImage)
			{
				vector<ParticleAnalysisReport>* vPAR = binImage->GetOrderedParticleAnalysisReports();
				if (vPAR) 
				{
					for (int i=0;i<vPAR->size();i++)
					{
						ParticleAnalysisReport& par = (*vPAR)*;
						if (par.particleArea > 500)
						{
							printf("i=%i,	x=%d	y=%d,	bs=%d

", i, par.center_mass_x, par.center_mass_y, (int)par.particleArea);
}
}
delete vPAR;
}
delete binImage;
}

By the way, what is the one line we need to get the tracking on the DS working? We haven’t been able to get the live feed yet.*

The dashboard expects the camera to be setup to 10.te.am.11 and plugged into the DLink. You can recompile the DB and do things other ways, but that is the simplest and the recommended approach.

Greg McKaskle

We solved the issue that everyone was having with their cameras. The software that came with NI to setup the Axis Camera did not work, so we just manually set it up. See Setting up your 2012 FRC Control System and configure it manually. The line of code you need in order to get the live feed to the DS is:


AxisCamera &camera = AxisCamera::GetInstance();

If that doesnt work for you guys, just ask and I will tell you.

I will test the code you gave me later today. Thank you for the help.

Find the vision targets white paper pdf

This is really helpful

That’s the thing. I can’t seem to find these pdf’s. Can you give me a link?

The most important doc (and VERY well done I might add) is the Vision White Paper:
http://firstforge.wpi.edu/sf/go/doc1302?nav=1

The documents area of WPILib is also an excellent source of information:
http://firstforge.wpi.edu/sf/docman/do/listDocuments/projects.wpilib/docman.root.c_and_java_documentation

Bob Wolff