Make GIF/MP4 export faithful to the recorded trace (deep-dive fix) - #14
Merged
Conversation
…nding) Deep empirical sweep of the recently enabled features. Most paths verified OK (multi-level kinematic trees, root detection regardless of part order, mutate / offline-tool-policy validity over 2000 iters, no NaN scores under aggressive dynamics, special-char ids, contact-pool overflow). One real fidelity bug: render_trace rebuilt the jointed multibody and reconstructed link poses via forward-kinematics from recorded joint angles (set_pose), discarding the recorded per-link positions. Position-controlled joints deviate from rigid FK under load, so the export drifted up to ~5.6cm off on the tripod and disagreed with the faithful Viser `view`. Fix: render each part as an independent mass-0 visual body posed directly from frame.parts (exactly what the viewer does) — export is now faithful to the trace and consistent with `view`. Removes the now-unused set_pose() and _root_id. Added a regression test (a fixed-joint creature whose trace poses its parts independently still renders, proving the path is parts-driven, not FK-driven). All green: ruff, ruff format --check, pytest (132). https://claude.ai/code/session_01EcH4uu86dMEDrd6TzyAExd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A deep, empirical bug hunt (building edge-case creatures and exercising the whole system, not just re-reading). Most paths held up; one real fidelity bug found and fixed.
Verified OK (no change needed)
torso→thigh→shin) compose correctly — parent/link indexing and anchor chaining are right, and the root is detected regardless of part order in the list.mutateand the offline tool policy produced 0 invalid creatures / 0ToolErrors over 2000 iterations each.DD1 —
exportwas not faithful to the trace (fixed)render_tracerebuilt the jointed body and reconstructed link poses via forward-kinematics from recorded joint angles (set_pose), discarding the recorded per-link positions. Position-controlled joints sag/lag under load, so FK ≠ the recorded dynamics — on the example tripod the exported limbs were up to ~5.6cm off, and the GIF/MP4 disagreed with the faithful Viserview.Fix:
render_tracenow draws each part as an independent mass-0 visual body posed directly fromframe.parts— exactly what the Viser viewer does — so export is faithful to the trace and consistent withview. This also removed the now-unusedset_pose()method and_root_id.Verification
ruff,ruff format --check,pytestall green — 132 tests (added a regression test: a fixed-joint creature whose trace poses its parts independently still renders, proving the render path is parts-driven, not FK-driven).Minor follow-ups (noted, not changed)
EpisodeSummary.forward_displacementis centroid-based while the score's forward term is base-based; the viewer's contact-marker pool caps at 16.