Camera - Error 66 generated by "Camera: Read MJPG"

We’re having some issues with our vision code (which runs on the cRIO). Periodically, the “Camera: MJPG Loop” block will start producing error 66. Specifically, the “Camera: Read MJPG” generates the error.

We’re not sure what’s causing this - but the robot can’t seem to recover from it just by waiting. If we stop all running code and redownload, the issue disappears without fail. However, after running vision code for somewhere between 30 seconds - a few minutes, the error will reoccur.

Has anybody seen anything like this before? How can this issue be solved/mitigated?


Appendix: LabVIEW “Explain Error” for Error 66
LabVIEW: The network connection was closed by the peer. If you are using the Open VI Reference function on a remote VI Server connection, verify that the machine is allowed access by selecting Tools>>Options>>VI Server on the server side.

This was added to FirstForge earlier in the season as a known bug with how the LV camera code’s new mjpg function deals with the camera shutting down the stream.

The typical case where I’ve seen this occur is when the camera is enabled, but then disabled for fifteen seconds or longer. When reenabled, the camera returns an error 66. There could be other causes for it.

In case of the error, the solution is to close the TCP session, and let the session refnum value go to NULL. This will cause the next loop iteration to open a new one and recover.

I posted a VI on CD earlier in the season. Here is the thread. Please let me know if this VI works, as I edited it while traveling and didn’t have enough to test with.

Greg McKaskle

Huh, wish I’d found this a little earlier. We’d been having the same problems and successfully traced it to the camera being disabled for extended periods of time. To fix it, we just always left the camera enabled and called the Camera Wait VI periodically to keep the connection open. We just controlled the processing of the image. It’s worked for us…