How to get USB camera image to Roborealms?

Our team has been looking into using Roborealms this year but we are having issues.

We can’t seem to get a USB camera image over to Roborealms. We can get the feed to show up at the Default Driver station by using StartAutomaticCapture.

I browsed some of the C++/Java forum sections and saw multiple mentions of not using automatic capture but instead using setImage from the cameraserver object. They all mention an intermediate code example (which I don’t have since we are not using c++/Java). We are a bit stumped about how we can get the image to feed into setImage.

Does anyone have any ideas?

Are you sure that you’ve upgraded your RoboRIO to the 2016 image and your driver station to the 2016 tools? If you’re using python, it doesn’t work in 2016 because of NTCore compatibility issues (see CameraServer doesn't seem to work with 2016 default dashboard · Issue #172 · robotpy/robotpy-wpilib · GitHub). We might have something compatible with LabVIEW by the end of this week, which would resolve this bug.

I browsed some of the C++/Java forum sections and saw multiple mentions of not using automatic capture but instead using setImage from the cameraserver object. They all mention an intermediate code example (which I don’t have since we are not using c++/Java). We are a bit stumped about how we can get the image to feed into setImage.

Does anyone have any ideas?

The USBCamera stuff in python is going to be very low performance, and I wouldn’t recommend using it. Instead, I would recommend using mjpg-streamer (see GitHub - robotpy/roborio-packages: Build files for RobotPy ipk packages for more information on installing packages), and it appears that the HTTP_READ module in RoboRealm will support this type of stream (their docs: HTTP Read).

Let me know if it works, and we can add notes to the mjpg-streamer notes.

We have updated our RoboRIO image and Driverstation. BTW, that compatibility issue github link doesn’t seem to work.

I was hoping to not have to do anything super special to get this to work. This will be the first time since 2006 our team is attempting to do any type of image processing so we don’t really know what we are doing. If we have to do something special though we will certainly attempt it.

I’ll see about trying out the mjpg-streamer (I’ll have to read up about installing packages at that link you gave since I have never done that before).

Thanks!

We loaded mjpg-streamer onto our Roborio and are able to see the stream at the default page (http://roborio-1288-frc.local:5800) when connected via USB to the roborio.

However, we hit a wall with HTTP_Read since we do not know what url to use that leads to a direct jpeg image. The default url has all html pages.

The HTTP_Read documentation states that "The HTTP_READ module does NOT read HTML pages. You need to provide it with the specific url that will return a jpeg image. If will understand both moving jpeg images (mjpg) OR still jpeg images that refresh each time they are reloaded. "

nevermind we were dumb

I suppose you read the various pages and found the URL there? :slight_smile:

yeah. http://roborio-1288-frc.local:5800/?action=stream worked.