Vision Thread

class Robot : public frc::TimedRobot {
  public:

  frc::VisionRunner<<grip::GripPipeline>>* m_vision;
  std::thread* m_visionThread;
  std::mutex* m_lock;
  double centerX = 0.0;
  double distance = 0.0;

  void RobotInit() {
    frc::CameraServer::GetInstance()->StartAutomaticCapture();
    cs::AxisCamera ipCamera = frc::CameraServer::GetInstance()->AddAxisCamera("10.5.9.53");

    int visiontesting = 0;

    m_vision = new frc::VisionRunner<<grip:GripPipeline>>(ipCamera, new grip::GripPipeline(), [&](grip::GripPipeline &pipeline) {
    frc::SmartDashboard::PutNumber("vision testing", visiontesting);
    if (pipeline.GetFilterContoursOutput()->size() > 0) {
      frc::SmartDashboard::PutNumber("vision testing", visiontesting);
     } else {
     frc::SmartDashboard::PutNumber("vision testing", visiontesting);
      }
  };

  m_lock = new std::mutex();
  m_visionThread = new std::thread(&Robot::visionExecuter, this);
}

void visionExecuter()
{
  m_vision->RunForever();
}

So we’re trying to run our GripPipeline and put a number on the SmartDashboard, just to see if our pipeline works. The code above is the part that’s breaking. For some reason, not only does the code not appear in the SmartDashboard, it breaks the Driver Station (when we run it, the robot code indicator turns red). Thanks for any help with this issue.

That means your code is crashing. Can you see any errors in riolog in vscode or in the driverstation?

We’ve narrowed the code crash down to this line.