Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   2011 Camera Code on Driver Station (http://www.chiefdelphi.com/forums/showthread.php?t=91021)

drakesword 05-02-2011 15:38

2011 Camera Code on Driver Station
 
So I have been working on camera code all day. Currently I am able to track targets based off of color and determine weather or not they are in a line.

Currently the most limiting factor is network speed which is keeping the FPS to about 15.

So if I were to release this to you guys how would you want the data returned to the cRio?

Example of ways data could be returned

1) Raw centroids and sizes
2) Pole positions (calculated based off the difference in x position)
3) Raw frame difference
4)??

I plan on (once it works well enough) releasing the application and the source code.

General rules on the usage of the source:

1) You may modify and redistribute at will.
2) You should be nice and credit me for the use
3) If you make improvements that helps tracking send the modifications to me so other teams can use it as well (Remember Gracious Professionalism)

drakesword 05-02-2011 15:50

Re: 2011 Camera Code on Driver Station
 
1 Attachment(s)
PS here is a low-res teaser of what I have at the moment

kinganu123 05-02-2011 16:43

Re: 2011 Camera Code on Driver Station
 
What language would this be in?

drakesword 05-02-2011 17:05

Re: 2011 Camera Code on Driver Station
 
The core is java over processing which would be able to send data to the cRIO via udp

MagiChau 05-02-2011 17:13

Re: 2011 Camera Code on Driver Station
 
I plan on using reflection from infrared if possible, if not LED off of the reflection tape on the scoring peg. The Camera will detect this. I have set the camera to grey-scale since full color is unnecessary and take up more space. Maybe use the reflection detected to also detect a circle with some help from the occlusion feature. This can further be used possibly to calculate distance from that circle or help align the robot to the column.

drakesword 05-02-2011 17:46

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by ZonChau (Post 1016350)
I plan on using reflection from infrared if possible, if not LED off of the reflection tape on the scoring peg. The Camera will detect this. I have set the camera to grey-scale since full color is unnecessary and take up more space. Maybe use the reflection detected to also detect a circle with some help from the occlusion feature. This can further be used possibly to calculate distance from that circle or help align the robot to the column.

This software runs on the driver station with the camera plugged into the netgear router. The program does all of the calculations to determine where the reflective tape is and then subtracts the background (the green and red area) then the frame is run through openCV to detect the blobs and do those calculations. Finally the blobs are compared to each other to determine which ones are in a column. Other calculations coming would be angle and distance to targets.

The software then returns the target information (not the image) to the cRio where you would then do your own processing.

Greg McKaskle 06-02-2011 10:45

Re: 2011 Camera Code on Driver Station
 
The latest LabVIEW update also contains an example under the vision category that shows how to statistically locate the columns. It runs on the development computer and uses a folder of images as inputs, so even if you are going to code in Java or C++, you can use it to tune colors, adjust lighting, etc.

Post any questions you have about how it operates.

Greg McKaskle

drakesword 07-02-2011 22:34

Re: 2011 Camera Code on Driver Station
 
I will be releasing the alpha before mid-day tomorrow. Keep your eyes pealed.

mwtidd 08-02-2011 10:14

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by ZonChau (Post 1016350)
I plan on using reflection from infrared if possible, if not LED off of the reflection tape on the scoring peg. The Camera will detect this. I have set the camera to grey-scale since full color is unnecessary and take up more space. Maybe use the reflection detected to also detect a circle with some help from the occlusion feature. This can further be used possibly to calculate distance from that circle or help align the robot to the column.

also note that the tape on the circle peg is not actually circular,
on the kickoff field it was square. So personally I would not plan on using the circle in your processing, because it very well may not be a circle at competition

divixsoft 09-02-2011 00:24

Re: 2011 Camera Code on Driver Station
 
Could you make the output the pole positions? Also, I admire your effort, the camera code is incredibly complex and hard. When and where will you post this code?

drakesword 09-02-2011 12:32

Re: 2011 Camera Code on Driver Station
 
Ok everyone.

The alpha can be found on my site at http://www.satanicspider.com/frc.php

You will need to do the following to get it running

I have not tested the networking end very much (lack of time) if you run into problems let me know

