No Robot Code

For some reason the vision code on wpilib isn’t working anymore.

#include "WPILib.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
class Robot: public IterativeRobot
    static void VisionThread()
        cs::UsbCamera camera = CameraServer::GetInstance()->StartAutomaticCapture();
        camera.SetResolution(640, 480);
        cs::CvSink cvSink = CameraServer::GetInstance()->GetVideo();
        cs::CvSource outputStreamStd = CameraServer::GetInstance()->PutVideo("Gray", 640, 480);
        cv::Mat source;
        cv::Mat output;
        while(true) {
            cvtColor(source, output, cv::COLOR_BGR2GRAY);
    void RobotInit()
        std::thread visionThread(VisionThread);

I have copied this code straight into my code putting the parts in their respective places and in the past to days it has started causing the robot code to crash. The driverstation shows it has code then the light turns red, then it turns green, then red again, and again, and again.

EDIT: After some more messing the culprit for the crash is outputStreamStd.PutFrame(output);

Is there anything being printed out to the console of the robot that might give us more clues to what’s going wrong?

It’s throwing the robotdrive not updated fast enough error