Adding limelight to WPIlib raspberry pi 3.b as a camera

We have been trying to add limelight to raspberry pi running the WPIlib. In the vision settings there are two options for adding a camera that is not connected. When trying to add it as a switched camera, it requires a Network Table Key that we couldn’t find. Is there a way to add a limelight as a USB camera? WPIlib docs don’t have a lot of helpful information on this, so we were wondering how others do this. Thanks for help!

I’m not entirely sure what your trying to do. Do you already have a limelight and are trying to get information from it through wpilib? If so look at limelight’s documentation. If you have custom hardware like a raspberry pit I would recommend looking at photo vision as a way to do vision processing with it.

1 Like

The other option is to run Photonvision on the Limelight itself. If you are trying to use a Limelight with a Romi, though it is possible, I would recommend adding Photon to the Romi itself (I think the limelight needs 12 volts to run).

1 Like

Others are trying to guess why you would want to do this. I’m not going to guess but knowing your reason might help get better answers.

To answer your question, the LimeLight is behaving more like an IP camera than a USB camera. I think the WPILIB CameraServer including the one on the WPILIBPI (assuming that’s what you meant by RPi running the WPILib; there is another possibility, though) will accept a URL as input instead of the usual USB port. Check out the docs to make sure I guess correctly.

2 Likes

Yes. We have a limelight and are trying to communicate it with the raspberry pi. Also, we weren’t very sure what photon vision is. Is it a sort of software for vision processing? And where would we find information about it? Just clarifying :slight_smile:

You said the WPILIBPI will accept a URL as an input. Is that something fixed for every limelight or is it something we have to set in the limelight settings? When trying to add a “switched camera” to the WPILIBPI, it asks for a certain “Network Table Key”. Is this related to the URL you’re talking about? The FRC documentation on the limelight seems to explain an older version of the software, so it doesn’t cover the “Network Table Key”.

Photon is an open-sourced set of utilities that is intended to accomplish the same thing as the Limelight OS. More info can be found here.

The Limelight uses ip Tables. So, if the raspberry pi is running WPI IP tables, this should be possible. We have connected to a Limelight directly with a laptop. In theory, this should be just as easy with Pi OS.

However, what you do from there will probably involve a bit of work with networking.

1 Like

This may get you to where you want to go or most of the way.

more hints

I think there is nothing magical about the Networktables keys but it’s another case of easy when you know how. Obviously I don’t know how without reversed engineering which is what you can do but I know you can add keys exactly the same as if the CameraServer for a USB camera added the keys. Only a very few keys of the several normally generated are needed to get the camera to display (maybe 2 or 3 keys with a name and the URLs). I recall a post here in CD, I think, that shows the keys and values to add an IP addressed stream to the Network tables so you can show the stream on the ShuffleBoard but I can’t find it or I misremembered the topic.

Maybe something like this

more somewhat related stuff

final String PI_ADDRESS =“roboRIO-4237-FRC.local”;
final int PORT = 1182; // or whatever it ends up being

String tmp = {“mjpeg:http://” + PI_ADDRESS + “:” + PORT + “/?action=stream”, “mjpg:http://169.254.104.211:1182/?action=stream”};

NetworkTableInstance.getDefault()
.getEntry(“/CameraPublisher/PiCamera/streams”)
// .setStringArray(new String({“mjpeg:http://” + PI_ADDRESS + “:” + PORT + “/?action=stream”}));
.setStringArray(tmp);
// [“mjpg:http://roboRIO-4237-FRC.local:1189/?action=stream","mjpg:http://169.254.104.211:1189/?action=stream”]
NetworkTableInstance.getDefault()
.getEntry(“/CameraPublisher/PiCamera/connected”)
.setBoolean(true);
}

Search CD with the words switched limelight and you might get the answer.

1 Like

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