Go to Post it's not the bot that makes the team great, it's the team that makes the bot great. - alicen [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
  #4   Spotlight this post!  
Unread 22-12-2008, 15:25
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: Program Axis Camera in c++

Note that I've never done this, I'm just giving somewhat-informed advice.

Ok, if you turn to page 53, there's a bit more detail about the processing step (I'm guessing you've read that too).
Here's the code
Code:
TrackingThreshold tdata = GetTrackingData(BLUE, FLUORESCENT);
This line declares a TrackingThreshhold structure. Based on the comments on the PDF and the way it is used in the code, this appears to be a block of settings that is later used by the FindColor function to do its image analysis. In this case, it appears that they are filling it with pre-set defaults for a generic blue color.

Code:
ParticleAnalysisReport par;
This declares a ParticleAnalysisReport structure. This structure is filled with many useful image-analysis results by the FindColor function.


Code:
if (FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation, &tdata.luminance, &par)
This is where the magic happens. The FindColor function uses the Hue, Saturation, and Luminance (another way of specifying a color, it is like RGB) from the TrackingThreshhold object to tell it what to look for, then returns its results in the ParticleAnalysisReport structure. Note that they use an if statement here. This is because FindColor returns 1 on success, 0 on failure. I haven't found definitions for what it considers success of failure, but I'd guess (just a guess) that it returns failure if it can't find a good enough blob.

Code:
{ 
  printf(“color found at x = %i, y = %i", par.center_mass_x_normalized, par.center_mass_y_normalized); 
  printf(“color as percent of image: %d", par.particleToImagePercent); 
}
This is where you would act on the results. The center_mass_x_normalized variable tells you where the best match (the biggest blue blob, in this case) is on the x axis. -1.0 means it is on the edge of the camera's vision to the left, and 1.0 means it is on the edge of the camera's vision to the right.

So if I understand your question, you would want your robot to turn left if you see a value less than 0.0, turn right if you see a value more than 0.0, and remain still if the camera value is at 0.0. It would be a good idea to use a PID loop to control this, however, because you'd get big oscillations if you had a simple algorithm like that.

Last edited by Bongle : 22-12-2008 at 15:31.
 


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
Axis camera without the cRIO CrazyCarl461 NI LabVIEW 12 17-01-2009 10:53
Axis Camera Testing help koo_04 Programming 7 20-12-2008 13:55
axis camera - problem s0crates FRC Control System 11 16-12-2008 09:34
program camera kasemodz Programming 2 13-01-2007 15:59
EasyC Program For Camera? G1279 Programming 1 08-01-2007 19:00


All times are GMT -5. The time now is 12:52.

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