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.

I can explain how to use it, if that’s what you want.

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

./gradlew :native:build -PskipArm

  1. Find built desktop NetworkTables JAR (/native/build/libs)
  2. Use JARs in project

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,


./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

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/VisionBuildSamples/tree/master/Java, and can download the zip with the entire setup at http://first.wpi.edu/FRC/roborio/coprocessors/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 :smiley:
Will review, thanks.

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/VisionBuildSamples/releases/tag/v0.0.1. The zip is just a zip of the repo, so you could also just clone the repo.

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…

@Thad
thanks - the gradle setup works for me. Appreciate the effort setting it up.

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.

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/maven/release/edu/wpi/first/wpilib/networktables/java/NetworkTables/3.1.5/. Just download the version that ends with -desktop.

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.

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.

Runs without error on the pi. Actually it choked on the initialization command but with that commented out it ran.
First I tried loading the raspbian one to the pi directly, in the folder that I’m already calling from the java command line with a -D. Didn’t work.
Then I added the raspbian one in eclipse before building the jar, and that ran on the pi.

Thanks much. Sorry for being a noob.

If anyone cares, I am sending values from the pi, reading them in Rio robot code, and able to view them in the driver station log.
Thanks all who helped