Vantage · Dry Run — 6-DOF Arm Simulation & Control Suite
A browser-only simulation and control suite for a 6-DOF industrial robotic arm
(fixed stylus end-effector, no gripper). Built for the Techathon Nationals &
Rover Summit “Dry Run” challenge (IUT Robotics Society).
🔗 Live demo: https://logarithm-techathon.vercel.app (use Chrome/Edge for voice + webcam)
· 🎥 Demo video: https://drive.google.com/file/d/1nWU4o7GjBKUWloWakOJJNrpv8NcNMyf3/view?usp=sharing
· 🔌 Live Wokwi circuit: https://wokwi.com/projects/469135405272658945
The thesis: this is one motion-control pipeline, triggered many ways —
dashboard, GUI joystick, keyboard, voice, an autonomous PIN-entry routine, an
agentic natural-language layer, and hand-gesture (webcam) control. Every
input produces the same structured command, which flows through the same IK
solver and the same deterministic safety gate before any joint moves. Prove it
in simulation → trust it on hardware.
The app

Left: live telemetry — robot status, 7 joint angles, end-effector position, command log.
Center: the URDF arm + 6-key panel in a Z-up scene.
Right: the control-mode selector (Joystick · Keyboard · Voice · Autonomous · Agent · Visual) and the active control surface.
 Autonomous PIN entry — enters 142536, each key touched within ±5 mm, per-key logging. |
 Visual control (bonus) — webcam hand-gesture joystick: point = X/Y, fist = Z. |
 Keyboard — on-screen caps light up as you press (W held here). |
 Agent (bonus) — free-form NL → LLM → the same safety-gated commands. |
System diagrams
One motion pipeline, many triggers — every input funnels through the same deterministic safety gate before any joint moves:

One command’s lifecycle — the identical sequence runs no matter who triggered it (voice, stick, gesture, or the autonomous sequencer):

Electrical schematic (Phase 5) — ESP32 → PCA9685 → 7 servos over Wi-Fi, with a separate high-current servo rail and a common ground (live Wokwi):

Wokwi simulation — the same topology running in Wokwi (ESP32 driving 7 servos = 7 arm joints):

