Skip to content
Nguyen Thanh Tai
All projects

Robotics simulation · Systems

ARM-01 Robot Lab

A browser robotics lab: MuJoCo physics at 500 Hz streamed to a 3D scene of seven real robots, with an IK pick-and-place stack that succeeds on 99 of 100 seeds.

PrototypePrivate repo

Private repository — code available on request

MuJoCo render of the SO-101 arm at station 01 with four coloured cubes and a sorting tray.

Station 01: the SO-101 arm, four cubes and a tray — rendered from the production physics model.

benchmark seeds per arm (from 27 and 20)
99/100
benchmark seeds per arm (from 27 and 20)
median FPS, measured in headed Chrome
59.9
median FPS, measured in headed Chrome
physics step rate
500 Hz
physics step rate
passing tests recorded at milestone M1
344
passing tests recorded at milestone M1

Overview

ARM-01 is a local robotics lab I built to learn manipulation properly. A Python server runs MuJoCo physics at 500 Hz and streams compact binary pose frames over WebSocket; a Next.js + React Three Fiber client renders seven real robot models from MuJoCo Menagerie at 60 FPS.

Station 01 has two working arms, an SO-101 and a Franka Panda, driven by an inverse-kinematics pick-and-place stack. Success is judged only by the simulator — contact force, lift, drift, tilt — not by the script.

The problem

Learning robotics from tutorials hides the hard parts: keeping a browser view in sync with a fast physics loop, grasping that is physically honest, and measuring whether a skill actually works across random scenes.

Who it's for

  • Built for my own learning and research — a single-user lab that runs on localhost.
  • Designed so an LLM agent can later drive the arms through validated tool calls.

What it does

  • Pose-only streaming

    Geometry ships once as GLB. Each frame is a 16-byte header plus position and quaternion for ~123 bodies (~3.5 KB). A shared binary fixture fails both test suites if the format drifts.

  • IK pick-and-place skills

    mink IK in the robot base frame with self-collision avoidance, quintic trajectories timed by joint limits, a four-way yaw search and jaw centering for the 5-DOF SO-101.

  • Benchmark CLI

    A headless 100-seed benchmark runs the full skill on randomized, reachability-filtered scenes and reports success per arm.

  • Reproducible assets

    Menagerie is pinned to a commit and checked against a sha256 manifest; one GLB node per MuJoCo body; a gate rejects any mesh that deviates more than 1 mm from the physics model.

  • Safety controls

    STOP latches until RESET, a heartbeat deadman stops motion when the controlling tab goes away, and only one tab can hold control at a time.

  • Hardened local runtime

    Host and Origin allow-lists on both servers, nonce-based CSP, loopback-only binding — protection against DNS rebinding and cross-site requests to a local app.

How it's built

Three threads with clear ownership: physics owns the MuJoCo state, a render worker owns the GL context, and the asyncio loop owns the sockets. Each connection keeps only the latest frame, so slow clients drop frames instead of lagging.

  1. 1

    Asset build

    Pinned Menagerie → MjSpec composition → per-body GLB export → gltfpack → ≤1 mm geometry check.

  2. 2

    Physics thread

    mj_step at 500 Hz with a command queue, STOP latch and NaN recovery; publishes on sim-time marks every 1/60 s.

  3. 3

    Hub

    Per-connection latest-frame slot; binary frames out, JSON commands (manual targets, stop, heartbeat) in.

  4. 4

    3D client

    Binds GLB nodes to frame order, renders 50 ms behind sim time with clock slewing and snap-on-gap interpolation.

Engineering challenges

From 27/100 to 99/100 grasps

Problem

The first scripted pick-and-place succeeded on 27 of 100 seeds for SO-101 and 20 for Panda.

Solution

Each fix was measured and committed on its own: a measured tool-centre site, IK self-collision avoidance, servo-sag compensation, opening the gripper only to working width, yaw search with IK reseeding, jaw centering, and raising the Panda's grip force to the range in the Franka Hand datasheet. A weld-based grip assist was built but left off, because it would inflate the metric.

500 Hz physics, 60 FPS browser

Problem

A naive stream either queues stale frames or stutters.

Solution

Latest-frame-only delivery on the server and a client that interpolates 50 ms behind sim time, slews its clock ±10%, and snaps instead of interpolating through poses that never happened.

Physics and visuals that agree

Problem

Visual meshes drift from the collision model and the arm appears to grab air.

Solution

Every MuJoCo body becomes a named GLB node, the client marks a station offline if a node is missing, and the pipeline enforces a ≤1 mm bounding-box match.

My role

  • Designed the system (spec with a decision table D1–D10) and built the server, asset pipeline and web client — 104 commits and 28 pull requests on main.
  • Developed with AI coding agents (Claude Code); I set requirements and acceptance criteria and drove the measurement-first debugging of the grasping stack.

Current scope

Milestones M0 (3D lab) and M1 (control and skills) are complete. The LLM agent that will command the arms is in progress on a branch — tool schemas and a validating executor exist, the agent loop does not yet.

The repository is private and the lab runs on localhost only; there is no public demo.

Real captures. Click to enlarge.

  • SO-101 running the scripted pick → place skill in the physics simulation.
  • Franka Panda on the same task — friction-only grasping, no weld assist.
  • The whole lab — SO-101, Panda, UR5e, ALOHA, Unitree G1, Spot and TidyBot.
  • The web client — 3D scene with station board, mini-map and HUD.
  • Panda station render.
  • Top-down lab layout.
  • Overhead 'AI camera' view rendered from a model camera — groundwork for vision-based control.