Problems with the limelight

We are having problems using the limelight. Whenever we deploy our code, we get the error:

Here is our github, sorry we are a new set of students working this year

I remember seeing this error at some point, and it had to do with trying to access a networktable entry that didn’t exist. To verify if the Limelight networktable is correct, I would recommend opening glass or outline viewer after deploying the robot code and finding if there is a table there with the data the limelight sends to it.
If that “limelight” table is called something like “Limelight 2” you’ll need to change the network table that you reference in Limelight.java to exactly what the table is called.
If there is no table at all, it’s likely that your limelight IP or something of the sort isn’t set up properly.
If there is that table, then it may be a problem with the way that you get the data from the table.
Also it would help to know if you’ve been able to get the limelight working through a web browser.
If you can provide more information it’ll be much easier to find the issue.

The symptom may look similar, but I’m not sure root cause is the same.

The error indicates that in Autonomous.java, on line 39, some null value is being passed into the addRequirements() method.

Indeed, in the code posted, in Autonomous.java on line 39, you’ll see this.limelight is being used, which is not initalized anywhere that I can see. this.limelight must be set to a value before it can be used.

The link in the error points to this page, which has information and samples on how to interpret the error message to discover root cause - definitely worth a read if you haven’t been there yet!

Looks like they initialize Limelight in RobotContainer.java. Looking through their code it appears there is no public Limelight(){} in your Limelight.java subsystem, just a public void Limelight(){}. Could that be the problem?

1 Like

I’m not sure I understand.

this.limelight is a private member variable of the Autonomous class. In the constructor for Autonomous, it is used before it is set. I’m not sure I understand how it could have any value other than null at the time of usage, when the stack trace was printed.

Oh I see they never put this.limelight = limelight. Gotcha. Understood, thanks.

1 Like