Robotpy's networkTables to turn on the camera doesn't work

Hello, everyone. I started to learn camera and vision in the last few days and our team wants to turn on the camera in custom code. In the robotpy documentation is described that to start the camera streaming is need using the command on terminal: python3 -m score file_vision.py
Until that part, I managed to understand, but when I use this command with network tables turned on code to localhost (127.0.0.1), because I don’t have the robot at this moment, it appears here:

It can’t connect to the camera. The network tables is printing this error but I didn’t find a solution for this error.
I’m using Arch Linux because I can’t install robotpy-cscore on Windows.
I’m using this code from pynetworktables example (I didn’t modify it much, just I added networktables.initialize): robotpy-cscore/intermediate_cameraserver.py at main · robotpy/robotpy-cscore · GitHub

The usual reason for this error is the camera doesn’t support the requested video mode, and is ending up in a non-JPEG mode; there’s probably an error about this right when the program starts. What does v4l2-ctl --list-formats-ext -d 0 print on your system?

1 Like

the terminal prints:

That confirms it. You’ll need to set the video mode to YUYV; instead of calling setResolution(), call setVideoMode(), the first parameter should be something like VideoMode.kYUYV, then it should be width, height, fps (e.g. 640, 480, 30).

1 Like