Can't Make/Update Network Table Values

Our robot has a pi coprocessor and roborio connected via a network switch. We have used outline viewer, smart dashboard and other methods and have confirmed that the pi is connecting to the roborio’s network table server, however it will not update the “X” and “Y” values in the “datatable” NetworkTable of the “inst” NetworkTableInstance. In fact, there is no “datatable” section showing up in OutlineViewer. We are using a flush() method to do this. Any ideas?

Pi code:
public static NetworkTableEntry xEntry;
public static NetworkTableEntry yEntry;
public static NetworkTableInstance inst;
public static void main(String[] args) {
____inst = NetworkTableInstance.getDefault();
____inst.startClient("169.254.242.224");
____NetworkTable table = inst.getTable("datatable");
____xEntry = table.getEntry("X");
____yEntry = table.getEntry("Y");
____int y = 2;
____yEntry.setNumber(y);
____NetworkTableInstance.getDefault().flush();
}

RoboRIO code:
public static NetworkTableInstance inst;
public static NetworkTable table;
@Override
public void robotInit() {
____inst = NetworkTableInstance.getDefault();
____table = inst.getTable("datatable");
}

It would probably be easier to follow if you kept all the issues related to this in a single thread.

The 169.254 address in startClient is a DHCP link-local address and won’t work when you ultimately switch to using the radio, as the roboRIO will be assigned a 10.TE.AM.2 address by the radio’s DHCP server.

More importantly, the code you’ve posted above for the Pi won’t work, as it will basically instantly exit main() before it ever has a chance to connect… none of the NetworkTable calls are blocking. You need to add a while(true) { Thread.sleep(5000); } or similar to the end of main() to prevent the program from exiting before it has a chance to connect.

I do have that in the real code, the above text is just a simplified version of the code with only network table stuff

The vision output at the wpilibpi.local says it connects to 169, but nothing shows up in outline viewer but the settings for the pi camera

Please post a link to your entire Pi program. You’re uploading this via the wpilibpi webpage as a vision application, correct?

I am doing grade build on the entire folder so it turns into a jar, I’ll put it in as a zip here

java-multiCameraServer.zip (23.1 MB)

This code doesn’t publish any camera settings. How are you running this on the Pi? My suspicion is that this code isn’t running at all, but rather the default camera server application.

Oh no… What I do is I open cmd prompt, cd into the folder, type “gradlew build”, then go to the website wpilibpi.local, go to the application tab and hit writable at the top, click choose file and upload the jar file found in the libs folder. Then I switch it back to read-only.

You need to go to the Vision Application Configuration section (not the File Upload section) and choose “Uploaded Java Jar”, which will give you an separate upload option to upload the .jar (make sure you’re uploading the -all.jar), then click “Upload and Save”. I suspect you’ve been uploading the file under the File Upload section.

1 Like

I will try that tomorrow, thanks!

Our entire robot works now, even the hydrazine thrusters and the fireball catapult. Thanks so much!

1 Like

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