FIRST Robotics Competition Discussions

Showing results for 
Search instead for 
Did you mean: 

Can (2) USB Cameras be setup on this year's robot?

Our team wants the program team to have two camaras on our robot this year.  One for vision tracking - we won't have live video coming through radio. the other will stream live back to driver station.  We'll have vision tracking being processed on roboRio.  Is this doable?

0 Kudos
Message 1 of 8


I think you should be able to acquire images from two cameras simultaneously. You should be able to connect two network cameras to the bridge, two USB cameras to the roboRIO, or some combination so these. However I don’t think I have ever seen a team implement two cameras on their robot. So I would recommend creating a simple test application that acquires and displays images from each camera. Then you can execute that test VI interactively on the roboRIO to make sure both images are being acquired. From there you could work the dual image acquisition into your main robot application.

My main concern would be making sure the bridge or USB ports have enough bandwidth to acquire images at the speed and resolution you want. However the best way to verify this is through testing.

Good luck and have fun!

Earl Campaigne

Applications Engineer

National Instruments

0 Kudos
Message 2 of 8

Thanks Earl,

I'm in the process of building a test robot for vision only and should have results this Saturday.  My plan is to test with (2) USB camera's first. If we can't get both camera's working the way we want than I'll use (1) USB with (1) IP camera.  The USB camera will be for visioin tracking on roboRio, the IP camera will be for live video.  I share the results later.

BTW the vision examples this year are awesome!  Great job to the team that crated this year's vision examples.

Scott Wheeler

FIRST Team 4451 Robotz Gargage

Programming Mentor

0 Kudos
Message 3 of 8

Hey Scott,

I am glad you like the new vision examples this year. I think your approach to testing sounds like a great idea. I hope everything works out and you get both cameras running. Please let us know what happens!

0 Kudos
Message 4 of 8

If you use the cameras as you say, with one feed that doesn't leave the robot and a second feed to the driver station, you should be OK.

If you try to send both feeds to the driver station, be careful. At a real competition you run the risk of saturating the available bandwidth from your robot to the laptop, which can render your robot partially or wholly unresponsive. The Field Management System limits each robot to 7 mpbs.

I inadvertently discovered this limtation a couple of years ago when I cranked up the camera resolution to 640 x 480 because the drive team wanted a bigger image. The very next match the robot essentially died 30 seconds into the match. (I ended up reducing resolution back down to 320 x 240 but displayed in a upscaled window.) That was with just one camera -- but may have been with an FMS that had even less bandwidth than the 7mbps offered now.

But our team also wanted two cameras last year, so I implemented code to switch between cameras feeds. This invovled running both feeds throught the roboRIO, with a joystick button to swap (both cameras were USB). That worked well -- switch time was practically instantaneous, and we didn't run into any bandwidth issues. In fact, I cranked the bandwidth to something like 800 x 480. (We had high quality webcams with good compression.) Note -- we use C++, so I'm afraid I don't have any Labview code to share.

This year we intend to do target recognition on one feed, but with the option of sending that feed back to the driver station, with the target marked in the image (haven't gotten that done yet).

0 Kudos
Message 5 of 8

Hey cbf,

Would it be possible for you to share your code or post a link on GitHub to it?

We're basically trying to do the same thing that you did (switching between two cameras with a joystick button), but we're having some issues, since just starting another stream doesn't switch the camera.

Our main problem is just switching video streams, so if you could give us a few pointers (no pun intended) then that would be great!


0 Kudos
Message 6 of 8

It’s easiest to use our implementation from last’s year’s program:

This year’s version is more complicated and not finished yet. This year we also essentially replaced the entire WPILib CameraServer class because of a serious bug (that's been there for the past two years at least) that often causes the initial connection to fail.

Message 7 of 8

Yay, thank you so much!!!

0 Kudos
Message 8 of 8