2D VEX drivetrain simulator.
You need Node.js (18+).
npm install # install dependencies (do this once)
npm run dev # start the dev server with hot reloadThen open the URL Vite prints:
http://localhost:5173/WHOOPsim/
npm run build
npm run deploy| Key | Action |
|---|---|
W / S |
Throttle (forward / back) |
A / D |
Turn (tank) / Strafe (mecanum) |
← / → |
Strafe (tank) / Turn (mecanum) |
1 / 2 |
Decrease / increase max velocity |
3 / 4 |
Decrease / increase lateral time constant |
5 / 6 |
Decrease / increase angular time constant |
R |
Toggle tank / mecanum drive |
F |
Cycle field background |
H |
Toggle telemetry overlay |
VEX controller is also supported (left stick = throttle/strafe, right stick = turn).
| File | Responsibility |
|---|---|
src/main.ts |
Entry point: constructs the robot, owns the render/update loop |
src/robot.ts |
The Robot class — physics, odometry, and canvas rendering |
src/control.ts |
Keyboard/controller input → drive commands; menu keybinds |
src/field.ts |
Field background image + (optional) obstacle rectangles |
src/globals.ts |
Canvas, drawing context, scale constants, shared settings |
src/util.ts |
Math + coordinate helpers (inches ↔ pixels, deg ↔ rad, etc.) |
- Origin is the center of the field; units are inches, range roughly
-72..72. +Xis right,+Yis up (toward the top of the screen).- Heading is in degrees,
0= facing+Y(up), increasing clockwise (so forward =(sin θ, cos θ)). dtpassed into drive methods is in seconds (~1/60per frame).Robot.maxSpeedis in ft/s; internal velocities are converted to in/s (× 12).