Skip to content

echap1/fast-unit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Unit - Rust Unit Management for Python

Originally created as a faster version of Unum for use in Python-based FRC robot code.

Building and Installing for Local Machine

maturin develop --release  # This will generate wheels and put a native library in ./fast_unit/
pip install .  # Installs to your python interpreter

Cross Compilation for RoboRIO

Getting Required Files

In order to compile for RoboRIO, you need to copy the contents of /usr/local/lib off of your RIO and update the RIO_ROOT to reflect where you copied them to. This is assuming you have already installed python on your RIO using RobotPy.

This is the command I used to accomplish this:

scp [email protected]:/usr/local/lib ./RIO_ROOT/usr/local/lib

Installing ARM Linker

Rust needs an arm linker to compile arm binaries, which can be installed fairly easily. On debian, run the following:

sudo apt install gcc-arm-linux-gnueabi

Building

Once you have the required tools, running the script below should compile and build the wheels.

# Add RIO's target triple
rustup target add arm-unknown-linux-gnueabi

# Set cross-compilation environment variables
export PYO3_CROSS_PYTHON_VERSION=3.10
export PYO3_CROSS_LIB_DIR="RIO_ROOT/usr/local/lib"

# Build wheels for RIO
maturin build --target=arm-unknown-linux-gnueabi --rustc-extra-args="-C linker=arm-linux-gnueabi-gcc"

About

Fast Python Unit Management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published