Can't get degree values from Limelight

When I print the tx value it reads 0.0. even though I know it is around 15, here is the code to retrieve it from he table.

NetworkTable table = NetworkTableInstance.getDefault().getTable(“limelight”);
NetworkTableEntry targetx = table.getEntry(“tx”);

          double tx = targetx.getDouble(0);

Do you see a different value in the limelight web interface?

The value on the web is 14, but I get 0 when I try to print it

Also, make sure you’ve set the team number in the limelight interface to match the team number on your robot. What you are probably seeing is the default value that network tables returns when it didn’t actually find the table.

Well when I use the Outline viewer, I can see the values, and I know I set it up properly, at least to setting the team number

Fire up Shuffleboard and verify the values are the same as to what key you are using when you add the limelight table to shuffleboard it should all be there visible to you as well.

Yes it is.

Have you checked the return value from the getValue is not kUnassigned? Or, if so, can you enumerate the keys of what you see and see why your code seems to be missing them?

Where is that code placed @Agent_SquirrelSide? Is it in one of your periodic methods?

First the code is in public class Robot extends IterativeRobot (right under it to be exact), no periodic stuff, second, whenever I print the getValue(): System.out.println(targetx.getValue());

All I get is this:


getValue() returns a NetworkTableValue, which is basically a typed union, as NetworkTable values can be one of several possible types. The methods on NetworkTableValue can be used to figure out what type the value is, get the underlying data, etc.

However, there are more specific methods for individual data types on NetworkTableEntry to make things easier. If you know the type is e.g. a double, it’s much easier to use NetworkTableEntry.getDouble(), which simply returns a double.

i just realized something I should have along times ago…

They have 2019 Examples!

And Now I have it working.

Learn from my stupid mistake.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.