Network Table Viewer / GRIP issue

Hello!

I’m trying to use the Network Table Viewer in server mode to display contour values from GRIP on my machine but whenever I try to start the Network Table Viewer in server mode using:

java -jar OutlineViewer.jar

and then use 127.0.0.1 as the host/address I get the following error:

platform: /Mac OS X/x86_64/
NT: ERROR: bind() failed: Address already in use (workspac:102)

The Network Table Viewer comes up but only display “>Root” which is empty.

The GRIP documentation states that the Network Table Viewer can be used in server mode to display values on my local machine.

Its there something else I need to do to get the Network Table Viewer working in server mode on my machine?

Thanks!

David

That error is printed out by OutlineViewer, not GRIP, right? Are you sure you’re not running another instance of OutlineViewer?

Hi Thomas.

That’s correct. The error is coming from the Outline Viewer and not GRIP. I do not seem to have this problem on Windows, only Mac. I do have FRCSim installed on the Mac but it is current not running.

David

It sounds like something else on your computer is using port 1735. You’re going to have to track down what it is and shut that program down. StackOverflow has an article on how to list open ports: http://stackoverflow.com/questions/4421633/who-is-listening-on-a-given-tcp-port-on-mac-os-x.

I did a lsof -i:1735 which turned out to be a hung java process. Went to Activity Monitor and killed it.

Outline Viewer runs fine now - can view data from GRIP.

Thanks!

David

I’m trying to mock up some code to read the Network Table using the “desktop” package of networktables.jar, e.g., NetworkTables-3.0.0-20151121.170557-4-desktop-development.jar but I am not able to read values from the table. I’m running the Outline Viewer and can see the values there, but not in my own code.

NetworkTable table = NetworkTable.getTable("/GRIP/myContoursReport");
System.out.println(table.containsKey(“area”));

Output:
platform: /Mac OS X/x86_64/
false

Is there anything special I need to do in my client code to initialize NetworkTable?

Thanks!

David

I think you need to leave out the leading slash.

NetworkTable table = NetworkTable.getTable("GRIP/myContoursReport");

Yes, that should fix it. This has been fixed in the latest release, but David is using 20151121 rather than the latest release (David, I also recommend you upgrade with the latest version from http://first.wpi.edu/FRC/roborio/maven/release/edu/wpi/first/wpilib/networktables/java/NetworkTables/3.0.0-SNAPSHOT/ … as of this writing it’s 20160115).

Thanks Thomas and Peter for the replies.

I grabbed the latest networkltables jar: NetworkTables-3.0.0-20160115.192917-3-desktop.jar, started up the outline viewer choosing localhost and server, fired up GRIP and could see the Contours report being published via the outline viewer:
/Root/GRIP/myContoursReport/area etc…

But then had the same result in my java code with the addition of an additional error:

Code is in main():

NetworkTable table = NetworkTable.getTable(“GRIP/myContoursReport”);
System.out.println(table);
System.out.println(table.containsKey(“area”));

Output is:

platform: /Mac OS X/x86_64/
NetworkTable: /GRIP/myContoursReport
false
NT: ERROR: bind() failed: Address already in use (workspac:102)

If I put back the old networktables jar the error goes away but I still can’t read data from the network table.

David

What code are you using for setup? Are you putting ntcore into client mode, and set up the team correctly? Relevant documentation is here: http://first.wpi.edu/FRC/roborio/release/docs/java/edu/wpi/first/wpilibj/networktables/NetworkTable.html.

Hi Fred.

I’ve added NetworkTable.setClientMode() as well as NetworkTable.setTeam(1518) to my code and verified that GRIP is set to team 1518 as well. I’ve also switched back to a Windows box which also has the “desktop” build of networktables.jar but I’m still not reading from the table:

NetworkTable.setClientMode();
NetworkTable.setTeam(1518);
NetworkTable table = NetworkTable.getTable(“GRIP/myContoursReport”);
System.out.println(table);
System.out.println(table.containsKey(“area”));

Output:
platform: /Windows/amd64/
NetworkTable: /GRIP/myContoursReport
false

David, you’ll need to set the ip to wherever you’re actually running the NetworkTables server. It looks like you’re not running a robot currently, but using OutlineViewer as the server, right? If that’s the case, you’ll want to point NetworkTables at 127.0.0.1, not call setTeam.

I appreciate the help but unfortunately it’s still not working in “desktop” mode, e.g., not on RoboRIO after setting IP address, e.g., NetworkTable.setIpAddress(), setting client mode and not setting team.

Running Outline Viewer in “server” mode, IP 127.0.0.1. Running GRIP and can see contour values in Outline Viewer. Running the following code in main():

NetworkTable.setIPAddress(“127.0.0.1”);
NetworkTable.setClientMode();
//NetworkTable.setTeam(1518);
NetworkTable table = NetworkTable.getTable(“GRIP/myContoursReport”);
System.out.println(table);
System.out.println(table.containsKey(“area”));

Output:
platform: /Mac OS X/x86_64/
NetworkTable: /GRIP/myContoursReport
false

Can you post your full program? Is your posted code running in some kind of loop so NT actually has time to connect? Note all the NT calls are non-blocking so if your main() code just simply runs these statements and exits it probably never even had a chance to connect. NT will print “CONNECTED” when it successfully connects to the server.

I was just printing out values once in main(). I added a loop and a delay and now see the “NT connected” message and can now read values from the network table.

Thanks for the help!

David