|
Re: Multiple USB Camera Switching Lag
We're also using multiple USB Cameras on the RoboRIO, albeit with a slightly modified CameraServer class. We also experience about a 1.5s "hiccup" in the video feed on any camera change. We haven't traced it down yet, but believe it has to do with initializing and starting to get image data from the cameras themselves.
Right now our code is such that switching feeds blocks the main Robot thread, but it's only about 30ms or so, our next move is to move the switching code into the thread itself and simply signal the CameraServer thread from the main thread.
At quick glance it wasn't clear that you're running your image serving code in a separate thread, or at least the gathering of the image code from the camera appears to be in your main thread. If your delay is caused by the actual video itself not being ready this may not help, but if you're getting lag in other parts of your robot moving the image capture (NIVision.IMAQdxGrab) into the thread with the CameraServer could help.
|