RPi Vision Processing/Streaming - Anyone Successful?


I am posting this for my programmer who seems to be hesitant to ask for help! lol

We have the latest RPi image and have been streaming data to our laptop in the lab. However, when we got to our first event, everything failed. Is anyone out there been successful getting their cameras to work with a RPi and FMS?

We had streaming feeds a month before this event in our lab on last year’s robot. So, I am really concerned with what is going on. First’s tech support at the event could not figure this out either so I am hoping that someone has this working. In our lab test, we had two streaming cameras and full scale opencv processing. Now we have NOTHING :frowning:

We are using Java…for what that is worth.



I’ve been using a raspberry pi coprocessor for camera stream. It has worked like a charm.



We saw some issue at the event since we were USB tethered. The video needs an ethernet connection to stream between the raspberry pi and the drive station. We were able to see the camera names, but no video since that was coming over usb via the roborio.

This was only an issue in the pits - since you would have ethernet on the field. To solve this in the pits we added a switch so we could run everything over ethernet and left the USB tether out.

What method are you using to launch the script at startup?
We have had some success with the following method (made sure not to forget the “&”)



Another thing is that I needed to use the practice fields radios to configure the server because if you are tethered, you are only connected to the roborio and not the raspberry pi.



The CSA there showed us that some teams leave the additional 5 port switch on the robot for practice field also. This let us use a 100 foot ethernet cable as the tether and connect to both PI and Roborio.



We used a Raspberry Pi to stream 3 usb cameras at our week 3 event last weekend, and it worked like a charm after we set the static IP (oops). At our week 4 event we will have vision processing code running on several streams as well.



what switches are you guys using and how are you powering them?



I had a netgear unmanaged switch ($20-$30) which worked okay. My particular switch uses 12V, so can power from VRM directly or using a usb charger and 5V to 12V converter. You can cut the power cable that comes with it to get access or buy a dedicated connector. Check the charger that comes with your switch or the label on the switch before plugging it in to verify what voltage it expects.

We also assigned the raspberry pi a static IP using this method. I gave it 10.xx.xx.14 I picked .14 since 3.14.

Just guessing, but your setup might look like this
interface eth0
static ip_address=
static routers=
static domain_name_servers=

1 Like


I’d recommend setting a static IP for the Pi, to at least take mDNS/DHCP issues out of the equation. If you can connect to the Pi off the field, there’s an option in the web dashboard to do that.



You probably need to be more specific on exactly what you’re trying to do. Are you using a standard RPi image and video/vision software, or custom? One possible explanation for things failing under FMS that work in practice is use of ports not legal for competition.

Another thing you can try is rearranging the network wiring on the robot. The rules require the RR be connected to a particular radio port, but it can be either directly or via a switch. A common arrangement is to connect the RR directly and use the other radio port to connect a switch for cameras, and coprocessors. While people who should know say this arrangement is fully supported and entirely equivalent, others say it may have issues if there is significant traffic between the two ports (Dropped packets between ports on radio). For us moving everything to the switch and attaching it to the main radio port, leaving the other unused, seemed to work better. CSAs warn against this arrangement, since if your switch goes out, you’re entirely disconnected instead of just losing your video.

To the title question, our custom rig worked well through one regional, with another to come.



We had everything working fine with an RPi and static IPs, but only sporadically worked at our first event.

I’ve heard (unconfirmed rumor) that 80% of bandwidth goes to the RoboRios on the field, leaving only 20% for everything else. Rebooting in the waiting area seemed to help get priority on that 20%. Our two cameras were outputting at 1 Mbps or less, so we should have been fine.

Moved to plugging both into the Rio directly to ensure video feed, even if MJPEG.



We’ve had success streaming video from a Pi, but there was some magic involved. Some notes:

  • We have a simple switch between the radio and the Pi (and the DS when we tether.) If you trace the “wire”, it goes Pi/DS -> Switch -> Radio -> roboRIO (the Pi and the RIO do not communicate much but are capable of doing so.) We couldn’t get the Pi talking behind the FMS without the switch. :man_shrugging:t2:
  • We’re not using the FRCVision image, instead opting for our custom software. (Shameless plug.)
  • We have a static IP to prevent the Pi from somehow losing the address it takes from DHCP. We also couldn’t get mDNS working, even with avahi installed on the Pi and Bonjour on the DS.


Out of curiosity (because we had troubles), did you get it to work without the switch but over WiFi in your shop?

I am trying to reproduce problems we had on the field, and am not having success (break, will you!!).



Yes. At home with a radio imaged with configuration version 19.1.1 we were able to plug our Pi straight into the radio and for the most part everything worked OK.



We were trying to edit the config file last night to make these specific changes…only to get “cannot write to a system file” or something like that.

We are working on getting a switch setup on last year’s bot now so we can do some more testing.



One thing we learned at competition this weekend is the Pi cannot be powered properly from the RoboRio’s USB port, it must be powered independently.

1 Like


we used the RPi for processing/streaming, but we had problems with it taking too long to boot up, which lead to us not having vision till about halfway through the sandstorm period. We will likely be powering it independently at our comp this weekend



Setting a static IP on the pi can help it come online quicker in some cases. Worth a shot if you can test during practice matches on the field.



im not our coding guy, so how would one do that?



Open the dashboard in a web browser and there is a network section you can do that https://wpilib.screenstepslive.com/s/currentCS/m/85074/l/1027798-the-raspberry-pi-frc-console