Setting up camera for Java teams

We can’t seem to get the camera to show up in the dashboard at all. We do not have code for the camera written, is that the problem? How would we set up the simple CameraServer program for the bot?

Yes, you will need to add some code to your robot program to get a camera hosted on the roborio.

Last year, we put this code in our robotInit and it worked:

		UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
		camera.setResolution(640, 480);
	} catch(Exception e){
		System.err.println("Unable to start camera server.");

There are probably many different ways to set up the camera, but for our team, this one seemed the simplest. Also keep in mind that if you set up the camera that way, there will be a ton of latency. My team is going to look into hosting the camera server on something other than the roborio to see if that helps with latency. I don’t have any experience with that yet, though.

1 Like

Oh my gosh! Thank you so much! Your a lifesaver!