On-Chip ESP32-P4 Neural Walking, Keeper Bridge Rebuild & Ainekio OS
Distilling a 50 Hz MicroDuck neural gait policy down to 107.8 KB int8 inside the ESP32-P4's 128 KB L2 cache, hardwood and carpet-seam floor trials, a redesigned 2S Keeper Bridge, the Cockpit HUD, and rebranding MetaHuman OS to Ainekio OS.
Dated workbench entry from . See where the robot stands today →
Between November 7 and November 11, work on the workbench and in simulation crossed two milestones I had been aiming toward since V2 first stood up:
- Neural walking now runs natively on the
ESP32-P4itself—no Wi-Fi host stream required. Using two rounds of DAgger teacher-student distillation, I shrunk our GPU-trained MicroDuck proprioceptive gait network by ~80%—from a547 KBteacher down to a107.8 KB(110,432-byte)int8policy that fits completely inside theESP32-P4’s128 KBL2 cache and runs closed-loop at50 Hzon Core 1. - MetaHuman OS officially became Ainekio OS (
Greg-Aster/ainekio-os). Alongside opening up and renaming the companion mind repository, I unified local and LAN GPU model/voice routing with warm cloud coding delegates, built a single live-camera Cockpit HUD for driving the robot on the floor, and redesigned the rear Wireless Keeper Bridge around our2Spower electronics.

1. Moving neural walking onto the ESP32-P4’s 128 KB L2 cache
During the November 6 carpet walks,
neural control worked, but with a catch: the workstation gateway was still running the
policy and streaming 50 Hz foot targets over Wi-Fi UDP. On a busy room network, even a
brief Wi-Fi hiccup stretched the 20 ms control tick and broke the rhythm of a stride.
Untethered floor walking meant putting the neural network on the microcontroller right
next to the sensors and servos.
The proprioceptive MicroDuck policy takes a 720-float rolling history (15
frames × 48 values covering 300 ms at 50 Hz):
- Joint positions & velocities (
24values): All 12 modifiedMG90S4th-wire potentiometer angles (sampled through theCD74HC4067multiplexer) and One-Euro filtered joint velocities. - Inertial state (
9values): 3-axis angular rate and 3-axis linear acceleration from the208 HzLSM6DS3IMU, plus the yaw-zeroed gravity vector from Madgwick attitude fusion. - Commands & prior action (
15values): Desired body velocity (vx,vy,wz) and the previous step’s12normalized foot-offset outputs.
My first on-chip compile quantized the 512-256-128 teacher network directly to
symmetric per-row int8 weights. It ran on the board, but at 547,040 bytes
(534 KB) it was more than 4× larger than the ESP32-P4’s 128 KB L2 cache,
forcing external PSRAM fetches across the memory bus every 20 ms.
Running two rounds of DAgger distillation from that teacher into a compact
720 → 128 → 64 → 32 → 12 student shrunk the compiled int8 weights by 79.8% down
to 110,432 bytes (107.8 KB)—small enough to stay hot inside the 128 KB L2
cache on Core 1 using 8-way unrolled int8 × int16 → int32 dot products. Every
20 ms, its Cartesian foot offsets pass through analytical 35 / 20 / 28 / 38 / 55 mm
four-bar inverse kinematics and workspace boundary projection before driving the
PCA9685 PWM channels, while legacy phase-residual correction tables (-831 lines of C)
were deleted completely.
Even better, continuing PPO reinforcement learning on the distilled 107.8 KB student
under simulated rail sag and multi-surface friction ended up beating the larger
547 KB teacher across every direction:
| Policy Milestone | Network & Compiled Size | Eval Score | Forward | Reverse | Yaw Turn (L / R) | Falls (8 Benchmarks) |
|---|---|---|---|---|---|---|
Teacher (Nov 7) | 512-256-128 · 547,040 B | 0.1558 | +0.172 m/s | -0.123 m/s | +55.7°/s / -50.2°/s | 0 |
First On-Chip Compile (Nov 9) | 512-256-128 · 547,040 B | 0.1632 | +0.165 m/s | -0.127 m/s | +49.7°/s / -49.9°/s | 0 |
Distilled Student (Nov 9) | 128-64-32 · 110,432 B | 0.1645 | +0.178 m/s | -0.130 m/s | +54.4°/s / -50.8°/s | 0 |
Multi-Surface Pass (Nov 10) | 128-64-32 · 110,432 B | 0.1574 | +0.176 m/s | -0.119 m/s | +48.7°/s / -48.9°/s | 0 |
L2-Cached Student (Nov 11) | 128-64-32 · 110,432 B (107.8 KB) | 0.1945 | +0.213 m/s | -0.179 m/s | +60.8°/s / -60.9°/s | 0 |
2. Hardwood & carpet-seam trials, hardware-twin RL, and Freestyle recovery
Cheap $1.50 MG90S micro servos don’t behave like idealized torque actuators in a
clean physics engine. To make policies trained across 4,096 parallel MuJoCo
environments hold up on a real living-room floor, I built GPU simulation twins of the
physical sensor and power quirks we kept hitting on the bench:
- Realistic electrical & linkage quirks: 12-bit ratiometric 4th-wire ADC steps,
5 V supply-rail voltage sag when multiple servos load up together, occasional
60 msstale ADC samples,LSM6DS3gyro noise and bias drift,PCA96854.07 µsPWM resolution, rear2Sbattery mass distribution, mixed floor friction (0.14slick hardwood through1.45carpet), and21–40 mmfloor/cable ledges.
512-256-128) climbing sloped ramps, steps, rocks, low-friction slip patches, and lateral shoves on the full-CAD V2 model.107.8 KB on-chip student policy (128-64-32) walking cleanly after 2-round DAgger distillation and rail-sag PPO continuation.Alongside the on-chip distillation work, I trained a 600M–800M-step Pupper V3 MJX
policy and ran 13 physical floor bouts on the real V2 robot across two surfaces that
usually trip small quadrupeds: 6 bouts on slick hardwood (forward, reverse, and four
turning arcs with 5.4°–15.4° peak roll and zero falls) and 7 bouts crossing and
straddling a raised carpet-to-hardwood seam (zero falls).
804.6M-step MJX evaluation rollout executing zero-drift stand hold, ±0.26 m/s forward/reverse over a 4 mm mat, ±0.12 m/s crab strafes, and ±1.20 rad/s yaw turns.
10–15 mm cable step-over benchmark comparing microduck-v16-p4 and microduck-v17-p4.For finite expressive gestures, I also expanded the Freestyle recovery dataset to
489 trajectories covering jam and slip recovery across all 23 base motions,
returning cleanly to native closed-loop Stand whenever a foot catches or stalls.
3. Redesigned Wireless Keeper Bridge and 30 updated Red V2 shell parts
Floor bouts quickly exposed every loose wire and tight tolerance left in the 650 g
body. Between November 6 and November 11 I reworked the rear power/electronics bridge
and front face mounts across 30 updated body parts:
- Battery-mounted Wireless Keeper Bridge: Moves the
2SLi-ion pack (73.6 × 46 × 22 mm),Mini5605 V / 5 Abuck regulator, andHiLetgo2S USB-C charger board onto a cleaner rear carrier with snap-in PCB clips for theESP32-P4,PCA9685, charger, and a dedicatedLSM6DS3gyro mount so nothing shifts during hard turns. - Thicker LCD spacers & recessed bezel: Adds four wireless spacers, a deeper
recessed bezel, and an updated camera-to-LCD retainer so the 1.9-inch
ST7789screen sits flush behind the mask without pinching its ribbon cable. - Front carrier & shimmed servo brackets: Cleans up the compact front bulkhead, crossbars, tray plates, and all four upper servo brackets with separate rectangular shims for tighter bearing preload.

