USB Camera Solution

After many hours of trial and error we managed to get the USB camera to work while running the Smart Dashboard (Java). All you need to do is create a new project example for Intermediate Vision and delete lines 39, 44, & 45 (just draws a circle on the viewer of the camera). You will have some unused imports so removed those and then just make sure you have created the object in Smart Dashboard and you will be set.

how do i create the object for the dashboard? where do i place the line of code?

You add the USB Camera widget in the dropdown in the smart dashboard program.

You can pretty much put the code from the example robot into the class. Just pay attention to where each part is location in such as robotInit and what not. There are other ways you can add the code for different results but that is up to the individual teams.

When you say USB Camera Solution, where do you plug the camera into? The NiRIO?
Also, I have tried using the smart dashboard before without any success (I rage quit), can you give us the line of code required to do this?


I am referring to plugging the camera into the roboRIO. And like I said previously, just create the intermediate vision example project and delete the lines of code I listed in the root post.

Just figured out what you meant my the intermediate image project. thx. I’ll give it a a go.

This seems to be working for us! We’re using the command-based robot code, so it took a little bit of rejigging to use it.

We’re running the image grabbing in Teleop Periodic and only every tenth call. Otherwise we had issues with not sending CAN commands to the Talons often enough. The frame rate of the camera is extremely low because of this. Anyone have any ideas on improving performance?

I noticed the frame rate issue as well. I know FIRST regulates the amount of data you can send so it may not be possible to improve it.

we just got some ms lifecam hd-3000 cameras and we’re getting an exception thrown from the vision code with no camera output. i’m using the intermediate vision example with the lines indicated in a previous post deleted. the exception is:

Unhandled exception: VisionException [ IMAQdxError: -1074360311: Camera not found] at [ Method),, org.usfirst.frc.team4905.robot.Robot.robotInit(, edu.wpi.first.wpilibj.SampleRobot.startCompetition(, edu.wpi.first.wpilibj.RobotBase.main(]

does anyone have any suggestions for fixing this?? i’m using the latest eclipse plugin’s from wpi.

also i verified that the webcamera is working by plugging it into my laptop and viewing it.


Does the name of the camera that shows up on the roborio web interface match the one that is being supplied in the code? The name of the camera in the code is “cam0”, but it may be something else. To find the name of the camera go to “roborio-xxxx.local/” in a web browser where the x is your team numbers, which would be “roborio-4905.local/” for you.

because the CameraServer is throwing an exception when it’s trying to create the instance there is no “Cam0” or anything else. i had another webcam “sortof” working a few weeks ago, at least it did not throw this exception just a different problem when it tried to stream. i was reasonably sure the problem was no support for that camera. so we bought the “supported” webcam and now i get this exception. my guess is that the latest update to the firmware for the roborio has broken the webcam ability. unless someone else has it working on the newest wpi plugins??