CMUCam2 not tracking

We finally got the camera hooked up, and from before, I came up with the code to have the camera track without using pots. We have our camera directly attached to a turntable and the turntable is pwm01. The code we are using is:


	if (PAN_SERVO > 210)
	{
		pwm01 = 254;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO > 170)
	{	
		pwm01 = 180;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO > 150)
	{
		pwm01 = 150;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO > 133)
	{
		pwm01 = 140;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO < 120)
	{
		pwm01 = 110;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO < 100)
	{
		pwm01 = 100;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO < 60)
	{
		pwm01 = 60;
		Switch3_LED = 0;
	}

	else if (PAN_SERVO < 40)
	{
		pwm01 = 30;
		Switch3_LED = 0;
	}

	else 
	{
		pwm01 = 127;
		Switch3_LED = 1;
	}

Am I suppose to put this in Process_Data_from_Master_uP() or Default_Routine()? Also, does anyone see any problems in this, or am I suppose to call any functions before this or what. Because the camera just goes to the default position and doesn’t move when we turn it on. It doesn’t say “searching…” or anything in the Terminal Window. The camera doesn’t even tilt, so i know something is wrong. It is getting power, it is plugged into the TTL port and all of that. So any help would be appreciated since it is one of the last days :slight_smile:

Thanks,
Idaman323

The default pan servo is:

#define PAN_SERVO pwm01

Did you change this? Otherwise you are just changing PAN_SERVO.

Also, if your camera is not searching comment out the code you posted and get the camera working first. Search through the .c files for whatever pwm is your pan servo. Then note that it is assigned to at the top of Default_Routine() which needs to be commented out. Actually you would need to do this for both the pan and tilt servos.

We put our camera tracking to turret tracking code in a function called Turret_Tracking(). Then that function is called inside of Default_Routine(). We also call it in our autonomous code.

GOOD LUCK!

We are also having the problem where the camera locks onto nothing before it even starts searching. The red light on the camera lights up right as you power the robot.

So the camera wont even track until we get this situated

I am ahving the same problem. THe camera was tracking w/ the new board and such, but once we wired it and the gear tooth sensor w/ interrupt for th ggear sensor it did what you just said- gives a red light of lock when the robot turns on- all hat it does before this is center. Any help would be greatly apreciated, since alot depends on this camera.

i had this problem at a pratice compition i tried everything and couldn’t make it work. I pluged the camera into my computer and when i used labviewall the camera returned was a purple screen with three small blobs. I contacted IFI and they said they would repair or repalce it because it was defetive. You shoud try connecting it to labview just to check.

If you load the proper camera configuration file, a purple screen with bluish blobs is exactly what you should see in LabView. It’s trying to present the YCrCb data as if it were RGB, so the colors come out completely wonky. Purple represents pretty much everything below a certain brightness, and blue represents light sources. The green vision target light is one particular shade of blue, apparently indistinguishable from the others on the LabView display but easily detected by the camera itself.

when it show the screen i described i had not loaded any config. i was using the grab frame not tracking data view. every other time i hav edone this the camera would show a picture of the room.