Before reading this guide, make sure to familiarize yourself with WPILibPi using its own docs.
WPILibPi comes preinstalled with WPILib, OpenCV, and Pigpio, but not with Tensorflow Lite (only the python version is present, not C++) or the Edge TPU driver - these will have to be uploaded manually. Both files (libtensorflowlite.so and libedgetpu.so) are copied to the output directory during each VS build, and can be found there for uploading on the Pi using the web dashboard (these are treated as "supplementary files" in step 2 below). Uploading these should be a one-time process, but will need to be repeated when newer versions of WPILibPi are released, and this repo is updated with newer versions of TfLite and the EdgeTPU driver.
Application
tab. Make sure to toggle the Pi into Writable
mode using the button at the top of the page.Uploaded C++ executable
from the dropdown, then select the binary from the output directory and upload it.Upload other files
and select the required files. Note that in the case of the shared library, the old version within the Pi's filesystem will simply be replaced with the newer version provided that they are named the same.Read-Only
mode before proceeding.Vision Status
tab and select the Up
option to start the program. Additionally make sure to enable console output, which is oftentimes crucial for debugging.sudo ./uploaded
(from ~/ or /home/pi/ directory) to run the program. This can be helpful when more reliable terminal output is needed (sometimes the dashboard can misformat and skip some lines).For some reason uploaded executables may require sudo permissions to work properly, and without can sometimes fail to output streams and simply not work correctly. By default, WPILibPi runs uploaded executables without sudo, but this can be changed with a few modifications.
Writable
mode.sudo nano /etc/service/camera/run
to begin editing this file.exec pgrphack /usr/local/bin/setuidgids pi ./runCamera
to exec pgrphack ./runCamera
.Ctrl + S
to save, then Ctrl + X
to exit.Read-Only
and run the program through the dashboard - it should work normally.Using and connecting to the Pi directly may seem fluid and stable, but there are a whole host of issues that can arrise during robot deployment. This can include anything from short stutters/freezing video streams, to unresponsive connections and a complete inability to connect.
Client
mode when connected to a robot (changed in the Network Settings
tab). This can be a very difficult issue to diagnose due to the fact that sometimes NetworkTables will work correctly and other times it will not. Additionally, this can be quite common if server mode is used for testing the Pi while not operating on a robot.