Go to Post "FIRST is not about getting as little help as possible - In fact, it's the opposite- the goal is have to make you feel obligated to thank as many people as possible for helping you in ways that you didn't really think you needed or even considered that you could use help." - boomergeek [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #22   Spotlight this post!  
Unread 19-01-2009, 17:47
laultima laultima is offline
Registered User
FRC #1458 (Danvillans)
Team Role: Alumni
 
Join Date: Feb 2007
Rookie Year: 2005
Location: Danville, CA
Posts: 87
laultima is on a distinguished road
Send a message via AIM to laultima
Re: Two Color Tracking Demo

Heres the code we're using for target tracking, using the color values from the TwoColorTrackDemo. All variables are doubles declared before the While loop, and pan and tilt are servos.

Code:
if (FindColor(IMAQ_HSL, &redData.hue, &redData.saturation,
					&redData.luminance, &aRed) && FindColor(IMAQ_HSL,
					&greenData.hue, &greenData.saturation,
					&greenData.luminance, &aGreen)) {
				redX = aRed.center_mass_x_normalized;
				redY = aRed.center_mass_y_normalized;
				greenX = aGreen.center_mass_x_normalized;
				greenY = aGreen.center_mass_y_normalized;
				centerX = (redX + greenX)/2;
				centerY = (redY + greenY)/2;
				panMove = (tan((PI/4)*centerX))/8;
				tiltMove= (tan((PI/4)*centerY))/8;
				pan->Set(pan->Get()+panMove);
				tilt->Set(tilt->Get()-tiltMove);
			}
__________________
2007 Davis/Sacramento Regional Winner (100, 997, 1458)

2008 Davis/Sacramento Regional Gracious Professionalism Award Winner

 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Camera tracking between two lights Ankush Dhar Programming 2 12-02-2007 23:44
Tracking two lights Render Programming 5 29-01-2007 18:14
Camera tracking demo in easyC or WPILib BradAMiller Programming 0 25-01-2007 14:01
Tracking Color? haywirerobotics Programming 0 14-01-2006 13:55
tracking two tetras? Anton Programming 5 09-02-2005 15:02


All times are GMT -5. The time now is 11:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi