Building a dedicated GRIP Thread

Our team’s programmers have been hard at work trying to get GRIP to work since kickoff day, and as far as we can tell, we are one error message away from finally being able to run it in our code. We can upload the code, but when we enable it it gives us a “robots don’t quit error.” As far as we can can tell, this would be gone if we could figure out how to put the openCV pipeline into a dedicated thread. Anyone who’s had and fixed this problem, or knows how, would be greatly appreciated.

You need to use VisionThread. The code to do this would look something like this:

UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(...);
VisionThread vthread = new VisionThread(camera,new GeneratedGripPipeline(), new VisionListener());

Of course, the VisionListener can be replaced by a Lambda if that is your style. If you already have a VisionRunner object set up, it would simply be

VisionThread vthread = new VisionThread(visionrunner);