A live-rerouting path-finding visualiser in Rust + WASM
Scout shows how A*, D*-Lite, and Field-D* continually (re)compute optimal routes while new obstacles appear mid-journey.
Area | Highlights |
---|---|
Algorithms | A*, D*-Lite (default), Field-D* |
Dynamic obstacles | User-placed DOBs autoconvert to static blocks when the rover is ≤ 2 cells away (Chebyshev) |
UI | Canvas grid with pan/zoom, dark mode, FPS limiter |
Build | Pure Rust → wasm-bindgen → tiny JS wrapper |
Dev server | src/bin/serve.rs (≈ 80 LOC) – no Node required |
# once per machine
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
# development (watch mode)
wasm-pack build --target web --out-dir pkg --dev --watch &
cargo run --bin serve # → http://localhost:8000
wasm-pack build --target web --out-dir pkg --release
Grid Map 4-Layer Architecture
┌─────────────────┐
│ Layer 1 · DOB │ Dynamic Obstacle Map (amber → blue)
└────┬────────────┘
↓
┌─────────────────┐
│ Layer 2 · UI │ Grid visualisation / user input
└────┬────────────┘
↓
┌─────────────────┐
│ Layer 3 · Rover │ Rover state + path planner
└────┬────────────┘
↓
┌─────────────────┐
│ Layer 4 · FOM │ Fixed Obstacle Map (authoritative)
└─────────────────┘
(A deep dive lives in docs/ARCHITECTURE.md)
Directory Overview:
ScoutNav/
├── src/
│ ├── bin/serve.rs # dev HTTP server (localhost:8000)
│ ├── components/ # Yew UI widgets
│ │ ├── canvas.rs # WebGL/2-D drawing surface
│ │ ├── controls.rs # play/pause/algorithm selectors
│ │ ├── help_bubble.rs # inline docs
│ │ └── main_app.rs # root <App/>
│ ├── pathfinding/
│ │ ├── astar.rs
│ │ ├── dstar_lite.rs
│ │ ├── field_dstar.rs
│ │ └── pathfinder_trait.rs # common interface
│ ├── rover.rs # agent FSM: move → scan → update map
│ └── lib.rs # wasm-bindgen glue
├── index.html / styles.css # SPA shell + theming
├── Cargo.toml / Cargo.lock
├── package.json / package-lock.json
├── docs/ # (demo.gif, architecture.svg etc.)
└── .github/workflows/ci.yml # GitHub Actions
- Run
cargo test
locally. - GitHub Actions: check → test →
wasm-pack build
.
git switch -c feat/my-change
cargo fmt && cargo clippy -- -D warnings
- Conventional-commit message (e.g.
feat: add theta*
) - Open a PR – details in CONTRIBUTING.md.
GPL-3.0-or-later – see LICENSE.