To generate a project using this template, click the "Use this template" button in the upper right corner of the GitHub repository. Choose an appropriate name and clone the new repository using Git. Finally, update the package name in Cargo.toml
:
[package]
name = "my-vex-robot"
version = "0.1.0"
edition = "2021"
Run the following terminal commands to set up your Mac for development.
Install Homebrew, a package manager for macOS which is needed to configure your computer with the necessary development tools:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Under the header "Next Steps", Homebrew may prompt you to run commands to complete the installation.
Install dependencies and The Rust Programming Language:
brew install rustup osx-cross/arm/arm-gcc-bin purduesigbots/pros/pros-cli
rustup-init -y --default-toolchain nightly
Close and reopen the terminal, and install pros-rs:
rustup component add rust-src
cargo install cargo-pros
Install Rust by following the instructions on https://rustup.rs/. Configure your installation when prompted, installing a nightly toolchain and keeping other default values.
Download and run the ARM EABI Toolchain installer, choosing the first .exe
file under the header arm-none-eabi
.
Install Python from https://python.org/.
Run the following commands in Powershell to install pros-rs:
python3 -m pip install --user pros-cli
rustup component add rust-src
cargo install cargo-pros
Run the following terminal commands to install dependencies and set up your PC for development.
sudo dnf install rustup python3-pip arm-none-eabi-gcc-cs gcc
rustup-init -y --default-toolchain nightly
pip install --user pros-cli
Close and reopen the terminal, and install pros-rs:
rustup component add rust-src
cargo install cargo-pros
If you don't have rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup toolchain install nightly
rustup override set nightly
If you do have rustup:
rustup update
rustup toolchain install nightly
rustup override set nightly
Install pip and the Pros CLI:
sudo apt install python3-pip
pip install --user pros-cli
Close and reopen the terminal, and install pros-rs:
rustup component add rust-src --toolchain nightly
cargo install cargo-pros
Use the Cargo PROS terminal utility to compile this pros-rs project.
cargo pros build
The separate pros
command is used to upload. Plug in your powered VEX robot brain via USB and run the following command to upload to program slot 1. If you changed the package name when setting up this template, you may need to adapt the name of the .bin
file.
pros upload --target v5 --slot 1 ./target/armv7a-vexos-eabi/debug/pros-template-rust.bin
If you have PROS Simulator installed, you can use it to run this project without real VEX hardware for debugging and development purposes. Start by adding the WebAssembly Rust target:
rustup target add wasm32-unknown-unknown
Build the project for the simulator by running:
cargo pros build -s
Then open this project in PROS Simulator to run and debug the robot code.
Developers using Visual Studio Code with the rust-analyzer extension have access to smart editing features like Intellisense and code analysis. By default, rust-analyzer will check the project for errors when it is saved.
- If you experience issues with Intellisense, make sure you've built the project at least once!
- If you get the error
TypeError: <flag 'BrainFlags'> has no members defined
when using the third partypros upload
command, you need to downgrade Python to v3.9