Connecting a YUYV Camera to the SmartDashboard via a CameraServer on the Roborio

We have a few USB cameras kicking around. We have gotten all of them sending data to the smartdashboard via FRCVision on the Raspberry Pi. However, we are trying to connect one of them directly to the Rio, and stream that output to the SmartDashboard.

The “basic program” to do this is given in the wpilib docs as


Simple enough, and it works fine…for cameras that output an MPeg stream. However, a couple of our cameras are YUYV. Using the Pi, we set the appropriate parameters, and voila, we see it on the smartdashboard. Now I’m trying to do the same thing on the rio. Here’s the code I thought might work.

camera1=new UsbCamera(“Fred”, 0);

camera1.setVideoMode(PixelFormat.kYUYV, 320, 240, 30);


Not seeing anything. Nothing’s crashing, but no image available.

(I’ve tried a few more complex things, with CvSource and CvSink and such, but none of those work, either. This seems like the simplest set of code that I thought might have worked.)

As noted, I can get that image if I use FRCVision on a raspberry pi and enter those vision parameters, but on the Rio, nothing.

Some cameras have issues with some YUYV modes on the Rio Linux kernel. They connect, but just hang when trying to grab an image.

1 Like

Can I infer from your answer that my code really ought to work, and if it doesn’t, that camera will never work on the RoboRio?

(That would explain a lot.)


1 Like

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