More diagrams (linked, not inlined): kinematic chain ·
autonomous PIN state machine ·
agentic block diagram.
Every architecture/system diagram ships with its editable .drawio source
alongside the .png in docs/diagrams/ — open them at
app.diagrams.net to edit. (The Wokwi circuit is the
live Wokwi project and
hardware/diagram.json.)
Full pin tables + current budget are in
docs/electrical-schematic.md; design detail is in
docs/architecture.md.
Control modes
All six emit the same Command and pass through the same gate — they only differ in how the command is produced.
| Mode |
How it works |
| Joystick |
Analog sticks; deflection → jog velocity (delta = speed × push × dt) added to the current tip position. |
| Keyboard |
W/A/S/D → X/Y, Q/E → Z, arrows → base/wrist, Shift → 2×. Same jog delta from a key-hold; on-screen caps light live. |
| Voice |
Speech → OpenAI Whisper (Web-Speech fallback) → a fixed keyword grammar → one command; spoken confirmation. |
| Autonomous |
Type a 6-digit PIN → for each digit: approach → descend → touch → retract. Each key is solved to 1 mm and then independently verified at ±5 mm, with per-key pass/fail logging. |
| Agent (bonus) |
Free-form NL → LLM (OpenAI / DeepSeek) → a sequence of commands → the same gate; asks a clarifying question when ambiguous. |
| Visual (bonus, new) |
Webcam + MediaPipe hand tracking as a dynamic-origin joystick: ☝ point = X/Y, ✊ fist = Z. |
Problems we hit & how we solved them (with the optimizations)
| Problem |
Approach / optimization |
| The wrist axes don’t intersect at a point, so clean analytic IK is awkward for this 7-joint redundant arm. |
A numerical damped-least-squares (DLS) Jacobian solver, position-only (3-DOF task): Δq = Jᵀ(JJᵀ + λ²I)⁻¹e, with damping λ = 0.05 for graceful behavior near singularities. It probes the live URDF’s own FK, so the solver can never disagree with what’s rendered. |
| Real-time jogging was expensive — a full convergence loop every frame stuttered. |
Two-step optimization: (1) a bounded, constant-time jog step (no convergence loop) for small per-frame nudges; (2) Jacobian caching — the Jacobian changes slowly while jogging, so it’s computed once and reused, recomputing only every 8 frames or when the pose drifts. This dropped ~8 forward-kinematics probes/frame to ~1 on cache-hit frames (~89% hit rate) while the error still self-corrects against the true tip each frame. |
| An ungated AI agent is a rubric penalty (and unsafe). |
The LLM only chooses which structured commands to emit — it never touches the arm. Every command still passes SafetyValidator, so an unreachable/out-of-bounds step is rejected exactly as if typed by hand. Ambiguous requests get a clarifying question instead of a guess. |
| The manual joint sliders bypassed the safety gate — you could fold the arm through the floor or into its own base. |
On every slider change we run FK on the proposed pose and reject it if the tip leaves the reachable dome (validateTarget) or any link frame dips below the floor (evaluatePose returns the lowest link-Z). The slider snaps back and logs the reason. |
| Browser speech recognition was mediocre. |
Upgraded voice + agent STT to OpenAI Whisper (record → server proxy → transcribe) with a Web-Speech fallback; the same deterministic grammar backs both the mic and a typed box, so it’s demoable/testable without a microphone. |
| API keys / CORS / security. |
A Vercel serverless proxy (/api/llm, /api/stt) holds keys server-side — nothing ships in the browser bundle, and DeepSeek’s CORS restriction doesn’t apply in production. |
| Keys only “clicked” during the autonomous run. |
Highlight is now contact-driven: each telemetry frame, if the tip is within 8 mm of a key it lights up — in every mode, not just the sequencer. |
| The ±5 mm “verification” used the same tolerance the IK solver accepted at — so the check couldn’t independently fail (it graded its own homework). |
Key presses now solve to 1 mm (acceptTol threaded through moveTo → solveIK) and are verified at 5 mm — an independent gate with real head-room. A unit test asserts the solver reaches every key within 1 mm on the actual URDF. |
| First gesture-control attempt gave random, jittery motion. |
Rebuilt Visual mode as a dynamic-origin analog joystick (wherever you gesture becomes neutral), reusing the joystick’s exact speed/deadzone constants, plus EMA smoothing and gesture debouncing to kill landmark jitter and mode flicker. |
| Industrial-joint torque ≫ hobby servo. |
The electrical PoC is honest about this: ESP32 + PCA9685 + hobby servos demonstrate the control topology (Wi-Fi command → PWM → per-joint actuator); a real arm would swap servos for BLDC + drivers on the same bus, noted in the schematic doc. |
Design decisions & scope (for reviewers)
A few things below are deliberate scope choices, not oversights — flagged here so they’re read as intended:
-
Voice (Phase 3) is deterministic by design. The required voice path uses a fixed keyword grammar (voiceGrammar.js) rather than an LLM — chosen for trust and reproducibility: it’s pure, unit-testable, never hallucinates a motion, and covers the spec’s examples (“move up”, “rotate base 30 degrees”, spoken numbers + homophones). Free-form / ambiguous natural language is the explicit job of the Phase 3B agent, which reasons over the same command schema and passes the same safety gate. These are two natural-language front-ends split on purpose — a predictable baseline plus a smart bonus — not a limited baseline.
-
IK is position-only; the stylus stays tip-down by construction, not by an orientation constraint. The spec’s success criterion is tip position within ±5 mm, so we solve the 3-DOF position task (solveIK) and keep the tool pointing down two ways: every solve is seeded from the current (tip-down) pose, and every key press approaches from 8 cm directly above and descends along −Z (executor.js). Orientation is therefore not an explicit constraint — a spec-legal choice. Consequence we accept: a pathological seed could in principle leave the stylus slightly tilted at contact while the tip is still within tolerance; the position criterion still holds. A downward-orientation term could be added to the Jacobian if a future spec requires it.
-
Performance trade-offs. The main bundle is ~1.2 MB (MediaPipe is the one lazily code-split chunk); solveIK runs up to 120 damped-least-squares iterations, each probing the live URDF’s forward kinematics by transiently mutating it — fine at this scale, and the real-time jog path is separately optimized with the cached-Jacobian solver (~89% Jacobian-cache hit rate).
Status
| Phase |
Scope |
State |
| 1 — See the Arm |
URDF render, 6-key panel, live dashboard (joint angles + EE position) |
✅ done |
| 2 — Move the Arm |
Inverse kinematics, GUI joystick, keyboard control |
✅ done |
| 3 — Talk to the Arm |
Voice control (Whisper STT + Web Speech fallback) |
✅ done |
| 4 — Autonomous PIN entry |
Approach → descend → touch (±5 mm) → retract, per-key logging |
✅ done |
| 5 — Electrical schematic |
ESP32 + PCA9685 + servos over Wi-Fi |
✅ done — schematic · live Wokwi |
| 3B — Agentic (bonus) |
Free-form NL → LLM → safety-gated commands + spoken reply |
✅ done |
| ★ — Visual gesture control (extra) |
Webcam + MediaPipe hand tracking as a safety-gated joystick |
✅ done |
See prd.md for the full product/architecture plan and
docs/problem-statement.md for the converted
problem statement (with the URDF and key config merged in).
Tech stack
- React + Vite — UI shell and fast dev loop
- lucide-react — UI icons
- three.js + @react-three/fiber + @react-three/drei — 3D scene
- urdf-loader — loads the provided
6_dof_arm.urdf (primitives only → zero mesh assets)
- OpenAI Whisper (Phase 3) — high-accuracy voice STT via a server-side proxy, with a Web Speech API fallback
- OpenAI / DeepSeek (Phase 3B bonus) — natural-language → structured commands, safety-gated (any OpenAI-compatible provider; keys server-side, never committed)
- @mediapipe/tasks-vision (bonus) — webcam
HandLandmarker for gesture control (lazy-loaded, code-split)
- ESP32 + PCA9685 / servos (Phase 5) — Wi-Fi hardware PoC (Wokwi)
Run it
npm install
npm run dev # http://localhost:5173
Build & preview:
npm run build
npm run preview
Headless smoke test — self-contained (builds, serves, drives headless Chromium,
asserts the URDF renders + telemetry is live). One-time: npx playwright install chromium.
npm run smoke # build + preview + check — no dev server needed
npm run smoke shot.png # also saves a screenshot
SMOKE_URL=http://localhost:5173 npm run smoke # fast: hit an already-running dev server
Unit tests (Vitest) — cover the pure core headlessly: the command schema + gate
(isWellFormed), the voice grammar, the safety validator, and IK convergence
against the real 6_dof_arm.urdf — proving solveIK reaches every key within
1 mm (so the ±5 mm autonomous check is an independent measurement, not a
restatement of the solver’s own tolerance).
npm test # 29 tests across src/core/*.test.js
Project layout
6_dof_arm.urdf provided arm model (also copied into public/)
key.config.json provided 6-key panel coordinates (also in public/)
docs/
problem-statement.md converted problem statement (+ merged URDF/key assets)
architecture.md "one pipeline, many triggers" system design + diagrams
electrical-schematic.md ESP32 + PCA9685 Wi-Fi servo PoC: topology, pin tables, budget
demo-script.md run-of-show for the demo video
diagrams/ system/hardware diagrams (.png renders + .drawio sources)
screenshots/ frontend captures used in this README
prd.md product requirements & architecture
hardware/ Wokwi diagram.json + ESP32 sketch.ino (Phase 5)
api/ Vercel serverless proxies (server-side LLM + STT keys)
src/
core/ the shared pipeline (framework-agnostic)
robotModel.js joint chain, limits, home pose
commandSchema.js the one structured command every input emits
SafetyValidator.js deterministic gate (workspace + joint limits + reachability)
IKSolver.js DLS Jacobian IK (solveIK) + cached-Jacobian jog (createJogIK)
MotionController.js velocity-limited motion engine
dispatcher.js the single validate → IK → move choke point
executor.js sequenced, gated executor (key taps + multi-step plans)
voiceGrammar.js deterministic NL → Command parser (Phase 3)
autonomous.js PIN runner: approach → descend → verify → retract (Phase 4)
agent.js LLM NL → Command[] via the same gate (Phase 3B bonus)
stt.js Whisper transcription (server proxy in prod)
*.test.js co-located Vitest unit tests (schema, grammar, safety, IK)
hooks/
useKeyboardJog.js keyboard control
useDictation.js shared mic hook (Whisper → Web Speech fallback)
components/ UI shell — TopBar (E-Stop), LeftPanel (telemetry + joints +
command log), Viewport (R3F scene: RobotArm, KeyPanel),
RightPanel (mode switch) — plus the input adapters:
JoystickControl, KeyboardControl, VoiceControl,
AutonomousPanel, AgentControl, VisualControl
scripts/smoke.mjs headless render/telemetry check
In the right panel, switch to Visual and press ▶ Start camera. It uses
MediaPipe’s HandLandmarker to turn your hand into a dynamic-origin joystick:
the moment you make a gesture, wherever your hand is becomes “neutral,” and pushing
away from there jogs the tip (speed ∝ how far you push — real joystick feel).
- ☝ Point (index finger) → jog the tip in the X/Y plane
- ✊ Fist → move up / down to jog Z
- Ease your hand back to neutral, or open it, to stop; ■ Stop releases the webcam.
It emits the same jog commands as the on-screen joystick — same speed/deadzone
constants, same safety gate, same IK — so it’s just another trigger on the one
pipeline. The MediaPipe engine is lazy-loaded (code-split), so it only downloads
when you enter this mode. Camera frames never leave the browser.
Agentic layer (Phase 3B, bonus)
Optional. In the right panel, switch to the Agent control and type or
speak a free-form instruction like “nudge the tip 2 cm toward the panel and tap
the 5 key twice.” The model returns structured commands that still pass through
the same SafetyValidator gate as manual control before any motion; the agent
replies in natural language (and speech) with what it understood and the outcome,
and asks a clarifying question instead of guessing when the request is ambiguous.
Provider: OpenAI (primary) with DeepSeek fallback — any OpenAI-compatible
provider works. On the deployed site the keys live server-side in the
/api/llm Vercel function (never in the browser bundle). For local dev you
can paste a key into the agent’s “keys” box (stored only in your browser’s
localStorage, never committed); the dev server proxies the call (see
vite.config.js) to avoid CORS.
Deploy (Vercel)
The core app is 100% client-side (static Vite build); Vercel auto-detects the
framework — no vercel.json needed. The optional agentic + voice layers call
Vercel serverless functions (api/llm.js, api/stt.js) that hold the API
keys server-side, so no key ever ships in the browser bundle and DeepSeek’s CORS
restriction doesn’t apply in production. To enable them: add OPENAI_API_KEY and
DEEPSEEK_API_KEY under Project → Settings → Environment Variables (no
VITE_ prefix), then redeploy. In production the app prefers the proxy; under
local npm run dev it falls back to a runtime-entered key. The core phases (1–5)
work with no keys at all.
Coordinate convention
The scene is Z-up (camera.up = [0,0,1]), matching the URDF’s native frame,
so on-screen world coordinates are base_link coordinates — no conversions
between the render, the dashboard readout, and the IK math.
评论