Alright, I’m about to go insane, I really need help. I’m trying to calibrate the camera, per the instructions provided, and I think I’ve followed them as exactly as I can, but I can’t get the camera to see anything by yellow when calibrating for that color. Here’s a picture of the red target:
Do you see anything in that image that would make it not be able to find the obvious red target? Its lined up, and the camera 3 ft off the ground as the instructions say. I’m completely out of ideas, can anyone help?
Well, the sheets are out of the target mostly I think, but ya, tomorrow we’ll try covering those cabinets with something else (they are orange, and show up the same color as the targer on the camera). As far as lighting, its just in like a classroom kind of thing, I don’t really know what else to do for that, we’re gonna try some other things too. I’ll let you know if I get it, assuming my head doesn’t go through a wall… this has been 2 days straight of this…
And just curious, when we hit a color, we get the error “Tracking packet failed” in the little statusbar window of the GUI, where you see the messages about the camera, is this normal? Or could this be a part of the problem, I kind of forgot to mention that…
you might also want to use a more “rare” color. like, something bright and neon-esque. we used a very bright shade of blue (like on photoshop it would have great saturation, if that helps you imagine it better) and it found it just fine even while other team members standing around with the colors on their shirts and what not.
The instructions in START HERE are very specific. You must be on a dark floor resembling the field that FIRST will be using. In their example, there is no bright background. Neither should you have a bright background…
We just fired up the camera tonight and basically got the same “Tracking packet failed”. After reading the manual on the commands for the camera, I went into Hyperterminal and setup the camera to track all colors with no problem. I’m convinced the GUI screws up on certain PCs, probably the serial driver. I’m running a P4m @ 2.8Ghz and can’t get it to run. Here’s what I did to prove the camera tracked OK.
Setup camera playing field. Enter GUI and grab a frame.
Then hover the mouse over the triangle and left click on the field’s triange on the screen. If the triangle looks highlighted ok, then record the RGB values that are shown.
Close the GUI and open Hyperterminal ( keep power on the camera). setup for COM1 @ 115200, 8, n, 1
Type <ret> and make sure you get an ACK
Type SM 15 <ret> to enable auto tracking of servos
Type TC Rmin Rmax Gmin Gmax Bmin Bmax… where
Rmin = Your R value -25
Rmax = Your R value +25
Gmin = Your G value -25
Gmax = Your G value +25
Bmin = Your B value -25
Bmax = Your B value +25
Your camera should now be tracking… At least now I know the GUI is screwed up and I’m not going nuts
Lighting is extremely important as others have stated. In your picture, the automatic exposure control is adjusting based on the brightest spot in your frame, which are the white sheets. I’m guessing they are very bright (reflecting the lights in the room), and so the camera is under exposing the important parts of the frame (the red triangle).
If you have no control over lighting, the next best thing is to skip the calibration process altogether, and manually enter numbers in the text fields beside the calibrate buttons. If you want some numbers to start with:
Yellow = 36
Green = 44
Red = 90
we got these values working in a large highschool cafeteria with fluorescent lights covered with dingy yellow covers.
Once you enter these values, click on the “Color” tab, then click Track , and see how it looks. If you only see small patches of your triangle, increase the number for that color. If you’re picking up areas of color from the surrounding area, then drop it down.
THanks, we’re gonna get more black paper (the place that had it was closed last night) and use that to cover some places, and see how that works out, otherwise, I’ll try Phil’s code. Thanks alot
Remember in this camera system, the color white is composed of mostly green (59%)some red(31%) and a little blue(11%). If you were to look at the histogram output, you would see that the sheets are producing as much or more red output than the triangle. In addition, there is so much light reflected that the camera is in overload. Try shutting off the lights over the sheets and things should improve.
Pickle,
I set up a "test bed’ with ideal conditions, a black sheet and mini triangles placed about 3 feet away from the camera to really get a good understanding of what’s going on and how all the camera parameters work. The GUI stores “tuned” RGB values for FIRST’s selected colors in config.txt in the .java folder. You might want to just highlight the triangle in the frame grab window and make sure the RGB values displayed next to the grab fall within range of the parameters for that particular color in config.txt. If not, your colors and/or lighting may be off. You might want to alter the values in config.txt to get it going.
After getting a firm understanding on how this thing finally works and how to tune it, I’m really concerned about how well everything will work as a “system” on the field dealing with variations in lighting and the field. I wonder if FIRST will allow us to read the mean values off the real targets before the competitions. I can see it now…tee shirts with 120 255 0 20 25 300… written all over them.
Well, we covered the white with some black sheets, and then we did some other stuff to add more dark, and we got 3 values, but it seems that that made things worse, it couldn’t track any colors with them… Before calibration, we used hyper terminal to get the servo to follow green, and after, it wouldn’t follow anything. I’m really not liking this camera. I’m just going to assume that treacking green will be the most useful thing, since the vision tetras are green. Otherwise, I’ll set up something to get it all working using the manual method suggested earlier. Consider that image obsolete, there is no more glare, and no more black in the image. When we select the red triangle, its the only thing within the threshhold of 25 that gets selected in the image. shrugs Same story with green and yellow, however, I know green works, because I got it to track it. So ya
I think FIRST chose a special green so make sure you are using it if you are trying to calibrate with the GUI and default RGB values in config.txt. The .txt file also specifies the size of the targets and the green is smaller so you may have better luck if you duplicate the exact size of the smaller green target. I found that you can send commands down “manually” with the GUI and can prove things out by doing the following:
Launch GUI. Enter Config menu. Set White balance ON, Auto gain ON, and then hit Update All down on the bottom. Then run the Calibration to make sure you get good numbers. Either adjust lighting and/or alter config.txt to match your colors. You can use white balance on Auto Gain ON for testing but not in competition because they are too slow. These settings let the camera automatically adjust exposure settings for light.
Go to the Color menu and hit Track Yellow with the yellow target which is the easiest. You should see it highlighted with a red pixel in the centroid. If so, then try this because it’s a good demo:
A. Press STOP and then wait 10 seconds because the GUI hangs. I think there is trouble with the GUIs serial driver if you send commands while the camera is still streaming data. Then go to the Console entry box of the GUI on the top of the screen and type SM 15 to set the servos to autotrack the target. Press SEND to send the command to the camera. My GUI’s AutoTrack ain’t working and only sends SM 1.
B. Then type TC 100 255 75 255 0 20 <ret> in the console . The Camera should find the Yellow target and servos should track it as you move the target around.
That’s how I got it to work in my basement last night with a 3" Yellow triangle on a black sheet mounted about 6 feet away. Now it’s off to the school to try things out for real. Keep plugging away at it, you’ll get it. There is nothing else to do in autonomous mode.
I’m hoping they send out the numbers, because otherwise, calibrating at each competition will be a nightmare! I mean, numbers would have to be unique for each competition, but still, there should be a way to do it… I can’t imagine all teams will choose to use a vision system, but I feel that even if a majority of teams do, there will need to be either a whole “calibration field” with the same lighting as the real one, or a huge chunk of time for calibrating cameras. I think that would be insane… Has anyone come across any info on this?
Due to variences in the lighting environments and ambient light levels at each venue, the calibration values will be unique to each site. FIRST field staff will be providing calibration numbers at each event. This is documented in one of the manuals. I forget which one right now, but will look it up and give you the reference when I find it.
Has anyone noticed strange things in the default code that runs the camera??
In camera.c the function:
int camera_const_cmd(rom const char *cmd_str)
terminates on \r or NULL and will send the \r or NULL out the serial port. I guess the camera won’t choke on the NULL but the camera has to see the \r to process the command and sometimes this function is called using a constant that has the \r terminator like:
rom const char *Str_cr = “CR 19 32\r”; // terminate string with \r
and other times it calls it with:
rom const char *raw_mode = “rm 1”; // no \r here
I know the code works because we are running it fine. ???
Another weird thing in camera.c is the call
camera_const_cmd(manual_agc);
which sets BIT 5 of the Common control B reg in the camera.
This bit sets 8 bit format for the UV bus rather than 16 bit and has nothing to do with AGC.
ALSO… camera_auto_servo( ) sets the SP parameters but rom const SP parameters also exist in user_routines_DDT.c.