Screenshots     Download     Pricing     Docs     Tutorials     Resources     Contact     Forum     Search  

Network Tables

The Network Tables module implements the FIRST FRC Network tables protocol to provide sharing of information amoungst machines including that of the CRIO. The module allows receiving and sending of variables to the network table.

Note that this module assumes Network Tables 2.0 or 3.0. It is NOT compatible with versions below 2.0.

Interface

Instructions

1. Connection - Specify the hostname and port for the network tables server. Note that the IP address is typically 10.X.Y.2 where X and Y are created via the team number.

2. Send to Network - Select which variables you want to send from RoboRealm into the network

3. Receive from Network - Select which variables that are currently in the network that you want to import into RoboRealm

4. Send Variables Type - Select how the RoboRealm variables should be interpreted when sent out onto the network. Automatic will chose the best type that represents the variable to send.

5. Variable Filter - Selects how the variable name from the network will be modified when entered into RoboRealm. As RoboRealm can use variables within expressions the '/' symbol can be interpreted as a division sign. To ensure that this does not confuse a RoboRealm expression you can select other options that will remove those '/' from the variable's name.

6. Prefix - Specify what prefix to use when sending and receiving variables. Each time a variable is sent out to the network tables system it will be prefixed with the prefix (default is SmartDashboard). This prevents you from having to rename variables to avoid naming collisions.

7. Send Delay - Delays the sending of information for the specified milliseconds to help group changes and reduce network bandwidth.

Example

To experiance the communication you can use the Set_Variable module within RoboRealm to create a variable, select that variable within the Network Tables module and then accessing it using the following code within the CRIO.

	NetworkTable server = NetworkTable.getTable("SmartDashboard");
	try
	{
			System.out.println(server.getNumber("IMAGE_COUNT", 0.0));
	}
	catch (TableKeyNotDefinedException ex)
	{
	}

When working with arrays you can use


	NetworkTable server = NetworkTable.getTable("SmartDashboard");
	try
	{
		final NumberArray targetNum = new NumberArray();
		server.retrieveValue("testla", targetNum);
		if (targetNum.size()>0)
		{
			System.out.print(targetNum.get(0));
			System.out.print(' ');
			System.out.println(targetNum.get(1));
		}
	}
	catch (TableKeyNotDefinedException exp)
	{
	}
to view the first 2 elements of a double array.

Notes

For those using Network Tables and the roboRIO with 2015 code in the 2016 competition please note that the hostname changed from roboRIO-XXXX.local to roboRIO-XXXX-FRC where XXXX is the team number. Without the correct hostname communication will NOT appear to work as in previous years.

The most problematic issue with using this module is ensuring that you have a network connection from the machine running RoboRealm to the machine that is running the network tables server. You may want to use NetScan to know if you can at least see the network tables server machine on the network.

For more information


Robot programming with WPILib
FIRST Robotics Resource Center

 New Post 
Network_Tables Related Forum PostsLast postPostsViews
None



© 2005 - 2017 RoboRealm. All Rights Reserved. | Contact | Privacy | Disclaimer | Link to Us |