Go to Post Dang! And here I was getting all excited about finding out about the game!!! - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2015, 16:26
jmb888 jmb888 is offline
Registered User
AKA: Justin Beekman
FRC #0280 (TnT)
Team Role: Programmer
 
Join Date: Nov 2014
Rookie Year: 2015
Location: Taylor
Posts: 10
jmb888 is an unknown quantity at this point
USB Camera Help

We are having a problem getting two USB cameras to work simultaneously,
we've gone over the examples several times but to no avail. We've even tried rewriting our own camera code instead of copying and renaming the default one, but that also hasn't worked. Can anyone help us with our problem? Thank You
Reply With Quote
  #2   Spotlight this post!  
Unread 23-01-2015, 16:31
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: USB Camera Help

Are you trying to get two cameras to show up on the dashboard, have two cameras processed on the roboRIO, or something else?

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 23-01-2015, 16:39
Halokid Halokid is offline
Registered User
FRC #0280
 
Join Date: Jan 2013
Location: Taylor MI
Posts: 4
Halokid is an unknown quantity at this point
Re: USB Camera Help

We're trying to get 2 cameras plugged into the roborio to show up on the dashboard.
Reply With Quote
  #4   Spotlight this post!  
Unread 23-01-2015, 21:42
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: USB Camera Help

I decided to try it to see what had to be done. One key reminder is to make sure that you allocate a second image with a different name. Using the same name will have them overwriting to the same image.

I wired that second image into a simple loop that used the same Camera IP value going into the Read MJPEG for Dashboard and that is wired to the second display.

Does this help? Were there things that you did differently that seem to break it?

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 26-01-2015, 16:12
Halokid Halokid is offline
Registered User
FRC #0280
 
Join Date: Jan 2013
Location: Taylor MI
Posts: 4
Halokid is an unknown quantity at this point
Re: USB Camera Help

We tried duplicating the camera code in the dashboard but even when they are running with different names it never looks for the second camera it tries to use the same camera for both dashboard displays.

I don't know how to get it to use the second camera for the second display. Do I need to give the USB cameras different IP addresses? If so where do I find that address? Please help.
Reply With Quote
  #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
  #7   Spotlight this post!  
Unread 26-01-2015, 16:50
Halokid Halokid is offline
Registered User
FRC #0280
 
Join Date: Jan 2013
Location: Taylor MI
Posts: 4
Halokid is an unknown quantity at this point
Re: USB Camera Help

Quote:
Originally Posted by randantor View Post
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.
Where do you find "WPI_CameraSendImages To PC Loop.vi" cause I can't find it?
Reply With Quote
  #8   Spotlight this post!  
Unread 26-01-2015, 17:19
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: USB Camera Help

I failed to mention that what I had access to was one USB camera and on Axis. I made the following modification, set the left one to USB and the right to IP and it worked.

If you are wanting the roboRIO to forward multiple USB cameras, you are correct that there are limitations. Your edits sound about right. I wouldn't be surprised to find out that the bottleneck isn't reentrant VIs, but the compression. Making IMAQ Flatten be reentrant may help that.

You will also need to make the DB end of the connection know about the other port as well.

Greg McKaskle
Attached Thumbnails
Click image for larger version

Name:	From Clipboard.PNG
Views:	42
Size:	123.8 KB
ID:	18001  
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 23:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi