Log in

View Full Version : frc_camera not working but labview does


Issues
17-01-2006, 21:56
We can lock on and track the target with labview, but when we try to use kevin's code (frc_camera.zip)with the same configuration values it doesn't work properly. It continually searches for the target, and always returns a confidence value of 0. Here are the configuration values that we used.


#define AGC_DEFAULT 19 // Automatic Gain Control Register [0/0x00]
#define BLU_DEFAULT 128 // Blue Gain Control Register [128/0x80]
#define RED_DEFAULT 128 // Red Gain Control Register [128/0x80]
#define SAT_DEFAULT 128 // Saturation Control Register [128/0x80]
#define BRT_DEFAULT 2 // Brightness Control Register [128/0x80]
#define AEC_DEFAULT 3 // Automatic Exposure Control Register [127/0x7F]
#define COMA_DEFAULT 32 // Common Control A Register [36/0x24]
#define COMB_DEFAULT 32 // Common Control B Register [1/0x01]
#define COMI_DEFAULT 128 // Common Control I Register [0/0x00]
#define EHSH_DEFAULT 128 // Frame Rate Adjust Register 1 [0/0x00]
#define EHSL_DEFAULT 32 // Frame Rate Adjust Register 2 [0/0x00]
#define COMJ_DEFAULT 132

Any help would be appreciated.

Astronouth7303
18-01-2006, 12:42
Make sure the color spaces match. Kevin's code uses YCrCb. I don't know what LABView uses.

Kevin Sevcik
18-01-2006, 15:05
We had the exact same problem. Kevin's code DOES use the YCrCb colorspace. You can either recalibrate in that colorspace or change the camera's color space. In the frc_camera_s.zip program, the revelvant constant is in camera.h. Set COMA_DEFAULT to 40 to use RGB with no auto white balance.

kaszeta
18-01-2006, 15:17
We can lock on and track the target with labview, but when we try to use kevin's code (frc_camera.zip)with the same configuration values it doesn't work properly. It continually searches for the target, and always returns a confidence value of 0.

We had a similar issue, and the culprit in our case was the servo motor speed

1. Camera would start the search sequence, looking for targer.
2. First pan sweep wouldn't see it. Camera swings back to the left to start second sweep.
3. While the camera is sweeping back, the camera sees the target, but since it is in the middle of sweeping back to start the next scan, it loses lock on it and has to restart scanning.

Making some minor tweaks to the target tracking code fixed this for us.

It also helps to make sure the camera is calibrated correctly.

Issues
18-01-2006, 18:31
We have it calibrated in the right colorspace, but after further thought we think it is the direction the server tries to adjust itself when it is tracking that is backwards. Right when the red tracking light goes on, it moves away from the target. We tried flipping the jumpers, but since it is being controlled from the code we have to do it there... I was wondering if doing something like this would work...

in tracking.c

Change

pan_error = (int)T_Packet_Data.mx - (int)Tracking_Config_Data.Pan_Target_Pixel;

to

pan_error = (int)Tracking_Config_Data.Pan_Target_Pixel-(int)T_Packet_Data.mx ;

billbo911
18-01-2006, 18:46
We have it calibrated in the right colorspace, but after further thought we think it is the direction the server tries to adjust itself when it is tracking that is backwards. Right when the red tracking light goes on, it moves away from the target. We tried flipping the jumpers, but since it is being controlled from the code we have to do it there... I was wondering if doing something like this would work...

in tracking.c

Change

pan_error = (int)T_Packet_Data.mx - (int)Tracking_Config_Data.Pan_Target_Pixel;

to

pan_error = (int)Tracking_Config_Data.Pan_Target_Pixel-(int)T_Packet_Data.mx ;
Sounds like you have the servos connected to the RC on PWMs 1&2. Good!
Now open tracking.h and read the comments between lines 60 and 65. (This is for the Bells and Whistles version). The same configurations are available in the simple version as well.

Alekat
18-01-2006, 19:20
We had a similar issue, and the culprit in our case was the servo motor speed

1. Camera would start the search sequence, looking for targer.
2. First pan sweep wouldn't see it. Camera swings back to the left to start second sweep.
3. While the camera is sweeping back, the camera sees the target, but since it is in the middle of sweeping back to start the next scan, it loses lock on it and has to restart scanning.

Making some minor tweaks to the target tracking code fixed this for us.

It also helps to make sure the camera is calibrated correctly.

I think this solves the problem we were having today. Thanks! Oh and as far as calibration, it's best just to use the default numbers that come on kevin's code, trust me.

iBheat
18-01-2006, 19:23
// If your camera suddenly moves away from the target once
// it finds it, you'll need to change the sign on one or
// both of these values. Start with the tilt first.
#define PAN_ROTATION_SIGN_DEFAULT -1
#define TILT_ROTATION_SIGN_DEFAULT 1


That is the code in tracking.h!