Rust for FRC Robots w/o WPILib

I want to run Rust on my team’s robot without using WPILib. I’m fairly new to FRC, but am very comfortable with Rust, programming, and Linux. I was hoping I could get some advice from a WPILib dev on how to go about this.
I’m particularly interested in how to interface with the roboRIO: I can’t find a library or decent documentation on how to do so. As I understand it, the roboRIO is a Linux box with a collection of libraries on it. Where should I get said libraries for development use? I’m on Gentoo, so Ubuntu packages are out of the question.

Okay so yes you can but not recommended to go fully without WPILib and you’ll be relying on bindgen a lot for c++ libs

You might want to check out this unofficial library… the last release was ~4 years ago but there’s more recent commit history than that.

The roboRIO runs a NI-customized installation of Linux with additional FRC-specific libraries installed. The FRC-specific library headers can be found here: GitHub - wpilibsuite/ni-libraries: Houses the NI Libraries for WPILib building, and the main image libraries can be downloaded separately from their package repository here: https://download.ni.com/#ni-linux-rt/feeds/academic/2023/arm/

Also, WPILib builds a cross-compiler toolchain to Rio that can be found here: GitHub - wpilibsuite/opensdk

Note it’s likely a lot easier to wrap WPILib’s HAL (Hardware Abstraction Layer) than use the NI FRC libraries directly. The HAL is a C API, while some of the NI FRC libraries are C++ (namely the FPGA interfaces).

7 Likes

Thanks!

1 Like

This is the way.

5 Likes

Echoing this. There is a lot of work in the HAL you do not want to duplicate.

I was able to find a slightly newer library that wasn’t a direct port when I looked a few weeks back. I’ll try find it and post it here.

Edit: GitHub - arfur-rs/arfur: Rust + FRC = safe + composable + expressive

2 Likes

You should be using WPILib, there’s a lot of work that goes into the low level HAL stuff that by the time you recreate it or get some unofficial library you could just learn java or C++

1 Like

Thanks! Hadn’t seen this, but will try it out.
Edit: They have Rev drivers! This is great!

I know, I’m not doing it to avoid learning a new language. I want to do it because I’ll learn a lot more about how FRC robots work.
As a few others have suggested, I will definitely use the WPILib HAL if I make my own library.

3 Likes

As a note, it appears they’re still building for 2022. You’ll probably have to fix that on your own

Creator of Arfur here. Yeah, we’re working on some higher-level robotics stuff before getting back to updating the WPILib bindings. The problem is that once the 2023 API was stabilized, WPILib releases a pre-release for 2024 :). So it’s hard to decide which bindings to use. We’ll probably just update straight to v2024-prerelease and just skip a step. This is all experimental, anyways.

Any help would really be appreciated, we’re a low-staff team. If anyone wants to help, I would love to help explain the codebase so we can work on updates and features.

Let me know if you have any questions.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.