OCCRA
Go to Post ... the team that *DOESN'T* design things in the offseason for prototyping and testing will always be at a much bigger disadvantage. - Cory [more]
Home
Go Back   Chief Delphi > ChiefDelphi.com Website > Extra Discussion
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 05-07-2012, 08:11 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
I feel better now.
AKA: Jared341
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 2,653
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

Quote:
Originally Posted by Gray Adams View Post
Why not just...
Code:
 public static double boundAngle0to360Degrees(double angle)
    {
        return((angle+360)%360);
    }
What if angle is equal to -361?

It's awesome that you guys are analyzing the code and you have already taught me something new (that Java's "%" operator works on floating point values...as a primarily C++ guy, I have it burned into my brain that thou shalt use "fmod" for floating point modulus). But if this is the part of the code that engenders the most discussion, then I'm a bit disappointed

Last edited by Jared Russell : 05-07-2012 at 08:13 AM.
Reply With Quote
  #17   Spotlight this post!  
Unread 05-08-2012, 12:11 AM
Gray Adams's Avatar
Gray Adams Gray Adams is offline
Registered User
FRC #0192 (GRT)
Team Role: College Student
 
Join Date: Dec 2011
Rookie Year: 2011
Location: University of Southern California
Posts: 281
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 Jared341 View Post
What if angle is equal to -361?

It's awesome that you guys are analyzing the code and you have already taught me something new (that Java's "%" operator works on floating point values...as a primarily C++ guy, I have it burned into my brain that thou shalt use "fmod" for floating point modulus). But if this is the part of the code that engenders the most discussion, then I'm a bit disappointed
Ok, fine.

Code:
return(((angle%360)+360)%360);
Reply With Quote
  #18   Spotlight this post!  
Unread 05-08-2012, 07:58 PM
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: 604
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: paper: Team 341 Vision System Code

I feel like at this point the original code was easier to understand from an outside perspective.

On another note, this is AWESOME! It's nice to see another team using Java to program, especially when it's done so well. Our camera tracking system is currently only used in auton to track after grabbing the third ball off the co-op bridge. It's very rudimentary code so that it can be run on the cRio (we had issues with a bad camera that made it impossible to test any sort of laptop based vision code). This is very interesting, and I'm excited to go over it in more detail later.
__________________
Phillipians 4:8 - Finally, brethren, whatever is true, whatever is honorable, whatever is right, whatever is pure, whatever is lovely, whatever is of good repute, if there is any excellence and if anything worthy of praise, dwell on these things.

