First Rust Competition
First Rust Competition is a fairly complete port of FRC’s WPILib to the Rust programming language.
Check out the project on GitHub.
Why you should consider using Rust in FRC
- Feature-complete replacement for WPILib, sans anything NetworkTables-related
- Cargo-integrated deployment tool with toml configuration
- No fluff
- No heap allocation
- No object vtables; write your own traits if you need to
- No slow default LiveWindow or NetworkTables integration
- No wrapping your main
- No official editor or plugin necessary
- Minimal setup: simply install an ARM-compatible linker, update one config file, and use the provided quickstart
Cargo.toml. Full instructions in the README.
- Full access to react to and handle HAL errors. They will no longer just silently propagate to your driver station.
The Rest of the FRC ecosystem
I try to keep an updated list of FRC rust libraries in the GitHub README. As Team 114 fully switched to rust in 2019, I’ve implemented or contributed to libraries for all of the hardware we regularly use.
A fantastic library by auscompgeek.
I maintain a fork that’s slightly more feature complete and easier to use.
The main change I made was integrating more fully with
bindgen to make updating the
Pheonix_CCI version take less than a week.
A NavX driver that currently only supports SPI (RIO MXP port or SPI cable), but could easily be extended to all protocols. Here is the code.
The Project’s Future
There is still a decent amount of work to be done. All of the methods work identically to their WPILibC counterparts, but the documentation should still be ported for convenience. As of writing this,
I still need to update setup instructions and quickstart have been updated for 2019.
quickstart.zip and the setup instructions for 2019
Team 114 is planning to expand our use of Rust in 2020. Every programmer I exposed to Rust was happy with the language, and I have the Rust Team’s commitment to teaching and documentation to thank for that. After that, hopefully either the community or another 114 programmer can take up the project.
The WPILib team deserves a ton of credit for making their library very easy to port the other languages. Even as I was creating First Rust Competition, it became easier as the team made the HAL headers fully C-compatible, resolving my need for my own fork. Undertaking a project like this is a great way to learn about FFIs/Linkers/etc.
KyleStach (1678 Alum) and some others got to the idea first, and I shamelessly stole his initial implementation for a few files.