Prerequisites
Before you begin, make sure you have:- Rust toolchain (1.56 or later)
- A modern web browser with WebAssembly support
- Basic familiarity with Rust programming
If you don’t have Rust installed yet, check out the Installation guide first.
Running the Simulation
Build the WebAssembly binary
Compile the Rust code to WebAssembly:The compiled WASM file will be located at:
Serve the application
You’ll need a local web server to run the simulation. Use any static file server:
Understanding the Interface
When you first open Mars-RS, you’ll see:- VEX Field: A 12×12 foot field with triballs, goals, and barriers
- Robot: A red robot controlled by keyboard or autonomous code
- Mode Indicator: Shows current mode (Driver/Auton/Create)
- Control Buttons: Switch between different modes
Control Modes
Driver Mode
Driver Mode
Control the robot manually using keyboard inputs:
- W: Move forward
- S: Move backward
- A: Turn left
- D: Turn right
- T: Toggle between Driver and Auton modes
Auton Mode
Auton Mode
Run autonomous routines programmed with path following algorithms:
- Pure Pursuit path following
- PID-based movement to point
- Boomerang controller for smooth curved paths
Create Mode
Create Mode
Design custom autonomous paths by drawing waypoints on the field. Click the Create button to enter path creation mode.
Your First Autonomous Routine
Here’s a simple example of moving the robot to a target position using the built-in movement functions:Next Steps
Installation
Learn about dependencies and build configuration
Movement Algorithms
Explore PID control and path following
Field Elements
Understand game objects and physics
Robot Configuration
Customize your robot’s properties
Troubleshooting
Simulation not loading?- Ensure your browser supports WebAssembly
- Check browser console for JavaScript errors
- Verify the WASM file path in
index.htmlmatches your build output
- Make sure you’re in Driver mode (press T to switch)
- Check that the keyboard focus is on the canvas element
- Verify velocity limits aren’t capping your movement
- Run
cargo cleanand rebuild - Check that all dependencies are compatible versions
- Ensure Rust toolchain is up to date with
rustup update