Two Color Tracking Demo

Here is a version that tracks the gimbal type setup provided by FIRST. It works in autonomous mode. WPI has finally released it.

Anyone find the labview version yet?

EDIT: usfirst has(will have) a link to it on their 2009 control system page. I guess I’ll just wait for that to be up.

Thanks for the post and letting us know.

The LV version is at

Greg McKaskle

I can’t compile this code. The module Target.cpp calls a function “InArea” that is defined in the WPILib module TrackAPI.cpp. TrackAPI.h, however, does not declare this function. I could easily add this declaration to Target.cpp but I wonder if this was written for a WPILib that hasn’t been released yet. Some other posts have indicated that there are bugs in the vision system and this example may not address them. Has there been any WPILib update since 1/1/09 that I don’t have?

the function “InArea” can be found in the source code for build 1562 found here. The source has changed since the kickoff because the code I have from just before the kickoff doesn’t contain the InArea function either.

Try re-installing the Workbench update. It looks like they may have added it to this install. Otherwise you’ll have to re-build the source and link in the WPIlib.a file generated in the make process. The default location for the WPILib source tree ended up in C:\WinDriver\vxworks-6.3\WPILib.

I just downloaed the build 1562 from the WPI site and it is identical to the one that I downloaded on jan 2. My issue isn’t that the function InArea is missing from the library but that the declaration of it is missing from the header TrackAPI.h. The latest version does not fix this. If I put the declaration for InArea in target.cpp than the demo compiles and links.

I suspect that they have added the declaration of InArea to their version of the library but have not yet released it. The demo, however, seems to have been built with a newer library than the one we have.

Thanks for the LV link.


It’s possible to build the Camera Gimbal slightly back the front.

Looking at the gimbal from the front of the robot, the servo needs to be on the left hand side. It will go together just fine with the servo on the right, but the net effect is that up and down will be reversed on the Y servo.

It’s easy to spot this (as in my case) because when the camera sees the target, it sweeps up or down away from it.

I tried fixing it in software but I couldn’t quite get it working, so I opted for fixing the camera… It just meant detaching the servo horn from the tilt servo, and flipping the camera plate by 180 degrees. (Of course you have to invert the camera and rotate the base by 180 on the robot as well).

It’s a great example VI (for LabVIEW), able to be almost dropped right into either of the robot templates.

Is there anything special that needs to be done to use the LabVIEW version of this code? We tried running the code on the cRIO using the run button, and it refused to communicate. It was communicating just fine with other code we’d been working with (using the Basic Robot Main VI), so I’m inclined to think that it’s some sort of missing software update, but I’m not sure what that could be. Our team has update 2.0 of the FIRST robotics update (found using the about menu item).

We have gotten the camera to work before, connected to the cRIO and directly to our programming laptop.

Please help!


Yes… Most “sample” programs come configured with a generic tean number (read IP address) or none at all.

Once you open the project, you will see the IP address as part of the realtime program node name (cRIO Controller

Right Click on the Realtime node and select Properties.

From there you will see a place to change the program’s name and IP address.

Set it based on your team # 10.xx.yy.2

Now you sould be able to connect using the run button.
Make sure you RUN the main vi (eg: Two Color Servo Camera

Have Fun.

Yes, that was the problem. Thank you, PhilBot.

oh someone stated that the code must be run in autonomous mode…

is this true? that might be why iv had such a hard time all along.

@dani - The tracking is only active in autonomous mode, the tele-op is just the standard SimpleRobot tele-op.

Does anyone know if there are step by step instructions for asembling the camera gimbal assembly? I found the drawing on the FIRST site but the only part I can’t figure out is how to attach the “Axis Case” part to the camera? Other than that I could probably figure the rest out by looking at the drawings.

sorry which part… it is relatively easy just clarify which part and i can help you out

Can anyone explain to me how to open up the project in Wind River?

Also, when I was working with Labview, I couldn’t get it to track. I figured out how to power the servos with the jumpers included, but I couldn’t get the camera to actually autonomously move and track the colors, even though it did see it in the VI. Has any one had any issues similar to this?

anyone have pictures of how they set up thier camera?


The color values from this work beautifully. Weve got our camera tracking, both pan and tilt, from code we wrote using these colors in WindRiver. Ill be happy to post the code here if anyone wants to look it over.

Yes, please post your code – it would be nice to see another example.