Changing tracked color

Hi,
I have a small question. Let’s say I wanted to change the color the camera tracks during the game (for example from green to red). Do I need to change the R_MIN, R_Max etc. defines in camera.h or is there something else I need to do?

Thanks,
Guy

Yes, that is all you need to do. You can figure out what your defined limits are by playing around with the LabView CMUCam workspace or the CMU Java App.

That will work if you just want to track a different color for the whole game, but it sounds like you want to switch to a new color after you’ve been tracking one color for a while. If you want to change colors on the fly, then you’ll need to send a \r to the camera to stop tracking the current color, and then send it a new TC command with the new color.

This is correct. Changing the defines will change the color the camera tracks, but to change the defines requires you to recompile, which is difficult to do on the field. You will want to write some functions to re-initialize the color tracking on the camera on the field, updating it with the new color values to track.

Take a look at the Track_Color() function in kevin watson camera.c

www.kevin.org/frc

Thanks guys, I think I got it.

I also have a question… say if the camera is searching for a color… and you want to switch the color its tracking… should you say Camera_Idle(); …Track_Color(R,R,G,G,B,B)… then Servo_Track();?

I think you need to put the camera in raw mode first