![]() |
Program Axis Camera in c++
Hi, lately i have been doing a lot of studying c++. I've download the wpi code and looked over it pretty well, but i'm just not exactly sure how to program the camera. We haven't received our crio yet and I want to be ready to program it when we get it. Could someone explain to me how I would use the camera to track a specific color of light and then align that light in the center view of the camera? Do you have well commented code you could show me? Thanks for all your help.
|
Re: Program Axis Camera in c++
Camera documentation starts at page 41 of this document:
http://first.wpi.edu/Images/CMS/Firs...de_for_FRC.pdf |
Re: Program Axis Camera in c++
Yeah, I've read this, but I don't understand how this will take an image and align it in the center view of the camera. Could anyone highlight some code and explane it. thanks
|
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);Code:
ParticleAnalysisReport par;Code:
if (FindColor(IMAQ_HSL, &tdata.hue, &tdata.saturation, &tdata.luminance, &par)Code:
{ 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. |
Re: Program Axis Camera in c++
I haven't examined it yet, but Team 1114 released C++ beta test code that has basic color tracking autonomous functionality implemented on their 2007 robot. You may elect to see how they did it:
Click here. From their site: "The C++ code developed for teleoperated control of the robot. It includes examples of an IterativeRobot with one-joystick drive and simple arm control, as well as some convenience classes we wrote for double solenoids and the Logitech Dual Action Gamepad. Also included is an autonomous mode that tracks the green light and scores a tube on a spider leg, as well as a class for doing PID calculations 1114-style." (Yes, I know, I linked to a certain intermediate website instead of providing the direct link. Tough cookies! :) ) |
Re: Program Axis Camera in c++
Thanks guys for the help. Bongle, that is exactly what i'm looking for. Thanks alot.
|
| All times are GMT -5. The time now is 11:07. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi