ELP Wide Angle Camera Help

Our software team have been trying to get our ELP Wide Angle Camera to work.

Here are some of the things they have tried
1.
usbCamera cam0;
cam0 = CameraServer.getInstance().startAutomaticCapture(0);

usbCamera cam0;
CameraServer.getInstance().startAutomaticCapture(0);
this is basically the same thing but a little different

  1. These lines of code were sometimes accompanied by other lines but those don’t do anything to make the camera work, they just set resolution, fps, etc. this includes what you sent me and told me to try

  2. Some other minor things were changed but they were things like instead of saying 0 it’d say cam0 or stuff like that, we also commented out some stuff to see if it would work

  3. I messed with the different dashboards because one site said to go to the default dashboard and make it work there first and then go into shuffleboard

If any teams have experienced this before and know if there are any drivers or other lines of code we should try please let me know as we seem to be stuck.

did you try to connect to the webDashboard to verify if the camera is recognized by the roborio ?

Is this camera plugged in directly to the roboRIO’s USB ports? The only thing you really need is CameraServer.getInstance().startAutomaticCapture(0); within the roboInit() function like so:


public void robotInit() {
	oi = new OI();
	CameraServer.getInstance().startAutomaticCapture(0);
}

Preferably, this should be within a try{} catch() {} statement, as if the camera is not detected, then the rest of your code won’t run.


public void robotInit() {
	oi = new OI();
	try{
		CameraServer.getInstance().startAutomaticCapture(0);
	} catch (Exception e){
		// How do you want to handle this error
	}
}

You can also first check to see if you can use the camera through a normal computer to check if it is functioning properly. You could also check the camera’s cable to ensure that the wires aren’t damaged/cut, as that could be an issue.

EDIT: Depending on the dashboard, the camera might not appear immedately. For the LabVIEW dashboard, you select the camera through a small drop-down menu in the bottom-left. For SmartDashboard, you have to add the camera to the dashboard. Same thing with Shuffleboard.

We connected the camera to a pc and verified it works. It shows up on the webDashboard too.

We are using Java and Shuffleboard.

I am not familiar with that camera. Do you know from your (or anyone’s) experience that this particular is known to work on the roboRIO? If not, can you plug a known compatible USB camera (e.g., LifeCam HD-3000) into the roboRIO and confirm that it works ok? Borrow one from a nearby team if necessary.

Also, there is the possibility that the roboRIO is not locating it as device 0. Can you instead use “CameraServer.getInstance().startAutomaticCapture()”. I.e., without the zero? I haven’t studied the WPILib source, but am guessing that it tries multiple device IDs. The no argument implementation works for C++ and I expect that it should also work for Java. Our team has been using the LifeCam on a Raspberry PI. At least 9 times out of 10, it is assigned the device ID value 0. But every once in a while when plugged in it gets assigned the value 1 even without another video source already connected.

While it helps to know that the camera is not defective, just because it works on a PC does not mean that it will work on a roboRIO. The PC may have drivers that are not installed on the roboRIO.

We use these and of the four that we have 2 work on the roborio and all of them work plugged into the raspberry pi, computer, or limelight. We’re not quite sure what makes one not work with the Roborio (had the same issue last year)

Sent from my iPad using Tapatalk

Oh I know, try changing the pixel format:


UsbCamera test= CameraServer.getInstance().startAutomaticCapture();
test.setPixelFormat(PixelFormat.kYUYV);

Swap between the various pixel formats under PixelFormat until you get one that works.

After adding CameraServer.getInstance().startAutomaticCapture(); to your code, try connecting to http://roborio-TEAM-frc.local:1181/ (where TEAM is your team number). Does it show a video feed? What video modes are listed?

I believe I have located the driver for onboard compression that may be why it isn’t working. I looked around on https://wpilib.screenstepslive.com and chief and can seem to find how to install a third-party driver on the roborio. Is that possible?

I just tried the camera and it works for me out of the box when plugged into USB and going directly to the http://roborio-TEAM-frc.local:1181/ webpage (with just the StartAutomaticCapture() line).