How to use switched camera with built in camera streaming?

Hello! I’m trying to use the new switchedcamera feature with the built in camera streaming in the pi vision software but I’m not sure how to actually use it in the roborio java code. Is there any example code? Has any team got it to work?

1 Like

I have tried that but it doesn’t show anything (gray screen with no message) in the DriverStation.
Here is the main code in
cameraSelect1 = NetworkTableInstance.getDefault().getEntry("/PairZero");
cameraSelect2 = NetworkTableInstance.getDefault().getEntry("/PairOne");

Here is when I try to switch the cameras in a command:

And still nothing happens. I’m pretty sure I’m using it wrong…

If you’re using strings, don’t use the path, use the name of the camera in the webdash (eg “Pi Camera 1” etc). Or use indexes (0, 1, etc). I also recommend using setDouble() or setString() instead of setValue().

1 Like

A working python example can be found at … just translate it to Java (or use python).

Thanks, this worked!

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