WPILibPi Romi: Networking Table & Camera Server Issues

Having issues using both Network Tables and Camera Server and wondering if anyone has gotten it to work on the Romi or if support for it is still work in progress. I saw some talk on WPILib on a PI + Romi? - Programming - Chief Delphi about using cameras but figured I would create a separate topic for things people are doing to expand the Romi from the basics (onboard DIO, drivetrain, encoders, gyro) to more advance integration with the rpi.

Network Tables: My initial thought around using network tables is to use it as a way to communicate sensor information for misc sensors and CV2 vision programs (seems like the best way since the RPI gpio outputs are 3.3v and Romi inputs are 5v, same issue as with the Roborio).

I’m getting an error when using the default vision application Built-in multi-camera streaming and can see multiple attempts to connect to the network tables port with this error:

NT: ERROR: select() to 10.0.0.2 port 1735 error 111 - Connection refused (TCPConnector.cpp:175)

I have tried changing the ipv4 address and team numbers to match (10.0.0.2 with team number 0 and 10.72.72.2 with team number 7272) but that results in the same. I can see the error message change

Camera Server: I am trying to start with a basic camera server and have it show in the smart dashboard. Usually this only requires one line of code to call startAutomaticCapture. I have tried a few ways and can’t get the camera feed to carry through from the rpi to the robot + smart dashboard.

CameraServer.getInstance().startAutomaticCapture(); //Should not work because the default name is "USB Camera 0"
CameraServer.getInstance().startAutomaticCapture("rPi Camera ", 0); //Use name that matches the output when starting the vision service
CameraServer.getInstance().startAutomaticCapture("rPi Camera 0", "/dev/video0"); //try using the name and video device path

All of these result in a camera instance created in the network tables & smart dashboard. But with a black screen. I can see the camera is working on the rpi at http://wpilibpi.local:1181/ but the camera stream listed within the network table settings has a black image.

I assume that the issues are related to some networking or communication issue or some step missing.

The Romi setup for this is a bit different than a normal FRC robot, primarily because the Romi code is running on the desktop, not the Raspberry Pi. This means that any CameraServer code you add to your robot program is going to pick up the USB cameras connected to your desktop computer, and not USB cameras on the Romi itself.

The 2021.2.1 Romi image fixes the default multi-camera streaming to “just work” in the Romi use case. The key is that the vision code running on the rPi needs to connect to the NetworkTables server (the robot program), which in the Romi case is running on your desktop computer. The 2021.2.1 image adds a way for the multi-camera server to discover what the desktop computer IP address is. You don’t need to add anything to your robot program.

3 Likes

Nice! Upgrading to 2021.2.1 solved my issue. I was on 2021.1.1 before. I confirmed that the camera configured on wpilibpi.local is now showing in the smart dashboard. Noted about writing any camera server code, which will connect to cameras on the computer running the simulation software and not what is connected to the romi.

I have also uploaded Romi Vision as the vision program and looks like the network tables issue is resolved, too. I am seeing a 2nd processed video feed from the program and also the network table with the target data.

Thanks for fixing this for us!
Michael