Using NetworkTables and Java to send data from RPi3 to roboRIO

We want to transmit some data (3 double-type variables containing coordinate values to be exact) from the Raspberry Pi to roboRIO. We know that NetworkTables is one way to do it but couldn’t find any documents on how to use it on Java. We’d appreciate it if anyone can show us the very basics of NetworkTables on Java, show us the way that we can go about using it in our situation, and provide extra documentation if possible. Thanks in advance.

The WPILib docs have a NetworkTables Java client example.

To run this on the Pi you’ll need the native libraries for the Pi. One option for this is to use the FRCVision image for the Pi, which bundles all of the WPILib libraries and includes example vision processing programs that talk to NetworkTables.

Is the Raspberry PI or the roboRIO considered the client? And once we set up the program on the client end do we need to anything else on the other end?

The RoboRIO is the server, the Raspberry Pi is the client. As long as a robot program is running, there is a NetworkTables server running (it’s part of the robot program).

We have some questions regarding the example program in the link you provided:
-Do we have to create another instance in a seperate program and deploy it on roboRIO or how will the data we sent from RPi be interpreted? If so do uniform variable names matter?
-The output of the example client-side program would be a bunch of 0.0’s, right? We can change the 0.0 to the data we want to send right?

Your robot program is the server. No need to run a separate one. You can just use NetworkTables calls directly in your robot program to read the sent values.

Yes, you should change the client-side program to send the values you want sent :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.