God created FIRST as one of many wonderful things to dwell upon (just don't get obsessed ... whoops too late).
www.sharkattack744.com
Reply With Quote
  #19   Spotlight this post!  
Unread 05-08-2012, 08:58 PM
Tom Bottiglieri Tom Bottiglieri is offline
Custom User Title
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,022
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Send a message via AIM to Tom Bottiglieri
Re: paper: Team 341 Vision System Code

Thanks for posting this, Jared. I took a look at your dashboard on the field at Champs and was very impressed. It seems incredibly useful to have the vision system draw its idea of target state on top of the real image.

I suspect if vision is a part of upcoming games, we will probably use a solution very similar to this. This year we wrote all of our vision code on top of WPILib/NIVision to run on the cRIO. In the end we got this to work pretty well, but development and debugging was a bit of a pain compared to your system.
Reply With Quote
  #20   Spotlight this post!  
Unread 05-09-2012, 09:43 AM
Leeebowitz Leeebowitz is offline
Registered User
AKA: David
FRC #2115 (Nightmares)
Team Role: College Student
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Deerfield
Posts: 32
Leeebowitz is an unknown quantity at this point
Re: paper: Team 341 Vision System Code

Very cool! I just finished taking an online data structures course from IIT, so it was really awesome to see the implementation of the TreeMap! Just so that I'm sure I understand, it is used to quickly find an rpm based on your distance, right? What are the advantages (if any) of using this instead of plugging your data points into an excel graph and getting a polynomial best fit equation to transform your distance into an rpm?
Reply With Quote
  #21   Spotlight this post!  
Unread 05-09-2012, 10:14 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
I feel better now.
AKA: Jared341
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 2,653
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

Quote:
Originally Posted by Leeebowitz View Post
Very cool! I just finished taking an online data structures course from IIT, so it was really awesome to see the implementation of the TreeMap! Just so that I'm sure I understand, it is used to quickly find an rpm based on your distance, right? What are the advantages (if any) of using this instead of plugging your data points into an excel graph and getting a polynomial best fit equation to transform your distance into an rpm?
The biggest advantage was it made tuning very easy. Take the bot to the practice field with some balls, fire away, and record the range/RPM information into the TreeMap if you like what you saw (we actually had a version of the software that let the operator do this with the push of a "commit" button, but we ended up doing it all by hand just to sanitize the values). No need to fire up Excel.

Last edited by Jared Russell : 05-09-2012 at 10:17 AM.
Reply With Quote
  #22   Spotlight this post!  
Unread 05-09-2012, 10:16 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
I feel better now.
AKA: Jared341
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 2,653
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

Quote:
Originally Posted by Tom Bottiglieri View Post
I suspect if vision is a part of upcoming games, we will probably use a solution very similar to this. This year we wrote all of our vision code on top of WPILib/NIVision to run on the cRIO. In the end we got this to work pretty well, but development and debugging was a bit of a pain compared to your system.
By far the biggest advantage of a laptop-based solution was the development process that it facilitated. Simply collect some representative images and then you can go off and tune your vision software on a laptop without needing a cRIO or the FRC control system.
Reply With Quote
  #23   Spotlight this post!  
Unread 05-09-2012, 11:06 AM
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: 252
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 behold
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by Gray Adams View Post
Why not just...
Code:
 public static double boundAngle0to360Degrees(double angle)
    {
        return((angle+360)%360);
    }

Yeah! I like that one a lot...

For the c++ wind river people out there who look at this... you cannot use the modulo operator on doubles but you can use the fmod() offered in math.h

Code:
return (fmod ((angle+360.0) , 360.0));  //c++

//That function reminded me of this one:
//Here is another cool function I pulled from our NewTek code that is 
//slightly similar and cute...
int Rotation_ = (((Info->Orientation_Rotation + 45) / 90) % 4) * 90;

//Can you see what this does?
Reply With Quote
  #24   Spotlight this post!  
Unread 05-09-2012, 11:13 AM
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: 252
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 behold
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by Jared341 View Post
What if angle is equal to -361?

It's awesome that you guys are analyzing the code and you have already taught me something new (that Java's "%" operator works on floating point values...as a primarily C++ guy, I have it burned into my brain that thou shalt use "fmod" for floating point modulus). But if this is the part of the code that engenders the most discussion, then I'm a bit disappointed
Doh! I missed this before I responded as it was on the 2nd tab...

While I'm here though... if you are a c++ guy why use Java? Is it because it was the only way to interface with the dashboard? I gave up when trying to figure out how to do that in wind river.
Reply With Quote
  #25   Spotlight this post!  
Unread 05-09-2012, 11:33 AM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
I feel better now.
AKA: Jared341
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 2,653
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

Quote:
Originally Posted by JamesTerm View Post
Doh! I missed this before I responded as it was on the 2nd tab...

While I'm here though... if you are a c++ guy why use Java? Is it because it was the only way to interface with the dashboard? I gave up when trying to figure out how to do that in wind river.
Easy, it's because I am not the only person who writes software for our team! Java is what is taught to our AP CS students, and is a lot friendlier to our students (in that it is a lot harder to accidentally shoot yourself in the foot). I also have a lot of training in Java (and still use it on a nearly daily basis), even if C++ is my bread and butter.
Reply With Quote
  #26   Spotlight this post!  
Unread 05-09-2012, 02:00 PM
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: 252
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 behold
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by Jared341 View Post
Easy, it's because I am not the only person who writes software for our team! Java is what is taught to our AP CS students, and is a lot friendlier to our students (in that it is a lot harder to accidentally shoot yourself in the foot).
Ah ok.

Quote:
Originally Posted by Jared341 View Post
But if this is the part of the code that engenders the most discussion, then I'm a bit disappointed
Don't be disappointed... this discussion has taught/reminded us something that we rarely use in c++, and this discussion indirectly helped my co-worker fix a bug today. I do know how you feel though as there is a *lot* of effort that goes into this! I had most-all my vision code written as well, and unfortunately it is all going straight into the bit bucket, as we could not get the deliverables to make it work in time. I do want to look your code over in more detail and post what I did as well, and hopefully at that time the discussion will have more meat in it as I do want some closure in the work that I have done thus far.

