“Which way am I facing?” — the one question IMU + leg-odometry
provably cannot answer: yaw about gravity (and the gyro-z bias behind it) is unobservable
from those sensors, so Stage-1 drift was yaw-limited by mathematics, not tuning. Stage 2 gives the
18-state ESKF one monocular eye: KLT tracks → anchored relative rotation → a 3-dof SO(3)
update on a cloned rotation state (18 → 21). On a 24 s closed loop with a full 360° of yaw,
VIO beats the ESKF on every seed — 0.15 % vs 0.49 % median drift over 5 seeds —
and the untouchable gyro-z bias error collapses from ESKF ~1.7 to ≤0.42 mrad/s. This page is the
arc: gap → world → approach → verify → bug → win.
STAGE 2 · MONOCULAR VIO — LANDEDLOOP DRIFT ~0.15 % MEDIAN · BEATS ESKF EVERY SEEDbg,z ERROR ≤0.42 mrad/s — STAGE 1 COULDN'T3-DOF SO(3) UPDATE · 18 → 21 CLONEFUSION JACOBIAN FD-VERIFIED ~1e-10ABSOLUTE YAW STILL UNOBSERVABLE — BY DESIGNeval: 24 s closed loop · 360° yaw · 20.8 m · 5-seed median
Update — the front-end was since sharpened. The essential-matrix rotation this
fusion consumes was diagnosed (it returned the 5-point minimal model) and refit (IRLS on all inliers)
from ~8 mrad (7.69 median) down to ~2 mrad, so the fusion's σvis = 2 mrad
is now honest rather than optimistic — VIO wins across all seeds at genuinely-honest noise. The numbers
on this page are the 5-seed medians. ▸ front-end sharpening deep dive
01 THE GAP — WHAT IMU + CONTACT PROVABLY CANNOT KNOW docs/STAGE1_ESKF_REVIEW.md · the stage-1 through-line, made precise
WHAT STAGE 1 EARNED
✓ OBSERVABLEGRAVITY + LEVER
the accelerometer's gravity direction levels roll / pitch; the contact update's
0.61 m lever arm makes bg x, bg y observable;
leg odometry pins velocity. On this loop that machinery alone lands
~0.5 % drift (5-seed median) — attitude error still explains almost all of what remains.
stage-1 ESKF replayed on the 24 s loop · run_vio.py
▸
THE UNOBSERVABLE PAIR
✗ NO FILTER CAN LEARN THESEGAUGE FREEDOM
rotate the whole world about gravity and every IMU + contact measurement is identical —
so yaw and the gyro-z bias bg,z that drives it live in the classic
unobservable subspace. Not a defect of the ESKF: provable, and shared by any
IMU + kinematics filter. Yaw error compounds as t3/2; on this loop the blind
filter's bg,z sat ~1.7 mrad/s wrong (median) — wherever its random walk wandered.
yaw-about-gravity + absolute position: the 4-dim unobservable subspace
▸
WHAT VISION MUST ADD
STAGE 2ROTATION ONLY
scale, metric velocity and position are already paid for by IMU + contact — the only
missing information is heading. So the camera is asked for exactly one product:
rotation over time. No landmarks in the state, no triangulation, no reprojection —
add the missing measurement, and only the missing measurement.
docs/STAGE2_VIO_DESIGN.md — design premise
tilt✓ gravity
v✓ contact
bg x·y✓ lever arm
ba(~) needs excitation
yaw✗ unobservable
bg,z✗ unobservable
stage-1 observability from IMU + contact alone — the two red cells are everything stage 2 exists to fix
⚑ the design compass — add only the missing information — a full visual-SLAM back-end would
hand back landmarks, translation, scale… all things this estimator already has from IMU +
kinematics, each one a new consistency liability (spurious information about unobservable directions
is exactly how filters start lying). The whole Stage-2 architecture falls out of one sentence:
measure camera rotation over time, fuse nothing else.
02 THE WORLD — A ROOM VISION CAN GRIP · A LOOP WORTH CLOSING src/humanoid_asimov/scene.py · walk.py — visual-only, dynamics untouched
The vendored scene was VIO-hostile: a repeating checker floor (every corner looks like every
other corner — correspondence poison) and not much else, all of it coplanar — a degenerate
geometry for essential-matrix estimation. Stage 2 builds a feature room via MjSpec at compile
time: four perimeter walls with colored panels, free-standing pillars and boxes, floor mats, and a
procedural concrete floor with non-repeating grain. Every added geom is
visual-only — zero collision: the physics, the gait, and every Stage-1 result are untouched;
only the pixels changed. The trajectory becomes a closed loop: a constant-yaw-rate command
ψ(t) = 2πt/24 walks a circle of radius ≈ 3.3 m — one full 360° of yaw in 24 s over a
20.8 m path. That buys two things at once: sustained yaw for vision to correct, and a
loop-close gap that makes drift an honest, unambiguous number.
THE FEATURE ROOM — THROUGH THE HEAD CAM renders/stage2_features.png · check_features.py
four viewpoints, ~400 Shi–Tomasi corners each (green) · panels + pillars give strong off-floor structure at every heading · the concrete grain feeds dense floor features — a generosity that is flagged honestly in 07
THE LOOP — 360° OF YAW IN 24 s walk.py · loop_heading() — top view, schematic
why a loop: yaw error can hide on a straight walk (it mostly rotates the map) — on a closed loop it must cash out as a loop-close gap · 360° of yaw also persistently excites exactly the states vision is supposed to fix
ⓘ design note — the dynamics are byte-identical — the feature room is added with
contype=0 / conaffinity=0 visual geoms and a retextured floor material; nothing the
physics touches changed. The same PD gait black box (with its honest 44%-BW support crutch) walks the
loop; the loop itself is just the Stage-1 heading command swept at a constant rate. Any improvement
measured on this page is therefore attributable to vision in the filter — not to a friendlier
world.
Shi–Tomasi corners into an 8×6 bucket grid (spread beats strength), pyramidal
Lucas–Kanade tracking with a forward–backward check (re-track backwards; disagree
> 0.7 px → cull). Keyframe every 0.5 s. Tracks persist to
loop_tracks.npz — bearings, not frames (720 frames ≈ 660 MB stays out of the repo).
an anchor keyframe is held for seconds (re-anchor when shared tracks < 30 or age
> 2 s); each new keyframe estimates R̃C_A→C_j against it —
RANSAC essential matrix on shared tracks, keep the rotation, discard the translation.
Discarding t removes the classic low-parallax degeneracy outright. Fewer than 25 inliers →
no update, coast on IMU + contact. Long anchors mean yaw error accumulates only at
anchor hops, not per frame.
the anchor's rotation error is stochastically cloned into the state (copy the δθ block +
cross-covariances; clone is static between keyframes). The measurement compares the anchor-to-now
rotation predicted by the filter against R̃ through the encoder-FK camera extrinsics
RBC(t) = RBH(enc)·RHC; residual
r = log(ĥᵀz) ∈ ℝ³, Joseph-form update, χ²(3)-gated. Stage-1 ESKF is subclassed,
never edited — Stage-1 stays reproducible.
FK must carry all 15 encoders — the waist/neck sag under the leg-only gait PD, and ignoring them would read back as fake base yaw
the 21-dim error state — one cloned rotation is the entire price of vision · re-anchor = drop 3 dims, clone again
THE MEASUREMENT — ROTATION SINCE THE ANCHOR top view · schematic
the filter predicts the same A→j rotation from its own state (ĥ) · residual r = log(ĥᵀz) — three numbers per keyframe, and they carry exactly the missing yaw information
WHERE THE MEASUREMENT TOUCHES THE STATE — H (3×21) block structure · exact at any linearization point
0₃δp
0₃δv
RCB,jδθ
0₃δbg
0₃δba
0₃δbc
−RCB,j·ÂδθA
only two non-zero blocks: the current attitude and its clone. Position, velocity and the
biases have zero H-blocks — they are corrected purely through the P cross-covariances
built up during prediction. That indirect route is precisely how vision reaches
bg,z: the filter knows how gyro-bias error would have bent the anchor-to-now
rotation, so a rotation residual re-bills the blame. Sanity anchor: at tj = tA,
 = I and r ≡ 0.
 = R̂ᵀWB,j·RA (anchor-to-now in the body frame) · RCB,j maps body error into the camera · derivation + conventions in docs/STAGE2_VIO_DESIGN.md
