Limelight NetworkTable won't update while tracking AprilTag

We are using 2023 firmware of limelight. While we are trying to get the values from the NetworkTable API, we find that the value won’t be updated, though it seems to be tracking from the browser.
Things we have done:

  1. configure the limelight port as well as the domain in RobotInit():
for (int port = 5800; port <= 5805; port++) {
      PortForwarder.add(port, "limelight.local", port);
    }
  1. get NetworkTable which is written completely the same as the docs, so it may not matter.
1 Like

How is your network setup on the robot? Does it work without port forwarding? Are other NetworkTables values updating? How are you checking NT?

You shouldn’t need port forwarding unless the limelight isn’t actually on the network (like for connecting via usb).

2 Likes

We recently managed to deal with this problem as we can use NetworkTable API to read the value of the AprilTag, which indicated that we could now successfully connected to the limelight camera and the cam can identify the tags.
However, when I used the following code to get the 3D target area & angle, it failed to get anything.
(I can get the value using 2D targeting APIs, but I have to use 3D location so it’s useless. )

public class limelight extends SubsystemBase {
    public limelight() {
        limelightConfig.getEntry("camMode").setNumber(0);
    }
    NetworkTableEntry tableData = NetworkTableInstance.getDefault().getTable("limelight").getEntry("botpose");
    public double defaultData[] = new double[6];
    @Override
    public void periodic() {
        data = tableData.getDoubleArray(defaultData);
        trackingStatus = (NetworkTableInstance.getDefault().getTable("limelight").getEntry("tv").getDouble(0) == 1 ? true : false);
        if (data != defaultData) {
            x = data[0]; //get the x position of limelight
            y = data[1]; //get y
            angle = data[4]; //get the angle of the bot
        }
    }
}

We are now using limelight 2+.
Many thanks.

However, this code will lead to some issue “no robot code”.
I’ve tried the new entry called “targetpose_robotspace”, it solved the problem above, but still can’t fetch the data of the target area.

Thanks for your reply, but I’m sure that the cam is connected to the roborio, and both have been given a static IP address.

This usually indicates a code crash. The console output will likely help shed some light as to what the error is.

What version of the limelight firmware are you running? I would upgrade to the latest if not.

Is there any reason you are not using the Limelight helper java library?

Did you see anything on our console? Does this code successfully build and deploy ? I don’t see a declaration in this class of the trackingStatus variable.

I’m sorry that I just forgot to paste it to the code. Excuse my poor expression, I suppose I have mentioned that the code ran rather well and I can now succeed to recognize the value of the tag while the target area can’t be gained through botpose API but still available in normal 2D tracking API.
I don’t know why is the reason and it’s rather urgent for me.

Do you have Full 3D tracking turned on? Does the Limelight show a 3D pose in the UI?

yes, exactly. thus i felt weird about that.


this is what it showed on the panel.

alright, it turns out to be some problems with an empty pointer, now we changed to parsing JSON and checking empty pointers in advance then it works well.

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