Go to Post WAIT WAIT, I GOT IT!!!! What if.... it's just a picture of a fish. - Libby K [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-02-2015, 14:04
JML's Avatar
JML JML is offline
Jlyon
AKA: Jlyon
FRC #3044 (0xBe4)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: 3044
Posts: 17
JML is an unknown quantity at this point
Networking on the Robot

Hello,

How does everyone do networking on their robot. Specifically for Java and/or C++, but Lab View is applicable as well. Does everyone tend to use the Network tables libraries and program, and on top of that, how efficient are network tables, Would using just a socket work better or more efficiently? I was leaning towards using sockets for any custom communication with our co-processor this year, but I wanted to check what others thought about this, and since I don't have access to a robo-RIO right now, i cant do research on my own.

Thanks
  #2   Spotlight this post!  
Unread 22-02-2015, 14:17
billbo911's Avatar
billbo911 billbo911 is online now
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,381
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Networking on the Robot

For the last couple of years, and now this year, we use a socket. The RoboRio requests a socket connection to our coprocessor. The coprocessor accepts the socket then responds with a string of target information, then closes the socket.
It's simple and fast.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #3   Spotlight this post!  
Unread 22-02-2015, 15:58
JML's Avatar
JML JML is offline
Jlyon
AKA: Jlyon
FRC #3044 (0xBe4)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: 3044
Posts: 17
JML is an unknown quantity at this point
Re: Networking on the Robot

Quote:
Originally Posted by billbo911 View Post
The RoboRio requests a socket connection to our coprocessor. The coprocessor accepts the socket then responds with a string of target information, then closes the socket.
Does this mean you are connecting and disconnecting a new socket every time you wish to transmit information, or are you doing it at the start and end of the match or in teleop/auto/robot init and disabled init for disconnect
  #4   Spotlight this post!  
Unread 22-02-2015, 16:27
billbo911's Avatar
billbo911 billbo911 is online now
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,381
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Networking on the Robot

Quote:
Originally Posted by JML View Post
Does this mean you are connecting and disconnecting a new socket every time you wish to transmit information, or are you doing it at the start and end of the match or in teleop/auto/robot init and disabled init for disconnect
We are connecting, transferring the data, and disconnecting every time the controller wants it, and only when the controller wants it.
No WiFi bandwidth is used as this stays local to the Robot's network.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #5   Spotlight this post!  
Unread 22-02-2015, 16:45
nickbrickmaster's Avatar
nickbrickmaster nickbrickmaster is offline
Not Allowed Near Power Tools
AKA: Nick Schatz
FRC #3184 (Blaze Robotics)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2014
Location: Eagan MN
Posts: 162
nickbrickmaster is an unknown quantity at this point
Re: Networking on the Robot

That seems inefficient if you are accessing the data more than a few times every match.
  #6   Spotlight this post!  
Unread 22-02-2015, 17:25
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,086
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Networking on the Robot

NetworkTables is really good for key-value types of transfers of data, and it's very simple to use from robot code, and let's you ignore network-related complexity. You can expect up to 100ms of latency in Java/C++ as the sender (not sure about LabVIEW), and up to 50ms of latency when using python as the sender. But, for most control systems in FRC, this is good enough.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #7   Spotlight this post!  
Unread 22-02-2015, 18:06
billbo911's Avatar
billbo911 billbo911 is online now
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,381
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Networking on the Robot

Quote:
Originally Posted by nickbrickmaster View Post
That seems inefficient if you are accessing the data more than a few times every match.
Are you saying it is more efficient to continuously stream data to the robot controller that is not needed? Prior to this year, that was a really good way to lock up the cRio.

We have chosen to only evaluate target data when it is needed. Otherwise, the transfer of data is wasted CPU cycles. Call it inefficient if you will, but it's still way more efficient to transfer 24 bytes of data only two to three times in autonomous, then it is to continuously use processor cycles to process a stream.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist

Last edited by billbo911 : 22-02-2015 at 19:17.
  #8   Spotlight this post!  
Unread 22-02-2015, 18:09
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 748
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Networking on the Robot

Quote:
Originally Posted by nickbrickmaster View Post
That seems inefficient if you are accessing the data more than a few times every match.
You really don't want to run the risk of filling the network buffer on the cRIO. Ever. It's really bad.
  #9   Spotlight this post!  
Unread 22-02-2015, 19:20
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,753
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Networking on the Robot

The LabVIEW network tables defaults to an update rate of 100ms as well, but there is a parameter, Update Time, that lets you determine how often each client and server will transmit modified values. There is also a flush so that you can keep the rate as is, but you can send important value updates immediately. Additionally, value writes with the same value do not cause updates.

For the various infrastructure protocols that run on the cRIO and roboRIO, we use a combination of TCP and UDP. You will not run into the buffer full issues on the roboRIO, and on the cRIO, they occur only when the incoming data isn't being read.

So the use of sockets opens you up to additional power and additional consequences if you do it incorrectly. For most teams, I'd think that Network Tables is sufficient for set points and status, and a TCP stream is appropriate for a camera.

Greg McKaskle
  #10   Spotlight this post!  
Unread 22-02-2015, 21:15
codes02 codes02 is offline
Randolph aka Roxbury aka R_______
AKA: Cody Schafer
no team (Formerly: Team 11, MORT)
 
Join Date: Oct 2007
Rookie Year: 2008
Location: MA, USA
Posts: 57
codes02 is on a distinguished road
Re: Networking on the Robot

Quote:
Originally Posted by billbo911 View Post
Are you saying it is more efficient to continuously stream data to the robot controller that is not needed? Prior to this year, that was a really good way to lock up the cRio.

We have chosen to only evaluate target data when it is needed. Otherwise, the transfer of data is wasted CPU cycles. Call it inefficient if you will, but it's still way more efficient to transfer 24 bytes of data only two to three times in autonomous, then it is to continuously use processor cycles to process a stream.
Quote:
Originally Posted by magnets View Post
You really don't want to run the risk of filling the network buffer on the cRIO. Ever. It's really bad.
You can keep an established TCP connection open without sending data, and only send data on request. This allows one to avoid the overhead of establishing and tearing down a TCP connection for every request, and is a common optimization in network protocol design.
  #11   Spotlight this post!  
Unread 22-02-2015, 23:19
chsahit's Avatar
chsahit chsahit is offline
Lead Developer
AKA: Sahit C
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Jul 2014
Rookie Year: 2013
Location: Mount Olive
Posts: 7
chsahit will become famous soon enoughchsahit will become famous soon enough
Re: Networking on the Robot

Take a look at this little thing I cooked up:
https://github.com/chsahit/UDPTable

It uses UDP instead of TCP for less networking sadness/latency. I designed it to be a simple alternative to Network tables.
  #12   Spotlight this post!  
Unread 23-02-2015, 08:09
JML's Avatar
JML JML is offline
Jlyon
AKA: Jlyon
FRC #3044 (0xBe4)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: 3044
Posts: 17
JML is an unknown quantity at this point
Re: Networking on the Robot

Thanks for all of the responses
Quote:
Originally Posted by chsahit View Post
Take a look at this little thing I cooked up:
https://github.com/chsahit/UDPTable

It uses UDP instead of TCP for less networking sadness/latency. I designed it to be a simple alternative to Network tables.
Thanks! I will be sure to check this out.

From my understanding, UDP has no packet delivery confirmation unless you implement it yourself, I haven't had a chance to look at this project yet, but would that be an issue for robot applications, have you tested this on a robot application.

For custom driver station outputs, I could see this being an option, but what about for sending processed image data back to the robo-RIO?
  #13   Spotlight this post!  
Unread 24-02-2015, 21:01
chsahit's Avatar
chsahit chsahit is offline
Lead Developer
AKA: Sahit C
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Jul 2014
Rookie Year: 2013
Location: Mount Olive
Posts: 7
chsahit will become famous soon enoughchsahit will become famous soon enough
Re: Networking on the Robot

I did not implement any checking to see if the packets got across. This is best used for when you are streaming data. If you are sending a continous stream of data over to the roboRIO or are constantly polling that network device than a few lost packets isn't a problem. In your instance, you might want to do some testing to see if this is right for you.
Closed Thread


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 21:19.

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