Basic NetworkTables Assistance Requested

Hello! My team is trying to do vision code for the first time, and I’m attempting to set up NetworkTables to be able to send information from a Raspberry Pi 3 to the driver’s station. My eventual goal is to get an image from a camera connected to the Pi, do some image processing stuff on it, and send that feed back to the driver’s station. My questions basically boil down to "how do I write code for NetworkTables so that I can get this to stream a camera feed back to the driver’s station " but I’ll ask some more specific stuff.

  1. How do the devices transmit information? (Raspberry Pi talks to the roboRIO which talks to the driver’s station?)

  2. How do I set up the communication between the devices? Right now I’ve been trying to get the Pi to send data directly to the driver’s station without involving the roboRIO, is that the best way to go about this?

  3. Do I need to use GRIP in order to use NetworkTables? The only information I could find about it on screenstepslive involved using GRIP, and I’m not sure if GRIP is required to use NetworkTables.

4.What do I need to write on the Pi to get NetworkTables functioning?

Also, if anyone has any links to NetworkTables documentation or other information about it then that would be great as I’m pretty much flying blind here.

Thanks!

That build system you linked will actually automatically stream the image over the network. The stream it produces can be found by going to

http://raspberrypi.local:1185/

(note raspberrypi.local can be replaced with whatever the IP address of the pi is.) That system also automatically includes NetworkTables, and even includes the proper setup to have it connect to the roboRIO.

The right way for network tables to be set up is to have the roboRIO as the server, and everything else as a client. The build system is already set up as a client, and so do both SmartDashboard and the LV dashboard.

To get access to put things on the Dashboard, you need a NetworkTable object, pointing to the SmartDashboard table. To do this, use the following code.

NetworkTable sdTable = NetworkTable.getTable("SmartDashboard");

That will get you access to the table. From there, you can use the same methods you would use on the SmartDashboard class on the robot (putNumber, putString, getNumber, etc) on that object to send and receive data. This will be sent to the roboRIO, which will then send all data to all other clients, such as the dashboard.

Thanks for the information! This makes things a lot clearer, I just have a few more questions.

  1. How do I set up the roboRIO as the server?

  2. Do I need to give the Pi a static IP address so the stream always goes to the same IP on the SmartDashboard?

  3. Is there anything other than setting up the roboRIO as the server, creating a NetworkTables object, and possibly setting up a static IP address that I would need to do to get the program that I linked to earlier to work?

Thanks again!