Turret Lab is an interactive, deterministic control-system visualizer for comparing a direct position PID loop with a cascaded position-to-velocity controller. Both controllers receive the same robot pose, target, plant model, and disturbance, so the architecture is the only variable.
- Drive a shared robot pose with
W,A,S,D,←, and→. - Compare direct PID and cascaded control side by side on the same field.
- Run a repeatable 12-second benchmark.
- Inspect live turret telemetry, signed error, field position, and rolling metrics.
- Tune controller, plant, latency, noise, and geometry parameters in real time.
- Switch alliance target and environment assumptions.
The model is educational: it demonstrates controller behavior under transparent synthetic assumptions, not measured hardware performance.
Requirements: Node.js 22.13 or newer.
npm install
npm run devOpen the local address printed by the development server.
npm test
npm run buildThe simulation tests cover controller math, determinism, benchmark behavior, and metrics. The production build targets the Cloudflare Worker-compatible output used by OpenAI Sites.
app/ Site route and metadata
src/components/ Field, chart, telemetry, metrics, and tuning UI
src/simulation/ Plant, controllers, benchmark engine, and tests
public/assets/ Field image and field geometry data
worker/ Sites runtime entry point
- React + TypeScript
- Vinext/Vite build pipeline
- Fully client-side simulation with a fixed 20 ms step
- No account, backend, or persistent data required
The visualizer references Team 6940's 2026 Rebuilt turret architecture and links to the relevant robot code from within the interface. The included field asset is used for the educational field visualization.