*************
**IMPORTANT**
*************
Do this in this order or it wont be installed properly

1 Install openCV version 1.0 (not 1.1 pre)
2 Install openCV version 2.1
3 Make sure that .\lib\ is added to the PATH system environment variable

**For people running vista or 7**
4 copy all of the DLL files from the bin directories of BOTH openCV directories into the lib subfolder in the Axis Tracking folder.

Known issues:The pole tracking isn't finished yet but it works as it is. As you approach the poles the upper points will converge towards the middle of the image. I did not compensate for that but it is on my list of things to do.

Let me know if you have issues.

drakesword 09-02-2011 12:36

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by divixsoft (Post 1018923)
Could you make the output the pole positions? Also, I admire your effort, the camera code is incredibly complex and hard. When and where will you post this code?

I will consider that for the next release. At the moment it reports each point in each pole (x, y, size) the poles are divided by 2 bytes with a value of 255

divixsoft 09-02-2011 12:57

Re: 2011 Camera Code on Driver Station
 
Where is the source code?

drakesword 09-02-2011 12:59

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by divixsoft (Post 1019165)
Where is the source code?

Good observation. It will be available in the same place after I clean it up a bit ^_^

[EDIT]

Its up

divixsoft 09-02-2011 13:53

Re: 2011 Camera Code on Driver Station
 
what do you guys think of this code? and how do you transfer the processing from the crio to the classmate using the classes from frc?

drakesword 09-02-2011 13:58

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by divixsoft (Post 1019199)
what do you guys think of this code? and how do you transfer the processing from the crio to the classmate using the classes from frc?

You avoid the cRio handling the camera completely.

The new "robot radio" has multiple ports so you can plug the cRio in one port and the camera in another.

The cRio then doesn't assign an ip to the camera the router does which then you can use to pull images to the classmate.

The program then retrieves the images, processes it, then spits data back to the robot via UDP

divixsoft 09-02-2011 20:25

Re: 2011 Camera Code on Driver Station
 
How is UDP used, and what is UDP?

Alan Anderson 09-02-2011 22:25

Re: 2011 Camera Code on Driver Station
 
UDP stands for User Datagram Protocol. It doesn't need any channel setup handhaking before being used, it has a lot less overhead than TCP, and it's used where guaranteed delivery of network packets is less important than the ability to communicate quickly.

See Wikipedia for a bit more detail. See RFC 768 for a lot more detail.

drakesword 13-02-2011 20:39

Re: 2011 Camera Code on Driver Station
 
Found several bugs.

First java on the cRIO does not support UDP. Changed to TCP.
Second the protocol was sending a bunch of empty data (roughly 800 bytes) changed to be dynamicly sized. I am still fixing the samples for release. Expect a java alpha on monday

drakesword 15-02-2011 12:25

Re: 2011 Camera Code on Driver Station
 
Sorry guys I was sick yesterday and the ftp has been down on my server.


{EDIT}

Actually the entire server is down -_-

mwtidd 13-03-2011 13:49

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by drakesword (Post 1023527)
Sorry guys I was sick yesterday and the ftp has been down on my server.


{EDIT}

Actually the entire server is down -_-

This stuff is awesome. Finally got it running on my mac, which apparently doesnt like 32 bit java vms.

I was wondering, what's your light source that makes the pegs show up bright green like that?

Also have you had any success incorporating this into a custom driver station?

drakesword 12-08-2011 14:31

Re: 2011 Camera Code on Driver Station
 
Quote:

Originally Posted by lineskier (Post 1038563)
This stuff is awesome. Finally got it running on my mac, which apparently doesnt like 32 bit java vms.

I was wondering, what's your light source that makes the pegs show up bright green like that?

Also have you had any success incorporating this into a custom driver station?

Thanks!

The light source was the old target lights believe it or not! But that was for testing ... dont think it would have been a problem except the size. So instead duiring competition we went with 2 blue LED's powered off of the cameras own 5volt supply. We did run into a problem with our shirts being blue but it still did ok at tracking. I will be updating the code again soon and posting it on my new server!

P.S. Im dropping my old server 99.5% uptime is a big joke my site has been down for 17 days now!


All times are GMT -5. The time now is 23:30.

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