Although the project has only ever been developed on Windows, cross platform support should be possible using VSCode (which is cross-platform) and cross-comipler builds from the wpilib raspbian-toolchain repository; both having downloads for Windows, MacOS and Linux. Simply follow the steps below to setup the required tools in order to build both VisionServer itself and programs that utilize it (for RPI).
Visual Studio Code Extensions
, but can be installed manually by clicking on the extensions tab (the side bar) in VSC, and then searching for C/C++ Extension Pack
. (this one)C:\Program Files
on Windows), or just leave it in your downloads folder. In either case, take note of the location as this path will be needed later.C:\Users\Public\wpilib\YEAR\roborio\bin
and titled frcYEAR-make.exe
. This should work the same as the one from the repo, although you might want to copy and rename it.(location from first bullet point)/Raspbian10-Windows64-Toolchain-8.3.0/raspbian10/bin
(or a similar structure for difference versions and platforms) and should contain quite a few executables.As an example, my PATH looks like this, with the highlighted entry being the bin folder and my location folder being D:\Programs
.
make
in the command line in the project directory (try it to test that everything is working), but additional configuration needs to be done to setup a VSCode workflow.Open the project in VSCode. In order for syntax highlighting and intellisense to function, the file (project root)/.vscode/c_cpp_properties.json
needs to be updated with the location of your cross-compiler, the correct "intelliSenseMode", STL version, include paths, and predefined macros. By default, the file should contain 4 separeate configurations, the first one being the default configuration (commented out) and the other 3 being machines that I use. Copy one of the configuration objects (they start and end with '{' and '}') and paste it anywhere within the "configurations" : [ (here) ]
block (you can now delete all the others). Now edit each variable like specified below. Please note that the format of this file could change with VSCode updates in the future, so the exact entry names may change. Refer to this for updated info on formatting.
"name"
variable to something that represents your machine and other settings in the configuration (ex. CC-ARM-{COMPUTER NAME})."includePath"
. If you add anything, make sure to update the makefile accordingly so that the folders are actually included during a compile (see the [makefile walkthrough]() for more info). It is recommended to leave the preexisting values (as shown below) untouched as they reflect the default includes of the makefile (crucial to the build). "defines"
."compilerPath"
should be the full path to g++, which is inside the "bin" folder which was added to path in the previous steps. Simply go to the folder and copy the path, then append the executable name to the end (something like arm-raspbian10-linux-gnueabihf-g++.exe
)."cStandard"
and "cppStandard"
alone unless you know for sure that a different version is being used (newer cross-compiler build)."intelliSenseMode"
is set to "linux-gcc-arm"
or the equivelant if the preset names change due to an update.Now the file should look something like this: ``` { "configurations": [ { "name": YOUR CONFIGURATION NAME, "includePath": [ "${workspaceFolder}/**", "${workspaceFolder}/include", "${workspaceFolder}/references", OTHER INCLUDE LOCATIONS... ], "defines": [ "UNICODE", "_UNICODE", "__linux__", "__unix__", OTHER DEFINES... ], "compilerPath": "PATH TO YOUR CROSS COMPILER/Raspbian10-Windows64-Toolchain-8.3.0\\raspbian10\\bin\\arm-raspbian10-linux-gnueabihf-g++.exe", "cStandard": c17, "cppStandard": c++17, "intelliSenseMode": "linux-gcc-arm" } ] } ```
After everything is edited, save the file and make sure VSCode is using the correct configuration. Open a C/C++ file and check to see that the text in the bottom-right corner matches the name specified in the configuration like shown below.
After that, everything should be good to go! You can use Ctrl + Shift + b
to start a build task, which by default calls ./make
in a terminal instance. To change build tasks, you can edit (project root)/.vscode/tasks.json
.
Note that there are included project files for Visual Studio (not VSCode), although the integrated build system is messed up. If you would like to develop the project with Visual Studio, you will have to configure the project properties for your cross-compiler path (for syntax highlighting) and build using the terminal.
For info on running the program or building natively on a rpi, see the [raspberry pi documentation]().