Go to Post resist the hive: As goofy as this may sound, wires do take up weight, several pounds of it. - Rickertsen2 [more]
Home
Go Back   Chief Delphi > ChiefDelphi.com Website > Extra Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 12 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 30-04-2012, 12:55
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
paper: Team 341 Vision System Code

Thread created automatically to discuss a document in CD-Media.

Team 341 Vision System Code by Jared341
Reply With Quote
  #2   Spotlight this post!  
Unread 30-04-2012, 13:07
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: paper: Team 341 Vision System Code

Attached is a zip file containing everything you need to run FIRST Team 341's laptop-based vision system. We are very proud of this software, as it propelled us to 4 Regional/District Championships and the Curie Division Finals. Every shot our robot attempted in Rebound Rumble was completely controlled by this code.

To get it up and running on your computer (which can be Windows, Linux, or Mac OSX), you first should install the WPI SmartDashboard using the installer which you can find here: http://firstforge.wpi.edu/sf/frs/do/.../frs.installer

Note that for Linux or OSX builds (or if you just want to use more recent libraries than are included in the SmartDashboard installer on Windows), you will need to do the installation by hand. The libraries you will need are OpenCV (http://opencv.willowgarage.com/wiki/), JavaCV (http://code.google.com/p/javacv/), and FFMPEG (http://ffmpeg.org/). Make sure that the OpenCV and JavaCV versions you install are compatible! Meaning the same version number of OpenCV, and the same architecture (x86 or x86-64). You then need to make sure the paths to the OpenCV libraries are in your system path.

To use the widget with the Axis camera, you should configure your camera to allow anonymous viewing and make sure it is connected directly to your wireless bridge (not the cRIO). The IP must also be set by right clicking on the SmartDashboard widget. For best results, you will also want to ensure that your camera has a very fast exposure time (we used 1/120s). The FIRST control system documentation and vision whitepaper go over how to do this.

You can also run the widget in a "stand alone" fashion, as the class has a Java main method that you can use to load images from disk and display the processed results. Sample images are included.

Our vision system uses OpenCV library functions to successively filter the raw camera image and find the vision targets. The highest target detected is then used to compute range and bearing information. With a statically mounted camera, we use inverse trigonometry to find the distance to the target based on the height in the image. Bearing is computed by adding the offset of the target horizontally in the camera frame to the heading we are getting back from the robot. This lets us use a closed loop controller on the robot to use the gyro to "aim". If your robot has a turret, you could instead send the turret angle back to the SmartDashboard and get the same results. The computed range is used to find an optimal shooter RPM, which also gets sent back to the robot. We interpolate between points in our "range-to-RPM" lookup table in order to provide smooth outputs to our shooter wheel speed control loop.

Thanks to Brad Miller, WPI, Kevin O'Connor, and the FRC Control System team for making OpenCV-based vision processing a reality in 2012!
Reply With Quote
  #3   Spotlight this post!  
Unread 30-04-2012, 13:32
Brandon Holley's Avatar
Brandon Holley Brandon Holley is offline
Chase perfection. Catch excellence.
AKA: Let's bring CD back to the way it used to be
FRC #0125 (NU-TRONs, Team #11 Alumni (GO MORT))
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Boston, MA
Posts: 2,593
Brandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond reputeBrandon Holley has a reputation beyond repute
Send a message via AIM to Brandon Holley
Re: paper: Team 341 Vision System Code

Thanks for publishing this. Your tracking was absolutely deadly all season. I'm curious to see how our final algorithm stacks up against your code.
__________________
MORT (Team 11) '01-'05 :
-2005 New Jersey Regional Chairman's Award Winners
-2013 MORT Hall of Fame Inductee

NUTRONs (Team 125) '05-???
2007 Boston Regional Winners
2008 & 2009 Boston Regional Driving Tomorrow's Technology Award
2010 Boston Regional Creativity Award
2011 Bayou Regional Finalists, Innovation in Control Award, Boston Regional Finalists, Industrial Design Award
2012 New York City Regional Winners, Boston Regional Finalists, IRI Mentor of the Year
2013 Orlando Regional Finalists, Industrial Design Award, Boston Regional Winners, Pine Tree Regional Finalists
2014 Rhode Island District Winners, Excellence in Engineering Award, Northeastern University District Winners, Industrial Design Award, Pine Tree District Chairman's Award, Pine Tree District Winners
2015 South Florida Regional Chairman's Award, NU District Winners, NEDCMP Industrial Design Award, Hopper Division Finalists, Hopper/Newton Gracious Professionalism Award
Reply With Quote
  #4   Spotlight this post!  
Unread 30-04-2012, 14:25
JamesTerm's Avatar
JamesTerm JamesTerm is offline
Terminator
AKA: James Killian
FRC #3481 (Bronc Botz)
Team Role: Engineer
 
Join Date: May 2011
Rookie Year: 2010
Location: San Antonio, Texas
Posts: 298
JamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to beholdJamesTerm is a splendid one to behold
Re: paper: Team 341 Vision System Code

Thanks so much for posting this... looking forward to reviewing this. It was nice to meet you... BTW I have worked with FFmpeg professionally since 2006, so if you ever have any issues with it, perhaps I can help.
Reply With Quote
  #5   Spotlight this post!  
Unread 30-04-2012, 15:14
R.C.'s Avatar
R.C. R.C. is offline
2017... Oooh Kill em, Swerve!
AKA: Owner, WestCoast Products
FRC #1323 (MadTown Robotics)
Team Role: Engineer
 
Join Date: Feb 2008
Rookie Year: 2006
Location: Madera, CA
Posts: 2,186
R.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond reputeR.C. has a reputation beyond repute
Re: paper: Team 341 Vision System Code

1323 cannot thank Jared and 341 for helping us with vision. By champs we were one of the best shooters in our division.

-RC
__________________
R.C.
Owner, WestCoast Products || Twitter
MadTown Robotics Team 1323
Reply With Quote
  #6   Spotlight this post!  
Unread 30-04-2012, 18:35
rainbowdash's Avatar
rainbowdash rainbowdash is offline
Director of Programming
AKA: Souvixada S.
FRC #1671 (Buchanan Bird Brains)
Team Role: Programmer
 
Join Date: Apr 2012
Rookie Year: 2005
Location: Clovis, CA
Posts: 28
rainbowdash is an unknown quantity at this point
Re: paper: Team 341 Vision System Code

Thanks for the code!

Great job with your camera tracking, Miss Daisy! It was exciting watching all your matches! I know everyone in the chat room was very shocked and sad when you guys got eliminated.

Good luck at your off- season competitions!
Reply With Quote
  #7   Spotlight this post!  
Unread 30-04-2012, 23:04
RevonZZ
 
Posts: n/a
Re: paper: Team 341 Vision System Code

Your tracking system was legendary this year, 341. Heh... One of our running jokes was that your team had an aimbot.

My nerdy friends always called out "HAAAAAXXXX!!1!" when you were on the field. You're pretty good when just playing the game is cheating compared to lesser robots.
Reply With Quote
  #8   Spotlight this post!  
Unread 01-05-2012, 00:42
Ziv Ziv is offline
Has code to be writing...
FRC #0125 (Nutrons)
Team Role: Alumni
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Boston
Posts: 39
Ziv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of light
Re: paper: Team 341 Vision System Code

This is really cool! I'm looking forward to taking a close look at this at a non-12AM time, but a quick skim left me hungry for more.

We used a much more primitive system to find targets. After even very lenient RGB thresholding, we found that ignoring small particles and filtering the remaining ones for high normalized moment of inertia was sufficient. However, we didn't use any measurements other than the x coordinate of the center of the targets. Your code will no doubt be studied by a great many people, hopefully including all of 125's trainee programmers .
Reply With Quote
  #9   Spotlight this post!  
Unread 02-05-2012, 21:40
hodgepodge hodgepodge is offline
Registered User
FRC #0118
 
Join Date: May 2012
Location: Houston, TX
Posts: 1
hodgepodge is an unknown quantity at this point
Re: paper: Team 341 Vision System Code

It's great to see how others approached the vision processing. I wrote the vision code for team 118 this year and from a quick glance, your algorithm is quite similar.

Our code ran onboard on a BeagleBone running Linux and straight OpenCV, written in C++. libCurl was used to capture images and a UDP socket spewed angle and distance data to the cRio.
Reply With Quote
  #10   Spotlight this post!  
Unread 03-05-2012, 08:31
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: paper: Team 341 Vision System Code

Jared -

Thanks so much for posting your code. It was good meeting you at the regional and amazing watching your teams robot do it's stuff. This will go a long way to helping teams learn about computer vision processing and raise the bar for future competitions. Expect to see better documentation and improvements for next season.

And thanks to Joe Grinstead and Greg Granito for helping develop the code over last summer at WPI. They did a great job with the camera code and network tables extensions to WPILib.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #11   Spotlight this post!  
Unread 05-05-2012, 15:58
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: paper: Team 341 Vision System Code

Thanks for the code. I believe lines 322-334:
Code:
private double boundAngle0to360Degrees(double angle)
    {
        // Naive algorithm
        while(angle >= 360.0)
        {
            angle -= 360.0;
        }
        while(angle < 0.0)
        {
            angle += 360.0;
        }
        return angle;
    }
could be replaced with
Code:
private double boundAngle0to360Degrees(double angle)
    {
        return(abs(angle)%360.0);
    }
Reply With Quote
  #12   Spotlight this post!  
Unread 05-05-2012, 17:50
Ziv Ziv is offline
Has code to be writing...
FRC #0125 (Nutrons)
Team Role: Alumni
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Boston
Posts: 39
Ziv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of light
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by sebflippers View Post
Thanks for the code. I believe lines 322-334 [snipped] could be replaced with
Code:
private double boundAngle0to360Degrees(double angle)
    {
        return(abs(angle)%360.0);
    }
Consider the angle -90. Daisy's code returns 270, but yours returns 90. I think you're looking for something more like this:

Code:
private double boundAngle0to360Degrees(double angle)
    {
        double ret = abs(angle)%360.0;
        if(angle < 0.0)
        {
            ret = -ret;
        }
        return(ret);
    }
Reply With Quote
  #13   Spotlight this post!  
Unread 06-05-2012, 11:52
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by Ziv View Post
Consider the angle -90. Daisy's code returns 270, but yours returns 90. I think you're looking for something more like this:

Code:
private double boundAngle0to360Degrees(double angle)
    {
        double ret = abs(angle)%360.0;
        if(angle < 0.0)
        {
            ret = -ret;
        }
        return(ret);
    }
right.
Reply With Quote
  #14   Spotlight this post!  
Unread 06-05-2012, 14:09
sebflippers sebflippers is offline
Registered User
FRC #2914
 
Join Date: Jan 2012
Location: dc
Posts: 56
sebflippers will become famous soon enoughsebflippers will become famous soon enough
Re: paper: Team 341 Vision System Code

done. This one kind of defeats the purpose of making your code simpler, though.
Code:
	public static double boundAngle0to360Degrees(double angle)
    {
        return(angle > 0.0? angle % 360.0 : 360.0*(1 + (Math.abs((int)angle)/360))+angle);
    }
Reply With Quote
  #15   Spotlight this post!  
Unread 07-05-2012, 03:58
Gray Adams's Avatar
Gray Adams Gray Adams is offline
Registered User
no team
 
Join Date: Dec 2011
Rookie Year: 2000
Location: none
Posts: 282
Gray Adams is a splendid one to beholdGray Adams is a splendid one to beholdGray Adams is a splendid one to beholdGray Adams is a splendid one to beholdGray Adams is a splendid one to beholdGray Adams is a splendid one to beholdGray Adams is a splendid one to behold
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by sebflippers View Post
done. This one kind of defeats the purpose of making your code simpler, though.
Code:
	public static double boundAngle0to360Degrees(double angle)
    {
        return(angle > 0.0? angle % 360.0 : 360.0*(1 + (Math.abs((int)angle)/360))+angle);
    }
Why not just...
Code:
 public static double boundAngle0to360Degrees(double angle)
    {
        return((angle+360)%360);
    }
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 05:26.

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