Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Network Table Viewer / GRIP issue (http://www.chiefdelphi.com/forums/showthread.php?t=142844)

dszlucha 30-01-2016 13:31

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

ThomasClark 31-01-2016 17:54

Re: Network Table Viewer / GRIP issue
 
That error is printed out by OutlineViewer, not GRIP, right? Are you sure you're not running another instance of OutlineViewer?

dszlucha 01-02-2016 07:57

Re: Network Table Viewer / GRIP issue
 
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

fsilberberg 01-02-2016 09:26

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/4...rt-on-mac-os-x.

dszlucha 01-02-2016 17:10

Re: Network Table Viewer / GRIP issue
 
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

dszlucha 01-02-2016 21:31

Re: Network Table Viewer / GRIP issue
 
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

ThomasClark 01-02-2016 23:12

Re: Network Table Viewer / GRIP issue
 
I think you need to leave out the leading slash.

PHP Code:

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


Peter Johnson 02-02-2016 03:10

Re: Network Table Viewer / GRIP issue
 
Quote:

Originally Posted by dszlucha (Post 1533677)
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

Quote:

Originally Posted by ThomasClark (Post 1533723)
I think you need to leave out the leading slash.

PHP Code:

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/mav....0.0-SNAPSHOT/ .. as of this writing it's 20160115).

dszlucha 02-02-2016 16:58

Re: Network Table Viewer / GRIP issue
 
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

fsilberberg 02-02-2016 18:08

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/rel...workTable.html.

dszlucha 02-02-2016 18:28

Re: Network Table Viewer / GRIP issue
 
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

fsilberberg 02-02-2016 18:54

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.

dszlucha 02-02-2016 19:09

Re: Network Table Viewer / GRIP issue
 
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

Peter Johnson 02-02-2016 19:45

Re: Network Table Viewer / GRIP issue
 
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.

dszlucha 02-02-2016 20:39

Re: Network Table Viewer / GRIP issue
 
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


All times are GMT -5. The time now is 00:40.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi