FIRST Robotics Competition Discussions

Showing results for 
Search instead for 
Did you mean: 

How to program a USB camera in LabVIEW?


We connected a USB camera into our roboRIO, but we have no idea how we program the camera to see live feed from it.

0 Kudos
Message 1 of 10



Check out this article about setting up the USB camera that should come with the kit. This camera might not be the one you are using but the process would be the same if it is a compatible camera.

Using the Microsoft Lifecam HD-3000


Sam J.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 10

I read this article and I still have problems. Here is the symptom... When deploying from Main via the Run arrow, my camera works fine.. But when I do a build and execute the program the camera does not work.  In order to eliminate any issues, I did a complete reinstall of all software and built an arcade project with no modifications.  Upon selecting the LifeCam... the dashboard first shows IMAQXdxstream.mjpg... Then it repeats "connecting to" then "Connecting to roboRIO-3974-FRC.local" cycling between both over and over.   I can ping both address successfully.    I am connected via Ethernet.  The driver station Robot address shows the Driver station Enet reads  The target used during the build was roboRIO-3974-FRC.local.   This is becoming a serious issue as we are schedule to play on week 1 starting Friday night.  Any help is very much appreciated.  

0 Kudos
Message 3 of 10

Update:  I reimaged the Robo Rio...  I also get the same behavior using the a USB connection.


0 Kudos
Message 4 of 10

Thanks for your detailed steps Firebirds433-Brendan,


I am curious. Have you had a chance to try with other computer? It would be good to discard it is a firewall issue.


I find interesting that it works with Interactive mode but not in Run as Startup. Do you happen to receive any errors in the DS when the robot restarts and starts running your code (the arcade template)?



0 Kudos
Message 5 of 10

I did experience the same condition a few weeks back with a different PC.   I have not used that PC recently.   This PC is a Windows 10 operating system.  To disable the firewall I recall clicking two Radio buttons on a dialoged with a shield.   I think it had the word "Defender" in the title of the screen.   The PC frequently reminds me that the Firewall is down and asks if I want to put it back up.. Which I don't do.  


I have a old classmate that I can test with.   I am at the office now and can start the test around 6:00 Eastern.   Of course I would like to use this PC in the competition because the screen is bigger and better.  This would be preferred for the sandstorm


Here is perhaps another clue.. (or it could be a distraction.)  This PC had mDMS issues awhile back and could not remember roboRIO-3973-FRC.local.  I had to set the target for deploys to the IP address.   That went away when I installed Apple Bonjour.  But even when I was deploying to the IP address it worked with the Run but not the deploy. 


Note:  I even had the code working with 2 LifeCams deployed via the Main Run arrow.  


Also.. I do not recall seeing any errors on the Driver Station for Arcade Drive project


Thanks again..

0 Kudos
Message 6 of 10

@Firebirds433-Brendan wrote:

[....] But even when I was deploying to the IP address it worked with the Run but not the deploy.

This sounds as an odd behavior. Usually LabVIEW will connect successfully, or not connect at all... I am unsure why it would find the roboRIO in interactive mode (run arrow) and not when setting Run as Startup.


I have a similar case with my team, in which one of our computers "stops connecting" after a while of it being turned on (I presume is some sort of timeout in the mDNS service). What I do is reboot it and try connecting from LabVIEW again. It almost always is able to talk to the roboRIO again and I can both run interactive as well as Run as Startup.


Let us know the results with other computers. When you have a chance, we can also try:

  1. Turn off robot and computer
  2. Turn on computer
  3. Turn on robot with camera connected
  4. Open LabVIEW
  5. Right-click the roboRIO in the default arcade project you created and select "Connect". At this point, LabVIEW should be able to communicate with the device and see a bright green LED next to the roboRIO.
  6. Next, build the Build Specification. Report if you see any errors.
  7. Then, right click the Build Specification and select Run as Startup. Report any errors. I would expect the computer to connect to the roboRIO successfully if LabVIEW was able to do so in step 5.
  8. After deploying, restart the roboRIO and open the DS/Dashboard.
  9. Let's see if we get any images in the Dashboard this way.


If these steps do not work, I recommend reaching out to the phone support line when you have the hardware with you.


All the best,

0 Kudos
Message 7 of 10

This issue was resolved with the help of the excellent NI staff.   It turned out that the camera issue was just a symptom of a bigger issue... and as usual... it was "Operator Error".  In this case it was my incorrect procedure for doing the build.  I incorrectly frequently used the older method of selecting NEW -->  Real Time Application  ---> from Build Specifications rather than the correct method of selecting "Build" from the already created deployment. 


The incorrect method does create a build.. it is deployable to the RIO and it does is detected by the Driver Station, however it will not work correctly.. including not finding the camera.

0 Kudos
Message 8 of 10

We just cam back from a week 1 event and we had issues with our cameras. I had the same issue described in this thread. I called NI FRC support many times, case # 3212837, and I was able to get it to work from a build. The cameras worked 100% of the time at home, but once we got to the competition, the cameras stopped working. Only the LabVIEW teams had this issue. All other teams had no issues with their cameras.


There a few post on Chief Delphi discussing the LabVIEW teams camera issues. Here is one of them:


We are going to another event and we need a solution to this problem. I understand FIRST is looking into a solution as well.

0 Kudos
Message 9 of 10

We also competed in a Week 1 event.  For our 3rd match, the drive team reported that the camera did not work. (Note: They are not always accurate in describing issues.)   


I gave our technician the following instructions and the issue did not return. 


1) Before leaving the pit make sure all applications on the PC are closed including Labview  and the Driver Station.

2) Place the robot on the field and Power it up.

3) Connect the Ethernet cable to the PC.

4) Bring up the Driver Station

5) Wait for the Camera image

6) The image should appear shortly after Com.  If you don't get the camera image, call the FMA technician.    Don't let them start the match until you get the image.  


This worked for us.  When working in the PIT, I frequently do a ping of the roboRIO before bringing up the DS.  I have never had a issue if I bring up the DS after I have confirmed com via the ping between the PC and the roboRio (provided the Camera was in the USB port at the time the Robot Booted up).   


I hope this helps...  





Message 10 of 10