RoboRealm "Invalid magic number from CameraServer!"

I’m setting up vision with RoboRealm and a Logitech C920 USB webcam. The camera is plugged into the top USB port on the RoboRio.

The robot code (in Java) includes, in robotInit():


UsbCamera camera = CameraServer.getInstance().startAutomaticCapture("cam0", 0);
camera.setResolution(640, 480);

In the web interface, I see “HD Pro Webcam C920”. Clicking on it shows:
Name: cam0
Model: HD Pro Webcam C920
Serial Number: a lot of alphanumeric gibberish (as expected)
Status: Present

I can put http://roborio-4131-frc.local:1181 into my web browser and see the camera’s settings, and http://roborio-4131-frc.local:1181/stream.mjpg shows the camera feed. I can also open SmartDashboard and do View > Add > CameraServer Stream Viewer, which also shows the stream (as well as info: 18-20FPS, 14-18Mbps). This shows to me that the CameraServer code is working.

I opened RoboRealm, added an FRC_CameraClient, set the IP to roborio-4131-frc.local, port to 1181, resolution to 640x480, compression to 50% (default), and FPS to 10 (default). When I push Start at the bottom-left of the CameraClient’s dialog box, I get a popup, titled “RoboRealm Error”, that says “Invalid Magic number from CameraServer!” and no image appears. I have also tried 30FPS, 60FPS (it’s a 1080p60 camera), 10.41.31.73 as the IP (the RoboRio’s IP, which also works in the browser), port 1180 (the default in the CameraClient; gives popup “Connected to ‘roborio-4131-frc.local:1180’ but received an error when sending parameters!” every few seconds), and every compression option (0% to 100% in 10% intervals). No image from the camera. Interestingly, the “Invalid magic number” message only re-appears when I delete the FRC_CameraClient and make a new one, not even when I restart RoboRealm.

Any ideas?

My guess is RoboRealm is using the old CameraServer protocol form their FRC_CameraClient class. This years CameraServer just uses a standard mjpg stream. Look into how to read from an IP camera using RoboRealm, and you should be able to connect the same way as an IP camera, just instead to the roboRIO IP address.

I forgot to reply, but this worked perfectly. It’s a Read_HTTP module and the url is roborio-4131-frc.local:1181/stream.mjpg and it works. Thanks!