I will reveal one piece now with this video:
http://www.termstech.com/files/RR_LockingDemo2.mp4

When I first saw the original video, it screamed high saturation levels of red and blue on the alliance colors, and this turns out to be true. The advantage is that there is a larger line to track at a higher point as I could use particle detection alone. The goal then was to interpret the line to perspective and use that to determine my location on the field. From the location I had everything I needed as I then go to an array table error correction grid with linear interpolation from one point to the next. (The grid among other tweaks are written in LUA more on that later too).

more to come...

There is one question that I would like to throw out there now though... Does anyone at all work with UYVY color space (a.k.a YPbPr). We work with this natively at NewTek, and it would be nice to see who else does.
Reply With Quote
  #27   Spotlight this post!  
Unread 06-15-2012, 05:19 PM
Bryscus's Avatar
Bryscus Bryscus is offline
EE, CpE
AKA: Bryce B.
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 1999
Location: Jupiter, FL
Posts: 172
Bryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud of
Re: paper: Team 341 Vision System Code

So after attending the Einstein Weekend debugging session this past weekend and chatting with some of the teams about their various OpenCV implementing vision systems, I just HAD to check out Daisy's code (another suggestion from Brad Miller).

So honestly, I have little experience with Java but figured what the heck since it's so close to C++. After following some of the Getting Start Guides and playing with a couple of projects, I downloaded Daisy's code and set to work running main() and passing the example image paths to the code as arguments. This seems to work well and two windows pop up showing the "Raw" and "Result" images. What baffles me is that I get this as output as well:

"Target not found
Processing took 24.22 milliseconds
(41.29 frames per second)
Waiting for ENTER to continue to next image or exit..."

and for the "Result" image I get a vertical green line more or less in the middle of the picture. I ran the program a couple of times with different images and similar results? Can someone tell this C guy what the heck he's doing wrong? Is there something I'm missing? If you guys (Daisy) were using a different color ring light or something, could you provide some sample images that work? Thanks in advance!

- Bryce

P.S. I'm running this on an OLD POS computer running XP and a Pentium D processor. I'll have to run it at home on something with a little bit of muscle and check performance.
__________________
The opulence of the front office decor varies inversely with the fundamental solvency of the firm.

Last edited by Bryscus : 06-16-2012 at 04:32 PM.
Reply With Quote
  #28   Spotlight this post!  
Unread 06-16-2012, 04:35 PM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
I feel better now.
AKA: Jared341
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 2,653
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

The vertical green line is simply an alignment aid that is burned in to each image - it is not an indication that you have successfully detected the target. If the vision system is picking up the vision targets, you should see blue rectangles and dots indicating the outline and center of the targets, respectively.

Which images are you testing with? The supplied images should work with the code "as is". If you are using your own images, are you using a green LED ring? If you are using a different color LED ring, you will need to alter the color threshold values in the code. Note that regardless of LED ring color, adjusting the camera to have a very short exposure time (so that the images are quite dark) increases the SNR of the retroreflections, and makes tracking both more robust and much quicker.
Reply With Quote
  #29   Spotlight this post!  
Unread 06-17-2012, 11:30 AM
Bryscus's Avatar
Bryscus Bryscus is offline
EE, CpE
AKA: Bryce B.
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 1999
Location: Jupiter, FL
Posts: 172
Bryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud of
Thanks for your reply Jared! I'm using the sample images supplied with the code located in DaisyCV/SampleImages. They're called names like 10Feet.jpg and 10ft2.jpg. I tried about three different images. These look like the same images supplied with the Java vision sample program that I pulled off FirstForge. Does this seem correct? Thanks.

- Bryce
__________________
The opulence of the front office decor varies inversely with the fundamental solvency of the firm.
Reply With Quote
  #30   Spotlight this post!  
Unread 08-12-2012, 10:02 PM
divixsoft's Avatar
divixsoft divixsoft is offline
Registered User
FRC #0835
 
Join Date: Feb 2011
Location: MI
Posts: 29
divixsoft is an unknown quantity at this point
Re: paper: Team 341 Vision System Code

Thanks for this great code, but I would really appreciate it if someone could explain to me how this worked. I open the file you uploaded in netBeans, and loaded the libraries, but I didn't know what the classpath was and there was abunch of errors everywhere. Also if someone could explain to me how the whole network thing worked I would greatly appreciate it. I know this is a lot to ask, so thanks in advance.
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 11:28 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi