So, I have posted the code for our USB camera below. This works fine for us when we tether into the Rio with USB or with ethernet, but every time we played a match hooked up to the FMS our camera never showed up. Is there something wrong with the code, or is there another configuration setting we have failed to do? Thanks for any insight.
static void VisionThread() {
// This function executes as a separate thread, to take 640x480 pixel
// video frames from the USB video camera, change to grayscale, and
// send to the DriverStation. It is documented here:
// https://wpilib.screenstepslive.com/s/currentCS/m/vision/l/
// 669166-using-the-cameraserver-on-the-roborio
cs::UsbCamera camera =
frc::CameraServer::GetInstance()->StartAutomaticCapture();
// camera.SetResolution(640, 480);
camera.SetResolution(160, 120);
cs::CvSink cvSink = frc::CameraServer::GetInstance()->GetVideo();
cs::CvSource outputStreamStd =
frc::CameraServer::GetInstance()->PutVideo(“Gray”, 640, 480);
cv::Mat source;
cv::Mat output;
while(true) {
usleep(1000);
if ( cvSink.GrabFrame(source) )
{
cvtColor(source, output, cv::COLOR_BGR2GRAY);
outputStreamStd.PutFrame(output);
}
}
}