Go to Post FIRST truly isnt about building robots, but allowing yourself to reach higher and farther than you ever could. - Brandon Holley [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-01-2012, 00:22
cjlane1138 cjlane1138 is offline
Team 1138
FRC #1138 (Eagle Engineering)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 88
cjlane1138 is an unknown quantity at this point
Axis Camera 206 Tracking

Hello everyone,

So, this is my first year as programming for our robot. We use C++ and I need some help with target-tracking. I was never taught because we've never used the reflective tape or target tracking even in previous years. So, can someone point me to some documentation on it or help me out with the code? We have the basic 206 Axis Camera already programmed (with the one line of code to send it to the DS), and we want to use it to track the reflective tape on the hoops.

Is there anyone that can help me?

Thank you,
Eagle Engineering 1138
Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2012, 02:21
Method's Avatar
Method Method is offline
Registered User
no team
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Ca
Posts: 38
Method is an unknown quantity at this point
Thumbs up Re: Axis Camera 206 Tracking

Hello, yes- I have the same problem.. Only, we haven't used the camera at all. I can run the camera over my router by connecting to its web address only.



I did try a few things; help to truly accomplish either would be great:


FIRST (pun intended- haha) I tried to use the National Instruments Vision Assistant 2011 (for OP: this should have been installed with FRC tools).

In doing this, as I understand it, I need to use the vision assistant to create code to find my target by creating a template, using a tracking option, et all, then going to tools and selecting create c code. After, I thought I was supposed to import and include the c code in my robot project (I am using simple template as a base) and use functions in the created c file to get values I need: how large the matching section is, where it is relative to the the screen and so on.

When I tried to include the header file that was created with the vision software (after importing both files), however, I had a long list of errors associated with the machine vision and windows includes in the c and h files.

Also, the windows include leads me to believe that the program is to be run on the driver station and not in the CRIO. If that is the case, how do I set it up?




Recently, I tried to create a custom camera using
http://first.wpi.edu/Images/CMS/Firs...cification.pdf and WPI library documentation on virtual roadside.
I am, unfortunately, having serious difficulty discerning how to actually use these functions, i.e., imaqSetImageSize() will create an error despite the variety of ways I have tried to use it. That is only one example. I could really use a more "for dummies" version of an explanation of the library or better yet, an example of it incorporated in C++ code.


If there is some outside help, that would be great. Alternatively, I hope some of what I tried works better for you. You may need: https://decibel.ni.com/content/docs/DOC-14726
Reply With Quote
  #3   Spotlight this post!  
Unread 21-01-2012, 10:18
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: Axis Camera 206 Tracking

Here's some very basic code that declares an image, gets it from the camera, analyzes it for bright spots (areas with pixels brighter than 215), and loop through the results, sending them to output.

You will likely want to run this on a separate task, as it greatly slows down the main operatorcontrol loop and makes the robot drive less smoothly.

ColorImage image(IMAQ_IMAGE_RGB);

camera.GetImage(&image);
BinaryImage* binImage;
binImage = image.ThresholdRGB(215,256,215,256,215,256);
if (binImage)
{
vector<ParticleAnalysisReport>* vPAR = binImage->GetOrderedParticleAnalysisReports();
if (vPAR)
{
for (int i=0;i<vPAR->size();i++)
{
ParticleAnalysisReport& par = (*vPAR)[i];
if (par.particleArea > 500)
{
printf("i=%i,\tx=%d\ty=%d,\tbs=%d\r\n", i, par.center_mass_x, par.center_mass_y, (int)par.particleArea);
}
}
delete vPAR;
}
delete binImage;
}


By the way, what is the one line we need to get the tracking on the DS working? We haven't been able to get the live feed yet.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-01-2012, 11:01
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Axis Camera 206 Tracking

The dashboard expects the camera to be setup to 10.te.am.11 and plugged into the DLink. You can recompile the DB and do things other ways, but that is the simplest and the recommended approach.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 21-01-2012, 11:55
cjlane1138 cjlane1138 is offline
Team 1138
FRC #1138 (Eagle Engineering)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 88
cjlane1138 is an unknown quantity at this point
Re: Axis Camera 206 Tracking

We solved the issue that everyone was having with their cameras. The software that came with NI to setup the Axis Camera did not work, so we just manually set it up. See Setting up your 2012 FRC Control System and configure it manually. The line of code you need in order to get the live feed to the DS is:
Code:
AxisCamera &camera = AxisCamera::GetInstance();
If that doesnt work for you guys, just ask and I will tell you.

I will test the code you gave me later today. Thank you for the help.
__________________
Eagle Engineering 1138
Reply With Quote
  #6   Spotlight this post!  
Unread 21-01-2012, 21:51
Method's Avatar
Method Method is offline
Registered User
no team
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Ca
Posts: 38
Method is an unknown quantity at this point
Re: Axis Camera 206 Tracking

Find the vision targets white paper pdf

This is really helpful
Reply With Quote
  #7   Spotlight this post!  
Unread 22-01-2012, 00:15
cjlane1138 cjlane1138 is offline
Team 1138
FRC #1138 (Eagle Engineering)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 88
cjlane1138 is an unknown quantity at this point
Re: Axis Camera 206 Tracking

Quote:
Originally Posted by Method View Post
Find the vision targets white paper pdf

This is really helpful
That's the thing. I can't seem to find these pdf's. Can you give me a link?
__________________
Eagle Engineering 1138
Reply With Quote
  #8   Spotlight this post!  
Unread 22-01-2012, 01:54
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Axis Camera 206 Tracking

The most important doc (and VERY well done I might add) is the Vision White Paper:
http://firstforge.wpi.edu/sf/go/doc1302?nav=1

The documents area of WPILib is also an excellent source of information:
http://firstforge.wpi.edu/sf/docman/..._documentation

Bob Wolff
Reply With Quote
Reply


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


All times are GMT -5. The time now is 03:02.

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