Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Network Tables: Please explain like I'm 5 (http://www.chiefdelphi.com/forums/showthread.php?t=153496)

kmckay 11-01-2017 20:55

Network Tables: Please explain like I'm 5
 
Specifically running it outside a robot program on a Win10 laptop and on a raspberry pi.
Assume I don't know anything about Maven repositories, or native paths, or external jars... because I don't.

euhlmann 11-01-2017 22:00

Re: Network Tables: Please explain like I'm 5
 
I can explain how to use it, if that's what you want.

1. Clone https://github.com/wpilibsuite/ntcore
2.
Code:

./gradlew :native:build -PskipArm
3. Find built desktop NetworkTables JAR (<place you cloned>/native/build/libs)
4. Use JARs in project
Code:

NetworkTable.setClientMode();
NetworkTable.setNetworkIdentity("Name of my coprocessor or DS or whatever");
NetworkTable.setTeamNumber(5401);
NetworkTable.initialize();

// now get the network table that corresponds to the SmartDashboard class of WPILib
NetworkTable smartDash = NetworkTable.getTable("SmartDashboard");

// now use table to put data
smartDash.putNumber("VisionAngle", 42.0);

For the pi, you'll need to download a pi toolchain
Then,
Code:

./gradlew :arm:build -PcompilerPrefix="C:\Path\To\RPi\Toolchain\bin\arm-linux-gnueabihf-"
Find build probably in <place you cloned>/arm/build/libs
Use JARs in code on Pi as above

Thad House 12-01-2017 03:48

Re: Network Tables: Please explain like I'm 5
 
I am actually working on a gradle build system to automatically set up for running on either a Raspberry Pi or a Windows desktop. You can see the example at https://github.com/wpilibsuite/Visio...ee/master/Java, and can download the zip with the entire setup at http://first.wpi.edu/FRC/roborio/cop...JavaGradle.zip.

The Readme has instructions on how to set everything up. It's built for running camera processing, but it's fairly easy to make it just do networktables, as its already setup to connect to networktables.

kmckay 12-01-2017 08:38

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by Thad House (Post 1629782)
I am actually working on a gradle build system to automatically set up for running on either a Raspberry Pi or a Windows desktop. You can see the example at https://github.com/wpilibsuite/Visio...ee/master/Java, and can download the zip with the entire setup at http://first.wpi.edu/FRC/roborio/cop...JavaGradle.zip.

The Readme has instructions on how to set everything up. It's built for running camera processing, but it's fairly easy to make it just do networktables, as its already setup to connect to networktables.

Conveniently, I'm trying to use it for camera processing :D
Will review, thanks.

TimO 12-01-2017 11:15

Re: Network Tables: Please explain like I'm 5
 
This looks like something we can use. But:
<click on link>
Forbidden

You don't have permission to access /FRC/roborio/coprocessors/JavaGradle.zip on this server.

:ahh:

TimO

Thad House 12-01-2017 12:54

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by TimO (Post 1629941)
This looks like something we can use. But:
<click on link>
Forbidden

You don't have permission to access /FRC/roborio/coprocessors/JavaGradle.zip on this server.

:ahh:

TimO

Hmm looks like the link is having issues. I pushed a version of it to the GitHub release page, which can be found here https://github.com/wpilibsuite/Visio...ses/tag/v0.0.1. The zip is just a zip of the repo, so you could also just clone the repo.

kmckay 12-01-2017 20:41

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by Thad House (Post 1629782)
I am actually working on a gradle build system to automatically set up for running on either a Raspberry Pi or a Windows desktop. You can see the example at https://github.com/wpilibsuite/Visio...ee/master/Java, and can download the zip with the entire setup at http://first.wpi.edu/FRC/roborio/cop...JavaGradle.zip.

The Readme has instructions on how to set everything up. It's built for running camera processing, but it's fairly easy to make it just do networktables, as its already setup to connect to networktables.

With the standard WPIlibraries installed, do I need to do anything to run in eclipse for testing purposes? I am getting an ntcore not found. I have the import statement, the jar's in the build path...

TimO 12-01-2017 21:46

Re: Network Tables: Please explain like I'm 5
 
@Thad
thanks - the gradle setup works for me. Appreciate the effort setting it up.

