Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers.

Video output freezes on two different camera

0 votes
Recently we purchased some JeVois cameras for use on a FIRST FRC robot. As we have been developing our code we have had repeated issues with the cameras video output freezing. This has happened on both camera though it does occur more frequently on one of them. It has happened when using our own custom module as well as some of the modules included with the camera. We have tried different USB cables and also tried to provide full power via a separate dedicated power input on the shorter end of the USB Y cable. When this has happened we are still getting serial data out. We have experienced this issue on multiple laptops as well as when connected to the RoboRIO.

It appears that others have encountered this issue as well. We have two more cameras ordered that have not arrived yet.

Are there suggestions for debugging this and finding the root cause? What can be done to resolve this issue? This camera is a nice system for vision analysis but if this continues they may not be deemed reliable enough for use on the robot.
related to an answer for: Why does Darknet freeze?
asked Feb 1 in User questions by myedinak (120 points)

1 Answer

0 votes
Maybe a loose connector? Are you moving the camera when this happens? It might be a good idea to secure both the camera and the USB cable to a single mouning plate that you would move around, providing some strain relief on the USB cable. Does the mini-USB connector appear a bit loose if you giggle the cable? We have been able to reproduct this on some mobile robots where we had been a bit rough with the connectors.
answered Feb 1 by JeVois (20,780 points)
It turns out that the freeze occurs if the host is not reading data from the serial port. I suspect what is happening is that the serialWrite is blocking if the buffer is full. As long as the data is read, or serout is set to None, we do not experience the video freezing.
Ah, great, thanks for sharing. Just to make sure, is this when using serial-over-USB, or hardware serial? The hardware serial has no flow control so it should not block unless you are exceeding the serial bandwidth. For serial-over-USB, indeed, if you are not reading the data, it may saturate the buffer and block. Unfortunately, this is a tricky problem to solve, as there is no way with serial-over-USB to query whether someone is listening on the other end, yet the flow will indeed end up blocking when the buffer is full and nobody is listening. We have some workaround code in Serial.C but we need to review and test it some more it seems.
I can confirm that this is exactly what is happening when sending the tracking data over USB. We saw the same behavior. This will happen almost every single time the robot boots as the JeVois boots much faster than the roboRio. Fortunately as soon as the Rio establishes the port, the data and video resume streaming.
I suggest you seriously look into handling this error situation should it occur mid match.