Go to Post the whole process is the most valuable part, not the award itself - Rich Kressly [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

 
Reply
Thread Tools Rating: Thread Rating: 5 votes, 4.20 average. Display Modes
  #46   Spotlight this post!  
Unread 11-02-2016, 00:09
riftware riftware is offline
Parent Mentor
AKA: Andrew Chandler
FRC #0031
Team Role: Mentor
 
Join Date: Dec 2013
Rookie Year: 2011
Location: Tulsa
Posts: 27
riftware is an unknown quantity at this point
Re: Tower Tracker 1.0

Quote:
Originally Posted by Fauge7 View Post
Team 3019 graciously presents their vision tracking program for everybody to use and borrow! Now instead of dreaming about the perils of computer vision YOU can bring your team the joy of having a robot that is capable of tracking the target with ease! No more Grip crashes or weird deploys, can calculate fun things such as: distance to target, and angle to target! to be used to auto align and auto aim!

if you are going to modify the code, all i ask is give me and my team credit in a comment at the top of the code and comment your suggestions and or your praise!
My students are using Grip to get the countours out of the streamer but were still working on distance to target last I checked. We identify valid targets by taking the ration of length to width which I think is working pretty well. I think they were looking at taking a couple of known distances and identifying size at those distances and then extrapolating for distances between. Your methodology looks very interesting but I did have a couple of questions on the "angle"

(Note: Its been 28 or so years since I had to do more complicated math so go easy on me). It looked like in the code you had a known angle of the camera (I'm assuming vertical angle.) and you are plugging that in. I get how this works more or less for figuring out distance/vertical angle. Where we are struggling a bit is in figuring out when we are "off center" - given what you can get out of a contour I'm not sure we would know that we need to move a bit to the right or left in order for a shot to work. Did you wind up solving that? If the contour had given us the boundaries of the rectangle's length or coordinates then I think we could evaluate relative sizes to know to move left or right but I'm not sure even about that. Any feedback is appreciated!
Reply With Quote
  #47   Spotlight this post!  
Unread 15-02-2016, 10:34
legts legts is offline
Autonomous Queen
FRC #2399 (The Fighting Unicorns)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2012
Location: Ohio
Posts: 73
legts is an unknown quantity at this point
Re: Tower Tracker 1.0

Would this code work with a Microsoft Lifecam?
__________________
Programming Captain on team 2399 for the 2016 season.
Programmer on team 2399 The Fighting Unicorns since 2014!
Engineering Inspiration Award GPR 2015
Semi-finalist Buckeye 2015 (thanks 4269 and 1987!)
Reply With Quote
  #48   Spotlight this post!  
Unread 15-02-2016, 12:07
lethc's Avatar
lethc lethc is offline
#gkccurse
AKA: Becker Lethcoe
FRC #1806 (S.W.A.T.)
Team Role: Alumni
 
Join Date: Nov 2012
Rookie Year: 2013
Location: Smithville, MO
Posts: 119
lethc will become famous soon enough
Re: Tower Tracker 1.0

Quote:
Originally Posted by legts View Post
Would this code work with a Microsoft Lifecam?
You will have to modify a few lines of code but other than that... Yes.
__________________
2016: Greater Kansas City Regional Finalists, Oklahoma Regional Winners, Tesla Semifinalists, IRI Quarterfinalists
2015: Greater Kansas City Regional Finalists, Oklahoma Regional Winners, Tesla Quarterfinalists, IRI Winners
2014: Central Illinois Regional Quarterfinalists, Greater Kansas City Regional Finalists, Newton Semifinalists
2013: Greater Kansas City Regional Winners, Oklahoma Regional Winners, Galileo Quarterfinalists
Reply With Quote
  #49   Spotlight this post!  
Unread 15-02-2016, 16:34
kinganu123 kinganu123 is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Piscataway, NJ
Posts: 243
kinganu123 is on a distinguished road
Re: Tower Tracker 1.0

Quote:
Originally Posted by lethc View Post
You will have to modify a few lines of code but other than that... Yes.
Wait, is there a way to offload the usbcamera data onto a program on the computer?! I thought that wasn't possible yet...
__________________
Reply With Quote
  #50   Spotlight this post!  
Unread 16-02-2016, 00:56
lethc's Avatar
lethc lethc is offline
#gkccurse
AKA: Becker Lethcoe
FRC #1806 (S.W.A.T.)
Team Role: Alumni
 
Join Date: Nov 2012
Rookie Year: 2013
Location: Smithville, MO
Posts: 119
lethc will become famous soon enough
Re: Tower Tracker 1.0

Quote:
Originally Posted by kinganu123 View Post
Wait, is there a way to offload the usbcamera data onto a program on the computer?! I thought that wasn't possible yet...
We are only using it to view the USB camera feed in the SmartDashboard
__________________
2016: Greater Kansas City Regional Finalists, Oklahoma Regional Winners, Tesla Semifinalists, IRI Quarterfinalists
2015: Greater Kansas City Regional Finalists, Oklahoma Regional Winners, Tesla Quarterfinalists, IRI Winners
2014: Central Illinois Regional Quarterfinalists, Greater Kansas City Regional Finalists, Newton Semifinalists
2013: Greater Kansas City Regional Winners, Oklahoma Regional Winners, Galileo Quarterfinalists
Reply With Quote
  #51   Spotlight this post!  
Unread 17-02-2016, 17:21
axton900's Avatar
axton900 axton900 is offline
Programming Co-Captain
FRC #1403 (Cougar Robotics)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2015
Location: New Jersey USA
Posts: 46
axton900 has a spectacular aura aboutaxton900 has a spectacular aura aboutaxton900 has a spectacular aura about
Re: Tower Tracker 1.0

Has anyone gotten a python version of this code to work?
In python many of the methods that this code requires do not exist and this is a problem for many teams that plan on using Python for their vision processing.
We have trying to port this code for use as sample code for days but as you can see many of the functions do not exist which causes problems.
Here is our code.. so far
http://pastebin.com/ecdDFDQp

the rectangle class is the main problem we are being faced with. There seems to be no equivalent for those using Python. If anyone has found a solution to this issue. Then please let us know!
Thanks!
Reply With Quote
  #52   Spotlight this post!  
Unread 18-02-2016, 14:06
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,062
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Tower Tracker 1.0

Quote:
Originally Posted by axton900 View Post
the rectangle class is the main problem we are being faced with. There seems to be no equivalent for those using Python. If anyone has found a solution to this issue. Then please let us know!
Thanks!
I believe that in the OpenCV python bindings rectangles are represented as tuples.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #53   Spotlight this post!  
Unread 19-02-2016, 00:04
Fauge7 Fauge7 is offline
Head programmer
FRC #3019 (firebird robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Scottsdale
Posts: 195
Fauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to all
Re: Tower Tracker 1.0

Quote:
Originally Posted by axton900 View Post
Has anyone gotten a python version of this code to work?
In python many of the methods that this code requires do not exist and this is a problem for many teams that plan on using Python for their vision processing.
We have trying to port this code for use as sample code for days but as you can see many of the functions do not exist which causes problems.
Here is our code.. so far
http://pastebin.com/ecdDFDQp

the rectangle class is the main problem we are being faced with. There seems to be no equivalent for those using Python. If anyone has found a solution to this issue. Then please let us know!
Thanks!
This code runs on the driver station laptop, there is 0 need to switch programming languages unless you want it to run on the rio. I would avoid running it on the rio as that can cause issues during the match. All you need to do is setup the program like i instructed then simply run it, maybe even export it to have a runnable .jar file and a simple batch file to make executing easier.
Reply With Quote
  #54   Spotlight this post!  
Unread 19-02-2016, 00:51
Breadbocks Breadbocks is offline
Registered User
FRC #1002
 
Join Date: Oct 2013
Location: United States
Posts: 39
Breadbocks is on a distinguished road
Re: Tower Tracker 1.0

We got it all compiled into a jar and running, but it never seems to open the connection to the camera. It's at the right IP, if we put the address in the code in our browser the mjpg stream comes up, but it just sits at opening forever in the cmd prompt.
Reply With Quote
  #55   Spotlight this post!  
Unread 20-02-2016, 10:47
Fauge7 Fauge7 is offline
Head programmer
FRC #3019 (firebird robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Scottsdale
Posts: 195
Fauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to all
Re: Tower Tracker 1.0

Quote:
Originally Posted by Breadbocks View Post
We got it all compiled into a jar and running, but it never seems to open the connection to the camera. It's at the right IP, if we put the address in the code in our browser the mjpg stream comes up, but it just sits at opening forever in the cmd prompt.
We had this problem too, we fixed it by installing the ffmpeg codec into the system32 like I mentioned on the front page.
Reply With Quote
  #56   Spotlight this post!  
Unread 20-02-2016, 14:09
JohnM's Avatar
JohnM JohnM is offline
Registered User
FRC #5854 (Glitch)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2013
Location: North Carolina
Posts: 53
JohnM has a spectacular aura aboutJohnM has a spectacular aura about
Re: Tower Tracker 1.0

Quote:
Originally Posted by Fauge7 View Post
We had this problem too, we fixed it by installing the ffmpeg codec into the system32 like I mentioned on the front page.
I did this, but it is still not pulling the images off the camera. I'm not exactly using this code, but the code is the same for getting the images from our network camera.
Any idea?
Reply With Quote
  #57   Spotlight this post!  
Unread 20-02-2016, 14:25
joeojazz joeojazz is offline
Registered User
FRC #5712
 
Join Date: Jan 2016
Location: Hemlock
Posts: 42
joeojazz is an unknown quantity at this point
Re: Tower Tracker 1.0

Do you know if you can find the distance with this anyone
Reply With Quote
  #58   Spotlight this post!  
Unread 21-02-2016, 12:17
Fauge7 Fauge7 is offline
Head programmer
FRC #3019 (firebird robotics)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Scottsdale
Posts: 195
Fauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to allFauge7 is a name known to all
Re: Tower Tracker 1.0

Quote:
Originally Posted by joeojazz View Post
Do you know if you can find the distance with this anyone
yes, update the constants with the constants on YOUR robot, you will find the distance to be accurate to within +- 6-8 inches.
Reply With Quote
  #59   Spotlight this post!  
Unread 22-02-2016, 14:58
joeojazz joeojazz is offline
Registered User
FRC #5712
 
Join Date: Jan 2016
Location: Hemlock
Posts: 42
joeojazz is an unknown quantity at this point
Re: Tower Tracker 1.0

Quote:
Originally Posted by Fauge7 View Post
Team 3019 graciously presents their vision tracking program for everybody to use and borrow! Now instead of dreaming about the perils of computer vision YOU can bring your team the joy of having a robot that is capable of tracking the target with ease! No more Grip crashes or weird deploys, can calculate fun things such as: distance to target, and angle to target! to be used to auto align and auto aim!

if you are going to modify the code, all i ask is give me and my team credit in a comment at the top of the code and comment your suggestions and or your praise!

to install:
  • download opencv 3.1 from here
  • download Network table 3.0 jar
  • make a new project in eclipse
  • make opencv and networktables added as a user library to the build path of your new project
  • copy opencv_ffmpeg310_64.dll from C:\Path\to\opencv\build\bin to C:\Windows\System32
  • add the code in a class that is named TowerTracker.java
  • when your ready to export
  • export the .jar file as a runnable jar
  • move the .jar to a folder similar to this
  • run the .jar with "java -jar c:\Path\to\TowerTracker.jar" on a command prompt window

the code is just an example of what it can do, i can add network table stuff soon but i thought i would publish it first!
github link

want to see an example of what it can output?
here you go!

how it works: using an axis camera or a mjpeg streamer you can use a stream of a webcam to process images using an opencv program that runs on the driver station computer. This program can be modified to run on a coprocessor and directly input to the roborio for even better results because network tables can only go at 10hz vs the camera stream which is 30hz...this program can easily be ported over to c++ and python and would probably run better with those as c++ and python are way more supported then java with opencv.
Can't find the .jar where is it located at.
Reply With Quote
  #60   Spotlight this post!  
Unread 09-03-2016, 16:50
alexpell00 alexpell00 is offline
Registered User
FRC #2972
 
Join Date: Feb 2016
Location: Boulder
Posts: 16
alexpell00 is an unknown quantity at this point
Re: Tower Tracker 1.0

Thanks for the code, really helped! If anyone is having trouble with the thresh holds you can take the HSV image to http://html-color-codes.info/colors-from-image/ to pull the hex colors of the target. Once you have 3-5 hex colors simply convert them to bgr and find the range from high to low (add/subtract 10% on either end to make it work better).
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 01:46.

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