Log in

View Full Version : Need help with Network Tables


peterl
22-02-2016, 22:28
I have no experience with Network Tables. I need to send an 2d array to a LabVIEW dashboard using network tables, and I don't quite know where to start.

public java.lang.Boolean[] getBooleanArray(java.lang.String key,
java.lang.Boolean[] defaultValue)

I found that on the Java Docs on: https://team2168.org/javadoc/

If someone used Network Tables to comunicate to a dashboard last year and could post that code, I think I could gain a further understanding of network tables from that.
Thanks.

fireXtract
23-02-2016, 14:05
For my usage I use:


public NetworkTable table = NetworkTable.getTable("locationOfItem");
actualVariable = table.getNumberArray("arrayItem", defaultValue);
SmartDashboard.putNumber("displayName", actualVariable[0]);

This uses arrays, but you could use it with just numbers by using different getNumber with table.

Arhowk
23-02-2016, 23:27
We just got support for 1D arrays this year, I don't think 2D arrays are currently viable (unless the above poster's solution works for you)

if you ABSOLUTELY need a table, and you can do some data processing on the dashboard (not familiar with configuring the lv dashboard), than you can always send the data as a string encoded with the raw bytes of the 2D array

peterl
24-02-2016, 10:32
We just got support for 1D arrays this year, I don't think 2D arrays are currently viable (unless the above poster's solution works for you)

if you ABSOLUTELY need a table, and you can do some data processing on the dashboard (not familiar with configuring the lv dashboard), than you can always send the data as a string encoded with the raw bytes of the 2D array

I didn't realize that. If I can send 2 1D arrays, I can combine them to create a 2D Array. I will see about trying fireXtract's method.

Arhowk
24-02-2016, 12:22
I didn't realize that. If I can send 2 1D arrays, I can combine them to create a 2D Array. I will see about trying fireXtract's method.

It depends on the scope of your project. If it is a static amount of arrays than yes you could always just use 5 different 1D arrays.