Checking For Limelight Disconnection

During our last event at West Valley, we had issues with Limelight disconnecting during a match which caused us to forever look for the target. We were wondering if there was a way to check in code if the limelight is disconnecting?

1 Like

Not currently using this in our robot code, but we log among other things the network table entry tl – which is the pipeline latency number. From our logs, I feel pretty safe saying that if it is changing you are connected, and if it is not you are not. It have a fair amount of jitter.

You could potentially use the java method isReachable, but I would only do that in a thread (would take a little too long for me in our main loop) and only checks ICMP (ping) not that the limelight is actually working.

Our Limelight library has a heartbeat method isConnected
It basically set the pipeline latency to zero… waits 50ms then checks the value correction then resets again. The isConnected checks to see if the Latency is not Zero. By then LL should have pushed a new value and this value is always updating, but there is a small possibility you could catch it at zero just after the reset.

1 Like

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