ⓘ why not a full MSCKF / tightly-coupled VIO — MSCKF's extra product over this scheme is
translation information — the one thing this estimator doesn't need (IMU + contact already
pin scale and velocity; Stage 1 measured position error as 85 % attitude-driven). It would arrive
with costs: reprojection Jacobians that do inject spurious yaw information unless FEJ/OC
machinery fights the linearization, landmark management, and low-parallax fragility. Rotation-only
keeps ~400 lines, one 3-dof update every ~0.7 s, and a 21×21 filter — and the front-end persists
per-keyframe bearings, so a reprojection layer can bolt on later when something needs it
(the mount translation pHC would need it — deferred; see 07).
⚑ gauge safety by construction — the honest-covariance story survives — apply a global yaw
shift about gravity to the whole state: both δθj and δθA feel the same γ, and
the two H-blocks cancel it exactly — H·δx ≡ 0 at any linearization point, not just at
convergence. The update is physically incapable of manufacturing absolute-yaw information, so the
unobservable direction stays honestly unobservable and no FEJ/OC-EKF patch-up is needed. What vision
does observe is the yaw drift rate — equivalently bg — which converts yaw
error from a t3/2 gyro-bias random walk into a slow anchor-hop random walk
(a few mrad per lap). Drift is slowed honestly, not hidden.
THE FRONT-END RIDING THE LAP renders/stage2_loopcam.png · six keyframes across the 24 s loop
t = 0 → 23.8 s, ~150 live tracks per keyframe (green) · the scene rotates through the full 360° while the tracker hands anchors forward · walls and pillars carry the rotation estimate; the floor grain supplies volume (and is the realism caveat in 07)
04 VERIFY BEFORE TRUST scripts/check_projection.py · scripts/check_vio_jacobian.py — GT checks the code, never feeds it
A VIO pipeline is a convention minefield — GL-vs-CV camera axes, quaternion order, row-vs-column
rotations, R-vs-Rᵀ from the solver — and every one of those bugs produces plausible-looking garbage.
Two cheap instruments were built before the fusion was allowed to run.
THE CONVENTION CANARY — PROJECT WHAT YOU KNOW renders/stage2_projection.png
19 known landmark centers, projected through GT pose → encoder-FK extrinsics → intrinsics K → pixels · every ring sits on its landmark, so the whole chain — GL→CV flip F=diag(1,−1,−1), quat order, R vs Rᵀ, fx=fy=342.76 — is simultaneously right · ground truth is used to check the code here, never to feed the estimator
the analytic H against numerical differentiation of the true measurement function: perturb one
error dimension by ε, re-evaluate the residual, compare slopes. Both rotation blocks agree to
~1e-10 — the same discipline every Stage-1 Jacobian passed (~1e-7).
And the war story: the first version of the check itself was wrong. It perturbed the
estimate — but the residual is built from log(ĥᵀz), so perturbing ĥ probes the transposed
direction and the δθA column came out sign-flipped. The FD reference must perturb the
true state (the z = h(xtrue) side) while the prediction stands still.
the check needed checking — an FD harness is code too; when analytic and numeric disagree, suspect both
scripts/check_vio_jacobian.py — H (3×21) vs FD, ε-sweep over δθ and δθ_A
ⓘ the trust ladder — conventions (canary, pixel-exact) → geometry (front-end rotation scored
against GT: median error, bias, inlier health) → calculus (FD on the fusion Jacobian) → only
then the filter. Each rung is minutes to run and each would have silently corrupted everything
above it. The one GT-facing tool in the repo exists to score and audit, never to feed.
05 A REAL BUG — THE GYRO BIAS THAT RAN AWAY ON TURNS found while standing up the loop baseline · scripts/run_vio.py
BEAT 1 · SYMPTOM✗ RUNAWAY
bg WALKS OFF ON THE LOOP
ESKF · NO VISION YET
before vision was even fused, the Stage-1 ESKF replayed on the new loop showed its
gyro-bias estimate sliding steadily away instead of settling — and position drift
followed it. Same filter, same tuning, same noise model that behaved on every straight walk.
a filter that was consistent on one trajectory is not automatically consistent on another
▸
BEAT 2 · ISOLATE⌖ ABLATE
NOT DURATION · NOT THE SLIP BIAS
CONTROLLED REPLAYS
a straight walk of the same 24 s length: bg fine — not duration.
The Stage-1 slip-bias state bc in or out: same runaway — not the slip machinery.
The divergence tracked one variable only: whether the robot was turning.
change one thing at a time — the bug named itself in two replays
▸
BEAT 3 · CAUSE⚠ OVER-TRUST
CONTACT OVER-TRUSTED ON TURNS
σcontact = 0.05 m/sTOO TIGHT HERE
a turning stance foot pivots — it slips and rolls more than a straight-walking foot, so the
contact model's residual systematic is larger on the loop. At the straight-walk noise setting the
filter believes the contact too much and files the extra systematic where over-trusted
filters always file it: into the least-observable state, bg. Stage 1's lesson,
reprised at higher amplitude.
an over-trusted measurement doesn't fail loudly — it quietly poisons whatever the data can't defend
▸
BEAT 4 · FIX✓ LANDED
SCALE THE TRUST WITH THE MOTION
σcontact 0.05 → 0.15 m/s
loosen the contact-measurement noise for the loop and bg settles; the blind ESKF lands
at ~0.5 % (5-seed median) — a fair baseline for vision to beat. The honest reading:
contact-measurement noise must scale with the motion — a fixed σ tuned on gentle data is a
latent bug, and a motion-scheduled (turn-rate-aware) σcontact is the obvious refinement
this leaves on the table.
both loop filters (ESKF + VIO) run the loosened contact trust — vision's win in 06 is not this fix in disguise
⚑ the recurring failure shape — Stage 1: a ~7 mm/s foot slip, over-trusted, corrupted
bg y by +2.53 mrad/s. Stage 2: turning slip, over-trusted, ran bg away
entirely. Same mechanism, caught much faster the second time — because the bias-error plots and the
consistency habit already existed. Estimator debugging compounds: every diagnostic you build keeps
paying.
06 THE WIN — THE LOOP, CLOSED scripts/run_vio.py · figure: 3 laps / 72 s / 62.3 m (multilap) · table: 24 s single lap, 5-seed medians
GROUND TRACKS — GT vs LEG-ODOM vs ESKF vs VIO · 3 LAPS interactive — hover for the live gap · click the legend to toggle traces · run_vio.py multilap
3 laps · 72 s · 62.3 m path · an uncalibrated gyro bias (bg,z ≈ 0.23°/s — the live-drift monitor's setup) so the drift the estimators must fight is realistic · the ESKF ring spirals outward lap over lap; VIO re-closes every lap (close-gap 11 cm vs ESKF 45 · leg-odom 99) · careful with amber: leg-odom looks glued to the rail mid-lap, but that is closed-loop geometry partially cancelling its heading drift — its yaw error is the worst of the three (16.9° by lap 3) and its close-gap the largest · the numbers that can't be fooled — per-instant gap medians over the 3 laps: leg-odom 70 cm · ESKF 32 · VIO 30; a track plot hides along-track error (track ≠ trajectory) · note all three touch ~1 m mid-lap-3 — absolute position is unobservable for everyone; the difference is that VIO's errors stop compounding (yaw fenced → re-closes to 11 cm) while leg-odom's rotation keeps compounding to 99 · hover the live chart to read the per-estimator gap at any instant; the single-lap 24 s numbers in the table below are unchanged for continuity
DRIFT VS TIME — 3 LAPS renders/stage2_vio_3lap_drift.png · seed 0
the left panel is the whole Stage-2 thesis in one picture: yaw drift is unbounded for the IMU-only estimators (leg-odom 6.5 → 12.9 → 16.9° at lap ends · ESKF 4.9 → 7.8 → 7.2°) and bounded for VIO (1.6 → 0.1 → 1.2°) — vision pins the drift rate, so the error stops compounding · position error (right) oscillates over a closed lap and re-converges where the yaw history cancels
SCORES — CLOSING THE 20.8 m LOOP 5-seed medians · drift = err / path
estimator
heading comes from
drift
final err
bg,z error
leg-odom · gyro attitude
∫ raw gyro — dead reckoning
0.12 %
2.5 cm
— (not estimated)
ESKF · IMU + contact
gravity levels tilt · yaw coasts
0.49 %
10.2 cm
+1.7 mrad/s (blind)
VIO · + anchored rotation
vision measures the yaw drift
0.15 %
3.1 cm
≤0.42 mrad/s
24 s lap · r ≈ 3.3 m · full 360° of yaw · 20.8 m path · figure: seed 0 · table: 5-seed medians ·
front-end delivered ~34 SO(3) measurements over the lap at ~2 mrad median accuracy · vs the blind
ESKF ≈ 3.3× less drift (0.49 → 0.15 % median, every seed). Leg-odom's single-lap close-gap flatters
it — a full 360° lap partially cancels smooth heading drift and this dataset's bias draws are small;
its yaw error is unbounded across laps (17° in 3 laps vs VIO ~1° — the interactive chart above) and it
estimates no biases and carries no covariance.
read the last column first: the ESKF's bg,z is not "badly estimated" — it is
unobservable, the filter simply keeps whatever the random walk dealt it. One rotation
measurement stream later the error is ≤0.42 mrad/s on every seed. That column is Stage 2's whole
thesis made numerical.
≤0.42 mrad/s
bg,z error — the stage-1-unobservable state, pinned
⚑ the headline — vision observed the thing that was provably invisible — Stage 1 ended on a
proof: no amount of IMU + contact data can learn bg,z or absolute yaw. Stage 2
added ~three numbers per 0.7 s of the one quantity a camera measures well — rotation — and the
forbidden state snapped to ≤0.42 mrad/s while loop drift held ~0.15 %,
~3.3× under the blind ESKF (5-seed median). And it did so without claiming absolute yaw: the update is
gauge-blind by construction, so the covariance still tells the truth about what remains unknown.
Missing information was added — not invented.
07 KNOWN LIMITS → WHAT'S NEXT say what's still not right · docs/STAGE2_VIO_DESIGN.md — deferred list
⚠ honest residuals — what this win does not claim —
(1) the front-end was ~8 mrad (7.69 median) — since sharpened to ~2 mrad (IRLS refit, see the front-end deep dive): as originally built, median rotation error
vs GT came in ~3× above the ideal set by 1-px tracking at fx ≈ 343 (≈ 2.9 mrad/bearing); good
enough for this loop, but subpixel refinement and stricter track curation are real headroom — and it
meant the vision-noise setting ran optimistic. The IRLS refit on all inliers recovered the √N
averaging the 5-point minimal model throws away, cutting it to ~2 mrad (bias ~0.4) — so σvis
is now measured, not optimistic, and VIO wins across seeds at honest noise.
(2) the front-end leans on floor texture: the procedural concrete is generous — dense,
high-contrast, never blurred; on a real robot, motion blur, exposure swings and genuinely bland floors
would thin those tracks. The fusion math is untouched by this caveat; the measurement supply
is where sim flatters.
(3) absolute yaw is still unobservable — by design: this update measures the yaw drift
rate, so heading error now random-walks slowly across anchor hops instead of growing t3/2;
only a persistent map / loop-closure relocalization buys an absolute bound, and that is deliberately
deferred.
(4) carried from Stage 1: the contact residual is still colored (NIS lag-1 ≈ +0.85) — the
vision update neither fixes nor worsens it, and the InEKF consistency rebuild stays parked.
Multi-seed (5) loop eval now: VIO beats the ESKF on every seed; the M=10 harness extension rides along.
⚑ the through-line → stage 3, online auto-calibration — sustained yaw makes the
camera-mount rotation error δφHC observable from this same measurement stream
(it enters the residual as (I − Adj(R̃))·δφ — zero under no rotation, alive on the loop), so
rotation-extrinsic self-calibration comes almost free. But the mount translation
pHC cannot appear in a rotation-only measurement at all — so Stage 3 calibrates the rotation
extrinsic + the time offset td from this same rotation stream, starting from a deliberately
mis-calibrated guess; pHC stays deferred to a reprojection layer (the per-keyframe bearings
are already persisted for it). Same discipline as this
page: prove the information exists, then go get it.
VioESKF: stochastic clone 18→21 · SO(3) update · gauge-safe by construction · χ²(3) gate
STEP 5✅ DONE
The Loop Result
VIO 0.15% vs ESKF 0.49% median · bg,z ESKF ~1.7 → VIO ≤0.42 mrad/s · every seed · turn-slip σ lesson
STAGE 3✅ DONE
Online Auto-Calib
camera-mount extrinsic recovered online from an injected 3.1° error · ▸ deep dive
stage-2 verdict — the missing information was identified by proof, added by the
narrowest possible measurement, verified before it was trusted, and it moved exactly the numbers the
proof said it would: bg,z pinned, loop drift ~0.15 %. Absolute yaw stays honestly
unknown · consistency machinery carried, not bypassed · next: make the estimator calibrate its own
camera — ▸ back to the dashboard roadmap