Hello. I am trying to write a program (specifically using the wpilib simulation capabilities, if that helps) that requires including files from the allwpilib github repository. I believe I have all the prerequisites (correct Java & GCC versions, etc), but I am unclear on exactly what “clone the WPILib directory” entails.
If I clone the allwpilib repository into my src/main/include folder, Robot.h can successfully include allwpilib files. However, the allwpilib files’ include paths don’t work because the local build.gradle files don’t include the project level directories the include files are located in.
Am I supposed to just go in and update all the source directories in the build.gradle files and/or change all the include paths so that the files can see each other? Or is there a more elegant solution I’m supposed to employ? I think team 971 has figured it out, but it seems like they haven’t altered their build.gradle files or include paths so I don’t know what they’ve done.
Here is a link to 971’s github code. They have their allwpilib folder in a third party folder, and how (if?) they include this folder to their main robot projects isn’t obvious. It also looks like they have a custom build setup that I’m not familiar with, but maybe that’s how they’re making it work.
For my installation of WPILib, some of the files in allwpilib are not configured as a dependency. So I am able to include some WPILib files but not others.
If I look into where my files are actually stored, some of the files from allwpilib are really not there. I have tried re-installing and updating WPILib, and I have the latest released version (2021.3.1), but some of the allwpilib files don’t seem to be included.
Just now I re-downloaded the WPILib source code zip file, and some of the allwpilib files (like MechanismLigament2d.h) aren’t included there either. Am I downloading from the wrong place or something? I got my installation from the github release as directed by the installation guide.
I think you are trying to use code which is newer that the 2021 release. If I read it correctly, MechanismLigament2d was created only 7 months ago, so would be part of the 2022 release (which is in beta).
Try grabbing the very latest version and see if that works.
Like @prensing said, you’re trying to include files that were added after the 2021.3.1 release. If you’re participating in the open beta, then you should have access to the 2022 beta release via TeamForge etc. If not, the release is public on GitHub but you won’t be able to run it on a RIO (because the required image isn’t publicly available yet).