Thad House 12-01-2017 23:21

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by kmckay (Post 1630259)
With the standard WPIlibraries installed, do I need to do anything to run in eclipse for testing purposes? I am getting an ntcore not found. I have the import statement, the jar's in the build path...

I don't know if that project will properly import into Eclipse. Haven't built with eclipse much. Although if you're getting an ntcore not found error, you probably have the wrong version set in the build script. Make sure it's set for windows if you are trying to run it on windows.

kmckay 13-01-2017 05:19

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by Thad House (Post 1630335)
I don't know if that project will properly import into Eclipse. Haven't built with eclipse much. Although if you're getting an ntcore not found error, you probably have the wrong version set in the build script. Make sure it's set for windows if you are trying to run it on windows.

I wasn't specifically using your code there. I went cross-eyed at "Gradle". I will figure that out eventually but not sure that will be during build season. I know there was an online Gradle training recently but build season.

But I did read your code, and try to mimic the NT lines. I had posted a question to the GRIP gutter chat and was told the set server and set team number were unnecessary in the latest versions of nt. Not true?

I'm beating my head against a wall here. I know this is going to be the simplest, stupidest answer, and I'm 90% sure it's in my eclipse build path and not in the code. But every answer seems to require 6 more questions.

kmckay 13-01-2017 09:58

Re: Network Tables: Please explain like I'm 5
 
Based on the error I'm getting, its picking up the libraries just fine. Within the libraries, when it executes the System.loadlibrary(ntcore) it can't find the file. It looks like on a windows system its looking for a windows directory. Should there be an ntcore.dll somewhere in my windows directories?
::rtm:: :confused:

Thad House 13-01-2017 12:12

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by kmckay (Post 1630465)
Based on the error I'm getting, its picking up the libraries just fine. Within the libraries, when it executes the System.loadlibrary(ntcore) it can't find the file. It looks like on a windows system its looking for a windows directory. Should there be an ntcore.dll somewhere in my windows directories?
::rtm:: :confused:

It should automatically be extracting the library. Which Jar are you using. There is an Arm jar, which is what you would have if you got NetworkTables from eclipse, and the is a Desktop Jar, which has all the native libraries for desktop systems. The Arm jar doesn't include any of the libraries for windows or other systems. You can get the desktop version from here. http://first.wpi.edu/FRC/roborio/mav...kTables/3.1.5/. Just download the version that ends with -desktop.

Thad House 13-01-2017 12:37

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by kmckay (Post 1630399)
I wasn't specifically using your code there. I went cross-eyed at "Gradle". I will figure that out eventually but not sure that will be during build season. I know there was an online Gradle training recently but build season.

But I did read your code, and try to mimic the NT lines. I had posted a question to the GRIP gutter chat and was told the set server and set team number were unnecessary in the latest versions of nt. Not true?

I'm beating my head against a wall here. I know this is going to be the simplest, stupidest answer, and I'm 90% sure it's in my eclipse build path and not in the code. But every answer seems to require 6 more questions.

If you want to run on a device other then the rio, you want to be using setClientMode() and setTeam(). That will connect to the roboRIO, since the roboRIO is by default the server.

kmckay 13-01-2017 16:42

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by Thad House (Post 1630529)
It should automatically be extracting the library. Which Jar are you using. There is an Arm jar, which is what you would have if you got NetworkTables from eclipse, and the is a Desktop Jar, which has all the native libraries for desktop systems. The Arm jar doesn't include any of the libraries for windows or other systems. You can get the desktop version from here. http://first.wpi.edu/FRC/roborio/mav...kTables/3.1.5/. Just download the version that ends with -desktop.

WORKED!! Thank you! On to the Pi!

And I'm happy to include the server commands, but if that's in the screensteps, I missed it. I asked about it because I stumbled on it in the 2013 screensteps on a google search.

Thank you much. Hopefully I won't be back shortly with Pi problems.

Thad House 13-01-2017 18:12

Re: Network Tables: Please explain like I'm 5
 
Quote:

Originally Posted by kmckay (Post 1630740)
WORKED!! Thank you! On to the Pi!

And I'm happy to include the server commands, but if that's in the screensteps, I missed it. I asked about it because I stumbled on it in the 2013 screensteps on a google search.

Thank you much. Hopefully I won't be back shortly with Pi problems.

With pi, instead of downloading that desktop artifact, download the arm-raspbian one. That should be the only thing needed to make it work.


All times are GMT -5. The time now is 12:33.

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