Go to Post Never allow your students to get away with an answer that amounts to "because it's better". Have them prove it to the best of their ability, and when they're wrong, ask them to figure out why they're wrong. - Tom Line [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 03-03-2014, 19:04
Goldenchest Goldenchest is offline
Goldenchest
AKA: Gary Chien
FRC #1758 (Technomancers)
Team Role: Programmer
 
Join Date: Dec 2012
Rookie Year: 2010
Location: United States
Posts: 17
Goldenchest is an unknown quantity at this point
How does NetworkTables work?

I'm interested in learning how to get the driver station to interact with the robot and vice versa, and I've been through tons of threads describing how the server code (the robot) should be written and how the client code (the laptop) should be written.

However, there is one crucial detail that I haven't been able to grasp yet: when and how exactly is the client code supposed to be run? Is it supposed to be built in WindRiver as an .exe (is that even possible)? Can I use another IDE such as VC++? Do I have to start running the client code before activating the robot code, and does the client code just run in the background of the driver station? I feel like the solution is extremely simple because no one has brought up this question yet in the multiple threads I've browsed. Any help would be appreciated!
  #2   Spotlight this post!  
Unread 03-03-2014, 22:50
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: How does NetworkTables work?

What exactly is this "client" that you speak of? Is this some custom program that you are implementing yourself?

Alex Brinister
  #3   Spotlight this post!  
Unread 03-03-2014, 23:13
Goldenchest Goldenchest is offline
Goldenchest
AKA: Gary Chien
FRC #1758 (Technomancers)
Team Role: Programmer
 
Join Date: Dec 2012
Rookie Year: 2010
Location: United States
Posts: 17
Goldenchest is an unknown quantity at this point
Re: How does NetworkTables work?

http://wpilib.screenstepslive.com/s/...client-pc-side

I'm referring to the section labeled "The client (laptop) side of the program"
  #4   Spotlight this post!  
Unread 04-03-2014, 05:50
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,751
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: How does NetworkTables work?

First, I'll give the bigger abstract answer, then I'll give a practical one.

Network Tables clients and servers are mostly the same. They store name/value pairs that the local program writes and return them when a read operation is performed. They support Booleans, double precision numbers, strings, and arrays of these types. The next feature of them is that multiple computer/robots/camera processors can be kept in synch. One of these is designated the server, and the rest are clients. They are much the same except that the server knows who everyone else is and replicates data out to keep everyone in synch. If we have three NT participants, S, C1, and C2, A variable change made on C1 is stored and sent to S. S then sends the new value to C2 as well.

In practice, the robot will typically be the server, the dashboard a client. Some teams will have an onboard processor which is a client. Some will also run NT on their programming laptop so that when it is connected, their tools can see the variables.

The NT clients are often the same code compiled for the DS laptop. However the only thing that matters is that they implement the protocol that shares. In reality, the clients and servers can be written in different languages and it won't affect things.

Greg McKaskle
  #5   Spotlight this post!  
Unread 04-03-2014, 05:58
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: How does NetworkTables work?

Does NetworkTables utilize some sort of class serialization algorithm? I've always been confused as to how it can send stuff like "Commands" to SmartDashboard or motor actuators.

Alex Brinister
  #6   Spotlight this post!  
Unread 04-03-2014, 06:04
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,751
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: How does NetworkTables work?

I believe the commands are simply some data fields with special names. The WPI code binds to those values so that you can affect them simply by updating values. This is the way the PID object works as well.

Greg McKaskle
  #7   Spotlight this post!  
Unread 04-03-2014, 07:56
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: How does NetworkTables work?

Oh okay I see. The PID object makes more sense to me because P, I, and D are just values whereas stuff like motor actuators and subsystems are objects. I suppose that object serialization is sort of the same thing because the goal is to send critical data fields from the object over a network not necessarily the whole object. I suppose NetworkTables is a work-around for Java ME which doesn't support object serialization. I would expect with the new control system, NetworkTables for Java at least will not be as complex seeing as Java SE has a native serializing interface. I think it is still relevant in the C++ version of the library because C++ has no built-in serialization interface so one needs to implement one in order to send data fields from objects over a network.

Alex Brinister
  #8   Spotlight this post!  
Unread 04-03-2014, 09:36
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,751
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: How does NetworkTables work?

Since the protocol is intended to be used across multiple languages, it will not necessarily shift to using native Java serialization. LV has native serialization as well, and this was used in the initial DB protocol for LV to LV comms. The serialization is just a small portion of the SD codebase.

Greg McKaskle
  #9   Spotlight this post!  
Unread 04-03-2014, 13:44
Goldenchest Goldenchest is offline
Goldenchest
AKA: Gary Chien
FRC #1758 (Technomancers)
Team Role: Programmer
 
Join Date: Dec 2012
Rookie Year: 2010
Location: United States
Posts: 17
Goldenchest is an unknown quantity at this point
Re: How does NetworkTables work?

Quote:
Originally Posted by Greg McKaskle View Post
First, I'll give the bigger abstract answer, then I'll give a practical one.

Network Tables clients and servers are mostly the same. They store name/value pairs that the local program writes and return them when a read operation is performed. They support Booleans, double precision numbers, strings, and arrays of these types. The next feature of them is that multiple computer/robots/camera processors can be kept in synch. One of these is designated the server, and the rest are clients. They are much the same except that the server knows who everyone else is and replicates data out to keep everyone in synch. If we have three NT participants, S, C1, and C2, A variable change made on C1 is stored and sent to S. S then sends the new value to C2 as well.

In practice, the robot will typically be the server, the dashboard a client. Some teams will have an onboard processor which is a client. Some will also run NT on their programming laptop so that when it is connected, their tools can see the variables.

The NT clients are often the same code compiled for the DS laptop. However the only thing that matters is that they implement the protocol that shares. In reality, the clients and servers can be written in different languages and it won't affect things.

Greg McKaskle
Thanks! I'm still slightly unclear about the other part of my question though: how am I supposed to compile the client code? Should I make it into an exe and run it separately? Am I supposed to build it inside or outside of WindRiver? Once I build the client code for the driver station, when and how do I run it so that it will communicate with the robot?
  #10   Spotlight this post!  
Unread 06-03-2014, 01:44
Goldenchest Goldenchest is offline
Goldenchest
AKA: Gary Chien
FRC #1758 (Technomancers)
Team Role: Programmer
 
Join Date: Dec 2012
Rookie Year: 2010
Location: United States
Posts: 17
Goldenchest is an unknown quantity at this point
Re: How does NetworkTables work?

Anyone? I'm still trying to figure this out and have not been successful at all, mostly because I have no idea where to start :/
  #11   Spotlight this post!  
Unread 06-03-2014, 18:09
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,058
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: How does NetworkTables work?

If you wanted to write a java client, you would link against the desktop-lib\networktables-desktop.jar . Should be easy.

If you want to write a python client, you would install the pynetworktables binary for your version of python, and run the sample code. Should be easy.

If you want to write a C++ client, you need to extract the right pieces out of WPILib, fix them so they compile on a desktop, and then link all of that together. Not easy. You can use the NetworkTables components from RobotPy patched version of wpilib which (together with pynetworktables-specific patches can be compiled on a desktop), but it's still not going to be trivial.
__________________
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
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 02:32.

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