pros-simulator 0.2.2

Run PROS robot code without the need for real VEX V5 hardware.
Documentation

PROS Simulator

Run PROS robot code without the need for real VEX V5 hardware.

CI Status MIT License Crates.io

Installation

cargo add pros-simulator

Overview

This Rust crate is a WebAssembly-based runtime for simulating VEX V5 robot code, without the need for any special hardware. It acts as a plug-and-play solution for programming from home, debugging misbehaving programs, and quickly iterating code design.

This runtime implements a portion of the PROS C interface, allowing pre-existing PROS-based programs to function in the simulator without the need for invasive modification. Support for pros-simulator is built directly into the pros crate, so programs using it will be compatible with this simulator for free.

Usage

PROS Simulator is available in library form, but can also be used from cargo-pros for a more user-friendly experience that works out of the box. This project contains the core of the simulator, which handles loading and running user-generated robot code, and requires a custom interface to be useful. There are also a few example interfaces, like the TUI-based one.

TUI Interface

TUI interface

To build the example simulator program, you'll need a nightly Rust toolchain and the was32-unknown-unknown target installed. In the example directory, run the following command to build:

cargo +nightly build --target wasm32-unknown-unknown

Then, in the project root, run the following command to start the TUI:

cargo run --example tui ./example/target/wasm32-unknown-unknown/debug/example.wasm

The simulator (and TUI interface) support the use of breakpoints in robot code! Try opening this project in VS Code and pressing F5 to start debugging the example program.