2S Wireless Keeper Bridge, central ESP32-P4-WIFI6 + PCA9685 tray, and forward CD74HC4067 multiplexer behind the recessed face bezel.4. Body Control Cockpit HUD for live floor driving
Jumping between separate telemetry tabs while driving the robot across hardwood and
carpet got clumsy fast, so I built a single full-viewport Cockpit HUD around the
live lower-jaw OV5647 camera feed.
Driving with WASD or a gamepad now overlays live joint tracking and load, LSM6DS3
roll/pitch attitude, posture and gesture triggers, spoken-line controls, a switch
between on-chip ESP32-P4 walking and host-streamed policies, and a top-bar
autonomy cut-off toggle. To gauge clearance from a single monocular camera close to the
floor, pyramidal Lucas-Kanade optical flow tracks up to 36 ground-contact features at
the base of nearby obstacles and fuses them with forward displacement into a live
range readout.

ainekio-p4-e6ebe5 on carpet, showing the OV5647 floor camera view, calibrated 4th-wire servo status, and top-bar Cockpit HUD launcher.5. MetaHuman OS becomes Ainekio OS
Finally, the companion mind repository has a home and name that actually match the robot: Greg-Aster/ainekio-os.

Consolidating the repository let me clear out a pile of old scaffolding and tighten how the brain talks to both local GPUs and the physical body:
- Unified local, LAN GPU, and cloud routing: All 12 specialist model roles and
voice services now route from one status drawer—switching cleanly between local or LAN
GPU
Ollama/llama.cppendpoints, CUDAWhisperspeech recognition, andKokorotext-to-speech (with instant localPiperONNX fallback), plus warm persistent sessions for cloud coding and multimodal delegates. - Lean HTTP core & interactive architecture map: Collapsed 150+ leftover route
wrappers into a single Core API router (
123handlers), removed unused RVC voice-cloning clutter, and added a live node-graph architecture viewer. - Fresh physical reflex lines: Previously, tipping or shaking the robot twice in a row could get the exact same quip back. Physical reflex turns (tips, shakes, and leg stalls) now check the robot’s last six spoken reflex lines before replying, keeping its reactions varied and dryly observant instead of sounding canned.
For the full tour of how the mind and body fit together, head to the Ainekio OS System Reference or continue to the Project Overview.