|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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;
}
Code:
private double boundAngle0to360Degrees(double angle)
{
return(abs(angle)%360.0);
}
|
|
#4
|
|||
|
|||
|
Re: paper: Team 341 Vision System Code
Quote:
Code:
private double boundAngle0to360Degrees(double angle)
{
double ret = abs(angle)%360.0;
if(angle < 0.0)
{
ret = -ret;
}
return(ret);
}
|
|
#5
|
|||
|
|||
|
Re: paper: Team 341 Vision System Code
right.
|
|
#6
|
|||
|
|||
|
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);
}
|
|
#7
|
||||
|
||||
|
Re: paper: Team 341 Vision System Code
Quote:
Code:
public static double boundAngle0to360Degrees(double angle)
{
return((angle+360)%360);
}
|
|
#8
|
|||||
|
|||||
|
Re: paper: Team 341 Vision System Code
Quote:
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 : 07-05-2012 at 08:13. |
|
#9
|
||||
|
||||
|
Re: paper: Team 341 Vision System Code
Quote:
Code:
return(((angle%360)+360)%360); |
|
#10
|
|||
|
|||
|
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. |
|
#11
|
|||
|
|||
|
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. |
|
#12
|
|||
|
|||
|
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?
|
|
#13
|
|||||
|
|||||
|
Re: paper: Team 341 Vision System Code
Quote:
|
|
#14
|
||||
|
||||
|
Re: paper: Team 341 Vision System Code
Quote:
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. |
|
#15
|
|||||
|
|||||
|
Re: paper: Team 341 Vision System Code
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|