Network Tables?

Was just hoping someone could give me the down low on what they are used for/ how to use them?

NetworkTable object can be used to pass data to/from robot code and another program running on another computer on the network. SmartDashboard uses it to pass data to/from robot.

We use it to pass data from image processing software running on the driver station back to the robot.

Here is example code:

//Robot Code
// declare object
NetworkTable cameraTable;

// getinstance (table is a singleton, if one does not exist then one will
// be created otherwise returns reference to existing instance
cameraTable = NetworkTable.getTable("camera");

// get data element from the table
// default values returned if no data has been provided from another source yet

Boolean imageFound = cameraTable.getBoolean("found", false );
Double imageOffset = cameraTable.getDouble("offset", -1.0);
Double imageDistance = cameraTable.getDouble("distance", -1.0);

System.out.println( "found = " + imageFound);
System.out.println( "offset = " + imageOffset);
System.out.println( "distance = " + imageDistance);

// Driver Station PC
// camera image processing is done in C# application on DS

// declare it
private NetworkTable table;

// Init NetworkTable
NetworkTable.setIPAddress("");  // ip of crio
table = NetworkTable.getTable("camera");

// in the image processing loop

table.putBoolean("found", true);
table.putDouble("distance", distance);
table.putDouble("offset", offset);

Charles, we are interested in doing something with NetworkTable but we are not familiar with it, so here are a few questions:

  1. On the Robot side, I can see WPILib has provided the NetworkTable class, so that part seems straight forward.
  2. On the PC side, who provides the NetworkTable class. Is there an SDK of some sort we need to download? We are planning to develop with C++ on the PC side with Microsoft Visual Studio (C# is fine too if necessary).

NetworkTable is part of smartdashboard, available at

We were looking at a number of solutions to get from PC into smartdashboard or directly to robot.

Just the other day I came across IKVM.

You can use this tool to “convert” a jar file into a .net assembly.

run IKVM.exe NetworkTable_Client.jar and you get NetworkClient_Table.dll.

Add it as a reference to your managed code project and start “talking” to your robot (see attached screen shot)

Thanks. I don’t have svn at work so I will download the smartdashboard code tonight and take a look. Without looking at the code, I am hoping the NetworkTable_Client.jar file is not overly long and complex. If so, in theory, I could just port it to C++ by hand. C++ and Java are similar enough that it should not be too difficult.

BTW, I did try to look for the NetworkTable_Client.jar file over the web browser interface but the source tree has many branches and very deep. Do you happen to know the path to that file?


Here is the full url to NetworkTable_Client:

It was more than I wanted to recode.

I just figured out how to put and read data on the preferences grid of the Smartdashboard using Network Tables but there’s is this harmless yet annoying issue that’s bugging me.

I changed the name of the Key / Value in my code but instead of it replacing the old one, it made a second one. the old one is still there on the smartdashboard preferences grid and i can’t figure out how to get rid of it… any ideas?

There is a python implementation of NetworkTables available in RobotPy. See the source tree in github.

This doesn’t work. I’m using eclipse on a windows 7 pc and the wpi lib.

package org.usfirst.frc.team2585.robot;
import edu.wpi.first.wpilibj.tables.ITable;
import edu.wpi.first.wpilibj.tables.ITableListener;
import edu.wpi.first.wpilibj.networktables.NetworkTable;

public class VisionCalib implements ITableListener{
	private double xCoord;
	private double yCoord;
	private double distance;
	private NetworkTable nt;
	//private ITableListener table;
	public VisionCalib() {
		nt = NetworkTable.getTable("SmartDashboard");
	private void update(){
		xCoord = nt.getNumber("COG_X", 1);
		yCoord = nt.getNumber("COG_Y", 0);
		distance = nt.getNumber("TL_TARGET_DISTANCE", 0);
	public void valueChanged(ITable itable, String key, Object obj, boolean isNew)
	public void setNums()
		nt.putNumber("COG_X", 0.0);
		nt.putNumber("COG_Y", 0.0);
		nt.putNumber("TL_TARGET_DISTANCE", 0.0);
	public double getDistance() {return distance;}
	public double getX() {return xCoord;}
	public double getY() {return yCoord;}
	public NetworkTable getNt() {
		return nt;
	public void setNt(String table) {
		this.nt = NetworkTable.getTable(table);
	public String toString()
		String s="";
		s+="xCoord = "+xCoord;
"+"yCoord = "+yCoord;
"+"Distance = "+distance;
		return s;