Arfur is a set of bindings and a framework that builds on top of the WPILib suite, enabling Rust-based robot programs in FRC.
use arfur::prelude::*;
fn main() -> Result<()> {
let robot: Robot = RobotBuilder::default().initialize()?;
// Having a `Robot` type is proof that the HAL has been initialized. We can
// use to construct all kinds of handles!
Ok(())
}
-
Rust bindings to WPILib: Arfur is a set of bindings, not a reimplementation, meaning you can expect the reliability of the official WPILib C++ implementation.
-
Type safety at its finest: The public API is idiomatically Rust, meaning you have type-level gaurantees that undefined behaviour will not and cannot occur.
-
An efficient robot: Keep the runtime speed provided by C++. Arfur is low- to zero- overhead.
-
A powerful ecosystem: Hook into Rust's ecosystem for logging, mathematical computations, and more!
What do you need to get started?
- Rust
- MSRV:
1.72.0
- Toolchain:
stable
- MSRV:
- ARM Compiler Toolchain: Since you're building to the RoboRIO, which uses
a different architecture than most personal computers, you'll need a
toolchain that can build to ARM.
- Option 1: install a generic ARM toolchain.
- Option 2: install the
FRC ARM toolchain.
- MSRV:
2023-9
- MSRV:
- Don't forget to point Arfur to your toolchain executable.
- (optional) Nix: Use Nix to ditch both requirements
mentioned above.
- Your choice of Rust installation method.
- Use the Nix derivation in
./nix
to grab the FRC ARM toolchain.
Arfur is still highly in development. Do not consider this project stable by any means.
A complete guide is, unfortunately, still in the works. For now, sift through the crate's examples and documentation. There's more to come!
So, you want to help out with this project? We'd love to chat about the project, just open an issue or make a PR.
Due to the inherently complex nature of generate bindings for large projects,
Arfur uses xtask
to manage the project. After getting access to the source
code (presumably via cloning the git repository), run:
cargo xtask bindgen
This will generate the bindings as necessary. Then, run:
cargo b --example raw_usage --target arm-unknown-linux-gnueabi
To build an example.