Struggling with Network tables coprocessing

No matter what I try, I can’t get our pi coprocessor to connect its network tables to the roborio’s server. My console output at http://wpilibpi.local/ says NT: client: CONNECTED to server 10.59.80.2 port 1735, but the network table values in SmartDashboard won’t change. If someone could point me in the right direction, any help is appreciated.

My pi code (the y value just increases forever so I know something’s connected):
Main.java (3.1 KB)

My roborio code:
public static double centerX = 0.0;
NetworkTableEntry xEntry;
NetworkTableEntry yEntry;
public static NetworkTable table = NetworkTableInstance.getDefault().getTable("datatable");

@Override
public void robotPeriodic() {
____SmartDashboard.putNumber("centerX", table.getEntry("X").getDouble(0.0));
____SmartDashboard.putNumber("y val", table.getEntry("Y").getDouble(0.0));
}

Shot in the dark here… can you confirm that the IP provided in that log statement belongs to your roborio AND that the NT server that smartdashboard is connected to is the same? Essentially, I’m questioning whether you somehow have multiple NT servers on the network so you’re writing to one and reading from another.

Other than that, the code seems fine to me. At least, I don’t see anything glaringly obvious.

SmartDashboard only shows stuff in the SmartDashboard table. If you want to see stuff in the datatable table, you’ll need to use OutlineViewer, Shuffleboard, or Glass.

Try deleting the line

 inst.startDSClient();

I’m not sure if the startClient methods stop any previous clients but that method will try to find an ip from a driver station running on localhost, which obviously won’t work on a pi.

You shouldn’t need that line anyway since you’ve already started a client based on your team number

That line does no harm. It just adds looking for a local DS to a client. If the Pi says CONNECTED that means it’s successfully connected to the RoboRIO NT server.

2 Likes

I tried to put in the roborio ip as the server location in outline viewer and got no connection

You think anything has to do with my declarations of tables vs table instances or the fact that some are static?

1 Like

Using the viewer is a good way to split things apart between the writer and the reader, and it lets you confirm the addressing info and key/path name(s). The answer is probably in a prior response, but this is a good tool, in general.

1 Like