Closed chauser closed 10 months ago
Duplicate of #1549; the real fix that is needed is #5135.
I think the real fix is actually #5055, not 5135? I am closing this issue. If anyone else runs into this, a workaround is:
MjpegServer server = CameraServer.addServer("First Camera");
UsbCamera cam = new UsbCamera("First Camera", 0);
server.setSource(cam);
That is, explicitly create the server before creating the camera.
Describe the bug If I start a camera server with
there is no camera listed under the
CameraPublisher
key in NetworkTables -- indeed there is noCameraPublisher
key at all.To Reproduce Start a camera server as part of a robot program with the code above. Connect to port 1181 and observe that the camera is working. Observe in Glass or OutlineViewer that there is no
CameraPublisher
key or camera-specific key for the camera.Expected behavior There should be an entry for the camera below the
CameraPublisher
key.Environment:
Additional context My goal with starting the camera this way was to be able to configure both the camera
VideoMode
settings and the stream default settings. The only obvious way to get your hands on theMjpegServer
object where the stream default parameters can be configured is by using thestartAutomaticCapture
overload that has a VideoSource parameter and returns anMjpegServer
.While writing this issue report I figured out another possible way to gain access to the
MjpegServer
object:but this approach as well leads to no
CameraPublisher
NT entry although there is a server running on port 1181 and if I change the camera VideoMode setting and the stream default settings with calls on theUsbCamera
andMjpegServer
objects the displayed video behaves as expected.The problem posed by this is that there seems to be no way to set the default stream parameters -- which is potentially a convenient way to ensure consistent video stream behavior across different dashboard instances.