Programming Vision Code Off Board (Raspberry Pi 3)

After hours of testing, I’ve came to the realization that switching between 2 cameras to process vision on using just a roboRio is too slow. I’ve ordered a Raspberry Pi, my only question is, how is the code run. I searched around chief delphi and couldn’t find anything relative to this.

Is it as simple as writing the program off board, compiling a jar, and then running a python script on the Pi to run the jar on startup? Or do I need to download libraries on the Pi, and write the code directly on it.

Also, wouldn’t there be a reasonable amount of latency with outputting variables via NetworkTables on the pi, and using them on the roboRio, or is that the way to go?

Thanks in advance!

Start here:

It gives you the basic overview of how to utilize gradle to build an easy Java program to run on the pi. After looking through that and getting the example project setup, throw your GripPipeline or whatever processing classes you have into the src folder, call them from main, and run your processing and NetworkTables output from the while loop in the main class.

Once you have that setup, you’ll build the project and send the output .zip to your pi. Extract it there, and then make a simple BASH script to get it running on startup. This helped:

Now, in regards to the NetworkTables latency, I haven’t quite been able to test it, but according to the WPILib people the system has been updated to refresh at 10ms rather than 100ms. Obviously there is still the processing time and such, but when I used the GRIP benchmarking utility, it was maybe only a few extra milliseconds to process everything. The general rule seems to be 25ms or less to do PID or control loop related processing, so NT should work.

Thanks for the reply, this is very useful!

About the provided build…

Is this necessary? Could I just write the code, compile the jar, and use the start script on the pi to run it.

If gradle is required and you have to build using what they provide, how is this done? The src folder that they provide does not point to any artifacts such as CamaraServer or NetworkTables. How would I get it to point to that, also how is the jar built?


The ScreebSteps page goes into detail on getting your camera to work. The basic network tables implementation is there, it’s just a matter of creating variables to send via NT. I recommend going through the steps shown on that page, and then coming back with any questions.

I understand how to feed variables back to the roboRio, my issue is actually getting a jar file to run on raspberry pi. I’ve become very frustrated trying to build the jar. If I run the gradle.bat file on windows, it opens for a second then just closes. If I try to run it on the raspberry pi with ./gradle build, I just get permission denied.