Go to Post NERDs...gotta collect them all! - Conor Ryan [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 16-12-2012, 14:38
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Camera followiing

Hello CD!
In the downtime while waiting for the competition, our programming team is going to learn to program our cameras (because we'll have to for the competition anyways). The most interesting project we could come up with
is to utilize a camera to get our robot to track and follow, for example, a person wearing a red shirt, or a specific coloured ball. I've been reading through the "Getting Started with the 2012 FRC Control System" PDF and the WPIlib documentation, and haven't found much information on the topic. If anyone has any ideas, we would love to know about them! Thanks!
~Eric K
Reply With Quote
  #2   Spotlight this post!  
Unread 16-12-2012, 21:43
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,988
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Camera followiing

I'm not a programmer, so I can't give you specifics, but teams have had to do just this in several recent games. For example, in Aim High we "had to" track a green light, and in Lunacy we "had to" track a trailer with either red-over-green cloth or green-over-red cloth.

I put "had to" in quotes because it wasn't mandatory, but better teams could gain a lot from making it work.

So first look back in the archives, maybe something there will help more than the 2012 stuff.

The short version is:
Evaluate the image and find the color you are looking for
Then find the centroid of that color 'blob'
If the centroid is not in the center, turn the (camera, robot) so that it is.

Good luck!
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #3   Spotlight this post!  
Unread 16-12-2012, 21:57
AlexD744 AlexD744 is offline
Registered User
FRC #0744 (744 Shark Attack)
Team Role: Alumni
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Ft. Lauderdale, FL
Posts: 638
AlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond reputeAlexD744 has a reputation beyond repute
Re: Camera followiing

I didn't work in C++, we worked in Java. But this is a very helpful thing to know how to do before the season starts, so good for you!

The last few years they have been using retro-reflective tape as the vision target, which I would hope they continue to do as that stuff is really amazing. You need a light source coming from the camera (Ring lights work well, AndyMark has them via FIRSTChoice, and they can be purchased from superbrightleds.com), and the camera needs to be calibrated (low exposure was the biggest help for us), but once it is, the object will stick out like a sore thumb.

One thing to consider is that image processing takes a lot of time for the cRio, which can slow down (and even stop) the rest of the robot. I would recommend looking into using Network Tables to do the vision processing on your driver station. We did not personally do this as we only used automated tracking in autonomous (where the timing was less important, as the programmer has control of when everything runs), but many teams did use these with great success. The basic principle is that you send the image to the driver station, and it parses the image for the value corresponding to the x and y position of the center of the target. These values are returned to the robot and the robot acts based on those values (e.g. turn right, turn left). I do not know how to implement this though. I'm sure someone else on these forums does though.

Good luck!
__________________
www.sharkattack744.com
Reply With Quote
  #4   Spotlight this post!  
Unread 23-12-2012, 10:02
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Camera followiing

Thanks for your replies! I still don't have any idea how to program the camera, but I'm still trying! It is surprisingly difficult to look at code from years past, so acquiring reference code isn't all that easy We've been sifting trough the WPI library, but without any examples (except for the 2012 vision demo program that comes with the updates) we don't know where to begin. We're still working on the project, and any more help would be great! Thanks!
Reply With Quote
  #5   Spotlight this post!  
Unread 31-12-2012, 00:16
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: Camera followiing

@ekapalka,

While you didn't note what language, we're in the C++ forum so I'll assume that you are talking C++. Our team (Team 1967 - Janksters) did do vision tracking last year with very good success. Our code is on github and open sourced at https://github.com/bobwolff68/FRCTeam1967 and you'll find the vision code in a few classes - but the main routine as an example is found at https://github.com/bobwolff68/FRCTea...eting.cpp#L156

bob
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
  #6   Spotlight this post!  
Unread 01-01-2013, 21:05
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Thank you so much! This is exactly what I was looking for!

@bob.wolff68
By the way, as of 7:07pm (mt), the second link is dead... maybe just me... Thanks!

Last edited by artdutra04 : 03-01-2013 at 01:19. Reason: merged back-to-back posts together
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 13:05.

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