View Full Version : Connecting network sockets with robot
01-18-2012, 01:54 PM
We are thinking of using the computer to detect the rectangles of the basket. But it seems that in competition the network is controlled to block the use of some ports. Which ports are blocked? Which I can use the cRIO to pass data to the computer and vice versa?
There are teams that is processing images in other computer, but they are using a notebook into robot. Is this the unique way or can I pass datas through the net?
01-18-2012, 04:52 PM
If I remember correctly, ports 1100-1200, with the exception of 1140, are reserved for the driver station communications.
If you wish, you can use the SmartDashboard software this year on your driver station, which can automatically get the images for you, display them on your driver station laptop (not the onboard laptop, although that's certainly an option), and then it's just a matter of inputting your processing code, and it can send results back to the robot for control.
01-18-2012, 04:56 PM
I am seeing this question asked in many different threads and I don't think I've seen an explicit answer yet. Some have quoted this rule:
Connections to the cRIO Ethernet ports must be compliant with the following parameters:
A. The DAP-1522 wireless bridge is connected to the cRIO Ethernet port 1 (either directly or via a CAT5 Ethernet pigtail).
B. Ethernet-connected COTS devices or custom circuits may connect to any remaining Ethernet ports;
however, these devices may not transmit or receive UDP packets using ports 1100-1200 except for ports 1130 and 1140.
To me this seems to pertain to devices onboard the robot using ethernet to communicate with the cRIO. I'm not sure how much it pertains to the classmate communicating with the cRIO via the wireless bridge.
That said we know sending camera images directly to the driver's station for processing is an option this year. And if image processing is happening at the driver's station then we MUST be allowed to send target information back to the cRIO is some fashion.
I am working in C++ for robot code..just wanted to clarify that before I continued.
A quick look at the dashboard code and smartdashboard code it seems these classes are designed only to send data from the robot to the dashboard, not the other way around. So at this point I haven't found any existing infrastructure to leverage in sending the target info back to the robot (I would be very happy to be corrected on this point).
Currently my plan is to create a network connection between the cRIO and classmate PC via the wirelss bridge for communicating the target info to the robot. I haven't decided yet if I will use UDP or TCP or if the robot will be the client or the server if I use TCP. I will probably use a port outside the range of 1100-1200 in case the rule above applies. I plan to write the socket code from scratch because I don't think any WPILib classes exist for generic UDP or TCP communications.
Can anyone else confirm the approach they are taking??
01-18-2012, 10:22 PM
Last year, the open ports were added by a team update in the Player Stations section of the ARENA manual (which seemed odd to me). I've quoted the section below.
Once plugged in to the Field Management System via the Ethernet cable provided, the ports that the teams will be able to access on the playing field are as follows:
– TCP 1180: This port is typically used for camera data from the cRIO to the DS when the camera is connected to port 2 on the cRIO. This port is bidirectional on the field.
– UDP 1130: Dashboard-to-Robot control data, directional
– UDP 1140: Robot-to-Dashboard status data, directional
– HTTP 80: Camera connected via switch on the robot, bidirectional
– HTTP 443: Camera connected via switch on the robot, bidirectional
All these ports are open on the playing field, so a team can use them as they wish if they do not employ them as outlined above (i.e. TCP 1180 can be used to pass data back and forth between the robot and the DS if the team chooses not to use the camera on port 2).
I have not seen a similar list this year. In addition to the above list, there was a rule that listed the same restrictions at this year's [R53].
If you want to use dashboard to robot communication, I suggest asking which ports are open in Q/A.
01-19-2012, 07:07 PM
I will post my solution here. The dashboard already communicate with the cRIO. It gets data about the digital and analog inputs, relays and battery voltage. The dashboard is sending joystick data too. And the port that it uses is unblocked for sure.
There is a labview dashboard project that I can edit to send data of image processing. And in labview I can use dll functions as vi's. I created a dll with the square detection and others functions. I called this functions in labview dashboard and it send the data to cRIO. :cool:
01-19-2012, 08:30 PM
Just wanted to point out that the SmartDashboard developers have also posted a solution for square tracking, with all vision processing performed laptop-side:http://firstforge.wpi.edu/integration/viewcvs/viewcvs.cgi/trunk/extensions/camera/SquareTracker/src/edu/wpi/first/wpilibj/examples/SquareTrackerExtension.java?root=smart_dashboard&system=exsy1002&view=markup
I have not tested this myself, so I cannot speak for its stability or functionality, but I plan to have it tested out tomorrow.
edit: For those who do not have an account on firstforge with which to view that link, you can also see the source code here (http://pastebin.com/cYtQiKpF).
01-20-2012, 07:45 PM
I have not seen a similar list this year.
Team Update 2012-01-20 added the list of ports. It's the same as last year, with the addition of TCP 1735, bidirectional.
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.