View Single Post
  #3   Spotlight this post!  
Unread 06-03-2016, 14:39
Quantum Byte's Avatar
Quantum Byte Quantum Byte is offline
Lead Programmer
AKA: Domenic
FRC #4776 (S.C.O.T.S. Bots)
Team Role: Programmer
 
Join Date: May 2012
Rookie Year: 2011
Location: Hartland, Michigan
Posts: 16
Quantum Byte is an unknown quantity at this point
Re: Multiple USB Camera Switching Lag

Quote:
Originally Posted by bdaroz View Post
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.
Thanks For the help. I should probably have linked my camera code too

https://github.com/SCOTS-Bots/FRC-20...onDualUSB.java

Thats im doing currently. is that what you mean? My NIVIsion.IMAGdxGrab is currently called right before my setImage function in updateCam()
__________________
Hey there! I wrote a multi robot, multi auton, easy to use library for WPILib Java!
Check it out!
Reply With Quote