Can't read Limelight data from Network Tables

So I am trying to set up the limelight targeting camera for my team’s robot, but I have run into a problem. The Limelight outputs data; I have looked at it on the configuration page (limelight.local:5801), but when I try to read the values from the code, it returns zeroes. I am pretty much using code copy-pasted from the documentation (http://docs.limelightvision.io/en/latest/getting_started.html#basic-programming), but my efforts(over a period of most of the build season) have led me to believe that he issue is with NetworkTables. Here’s the code.

At the beginning of the TimedRobot class:
NetworkTableInstance instance = NetworkTableInstance.getDefault();
NetworkTable table = instance.getTable(“limelight”);
NetworkTableEntry tx = table.getEntry(“tx”);
NetworkTableEntry ty = table.getEntry(“ty”);
NetworkTableEntry tv = table.getEntry(“tv”);

then in teleopPeriodic:
SmartDashboard.putNumber(“tv”, tv.getDouble(0));
SmartDashboard.putNumber(“tx”, tx.getDouble(0));
SmartDashboard.putNumber(“ty”, ty.getDouble(0));
(this causes fields to appear in the Dashboard, but they just show zeroes.

I also have some vision targeting code using the same getDouble functions, it doesn’t do anything.

Any help would be greatly appreciated!

Make sure your robot, driverstation and limelight all have the same team number. Next, you can use ShuffleBoard or OutlineViewer to look directly into NetworkTables from your driverstation computer. If you can see the values there, you’ll get them in your code on the robot.

Thanks! Turned out the Limelight was set to the wrong team number.

1 Like

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