Log in

View Full Version : Data from GRIP not available in Java Code


moomoomoo309
26-01-2016, 15:49
I've been using a roboRIO and trying to get a Contour Report from GRIP into my code. GRIP works well enough; data comes from it and into the Network Table viewer (I can see all of the data in the Network Table Viewer!). Once I attempt to get the data from the NetworkTable into my code, it does not work.

What I've tried (in teleopPeriodic) given table=NetworkTable.getTable("GRIP/myCountoursReport")):

Printing out table.getKeys() (which is empty)
Checking if a given index (I.E area) exists (table.containsKey("area") was false)
Publishing a different number into the GRIP table and trying to get that (put the framerate into the table, NetworkTable.getTable("GRIP").getNumber("myNumber",Double.NaN) returns NaN)


Do you have any advice for how I can fix this problem, or any other diagnostic steps you may need?

ThomasClark
27-01-2016, 12:43
Is OutlineViewer in client mode or server mode?

What is the NetworkTables server address in GRIP?

moomoomoo309
27-01-2016, 14:35
The OutlineViewer is in client mode and the NetworkTables server address is roborio-224-frc.local. GRIP deploys fine, and the data is correct in the OutlineViewer, but I can't import any NetworkTables.

ThomasClark
27-01-2016, 14:37
What is GRIP running on?

Can you share a screenshot of your pipeline?

moomoomoo309
27-01-2016, 14:48
GRIP is running on a Windows 7 laptop, and here's (http://imgur.com/qzmC53P) the pipeline.

http://imgur.com/qzmC53P

ThomasClark
27-01-2016, 14:59
Everything seems OK from the GRIP side of things. Can you post a link to your full robot code?

moomoomoo309
27-01-2016, 15:07
http://pastebin.com/8WrBNeK6

Here's the code. When I get the table, it always returns an empty one.

ThomasClark
27-01-2016, 15:17
table = NetworkTable.getTable("GRIP/myCountoursReport");

should be


table = NetworkTable.getTable("GRIP/myContoursReport");

moomoomoo309
27-01-2016, 15:26
Thank you, that fixed it. It's always the simple mistakes that get us.

On a side note, why did "NetworkTable.getTable("GRIP").getKeys()" return an empty set? Shouldn't it have "myContoursReport" in it?

ThomasClark
27-01-2016, 15:28
getKeys() returns the set of values directly inside the GRIP table. I don't think it include subtables.

getSubTables() is probably what you're looking for.