Thread: USB Camera Help
View Single Post
  #6   Spotlight this post!  
Unread 26-01-2015, 16:35
randantor randantor is offline
Registered User
AKA: James Y
FRC #0624 (CRyptonite)
Team Role: Alumni
 
Join Date: Jun 2013
Rookie Year: 2012
Location: Katy, TX
Posts: 48
randantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of lightrandantor is a glorious beacon of light
Re: USB Camera Help

It's a fairly involved process to get 2 USB cameras working. The "camera IP address" is really just the RoboRIO IP address, because the RoboRIO is what actually reads the cameras. By default, the RoboRIO listens on TCP port 1180 and sends a stream of JPEG images over a TCP connection through a custom protocol.

In order to use two different cameras, we needed to modify "WPI_CameraSendImages To PC Loop.vi" to take a port as an input, instead of just using 1180 as a hardcoded value. This way we can use two different TCP streams on different ports, one for each camera. The VI also needed to be made reentrant so multiple cameras can send images at the same time.

On the dashboard side, we modified the MJPEG loop VI plus its internal USB camera reading VI (WPI CameraGet Image From Controller.vi) to also take a TCP port to use.

That so far has sort of worked, but the image from one camera appears frozen while the other streams. I think this is because the actual TCP read occurs in a non-reentrant VI, meaning that the receive loop for one camera is blocked while data is being transferred over the network for the other. I have modified more of the receiver VIs on our dashboard to make them reentrant, but haven't been able to test it yet.

In the future, it would be nice to have a way to stream images from multiple USB cameras without modifying WPI VIs. It's a bit nicer with the Axis cams, but some modifications are still necessary to get things like recording working right.
Reply With Quote