View Single Post
  #2   Spotlight this post!  
Unread 04-01-2009, 21:22
nickmagus's Avatar
nickmagus nickmagus is offline
Registered User
AKA: Nick Clayton
FRC #0008 (Paly Robotics)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Palo Alto, Califorinia
Posts: 56
nickmagus is an unknown quantity at this point
Send a message via AIM to nickmagus
Re: Finding green/pink flags

I have had the same problem. I also tried.
Code:
if (StartCameraTask(10, 0, k160x120, ROT_0) == -1){
	printf("Failed to spawn camera task: %s\n",GetVisionErrorText(GetLastVisionError()));
}

// Set up camera tracking parameters.
tdata = GetTrackingData(GREEN, PASSIVE_LIGHT);
tdata.hue.minValue = 67;
tdata.hue.maxValue = 114;
tdata.saturation.minValue = 161;
tdata.saturation.maxValue = 255;
tdata.luminance.minValue = 24;
tdata.luminance.maxValue = 101;
in the init with
Code:
ParticleAnalysisReport par;
if (FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation, &tdata.luminance, &par)
		&& par.particleToImagePercent < MAX_PARTICLE_TO_IMAGE_PERCENT
		&& par.particleToImagePercent > MIN_PARTICLE_TO_IMAGE_PERCENT) {
	int lightX = (int)(par.center_mass_x_normalized * 1000.0);
	int lightY = (int)(par.center_mass_y_normalized * 1000.0);
	printf("Light found: x: %i y: %i\n", lightX, lightY);
} else {
	if (err)
		printf("Failed to spawn camera task: %s\n", GetVisionErrorText(GetLastVisionError()));
	else
		printf("light not found\n");
}
in the main loop but that didn't work either

Last edited by nickmagus : 04-01-2009 at 21:26.
Reply With Quote