Team 2022 - Vision Processing on Driver Station, Cannot get Video Stream

I’m trying to do Vision Processing using a usb camera stream from the Roborio.

On the Rio I make the stream with
UsbCamera c = CameraServer.getInstance().startAutomaticCapture();
VideoSink s = CameraServer.getInstance().getServer();
s.setSource©;

And this makes the stream show up in Shuffleboard

On the driver station, I try doing this
CameraServer inst = CameraServer.getInstance();
VideoSink vs = inst.getServer();
vs.getSource();

When I try to run it, it shows the source as not connected.

How do I do I get the Camera stream for processing?

If I understand you correctly, you have a desktop program running on the DS? Unlike NetworkTables, CameraServer doesn’t synchronize camera info directly in that way. You will need to get the streams key from the camera info in NetworkTables and call CameraServer.addHttpCamera to create a corresponding source.

This has been done before. You may be able to find some examples. Ill look as well however I have heard from teams in the past that you induce a great amount of delay or latency in the Vision Processing. Because unlike the other teams doing it directly on the robot. You must wait for the Camera to process the frame, send it to the DS, the DS to process and calculate the Tracking and send it back to the robot. So in the end you may not have quick Camera Tracking. It has been done before so it is a fair option however I wanted to let you know if its potential downfalls.

Here is a thread I found on the topic: https://www.reddit.com/r/FRC/comments/2jhal4/using_the_driver_station_for_vision_processing/

And here is an example from what a team did in the past:

addHttpCamera isn’t defined in [edu.wpi.first.cameraserver] are you talking about a different library?

You’re right, you need to do CameraServer.getInstance().startAutomaticCapture(new HttpCamera("mycamera", "http://10.x.y.11/mjpg/video.mjpg")); or use addAxisCamera.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.