feat(humanoid-walk): holosoma-parity g1-walk-flat recipe with reset-time dynamics randomization - #91
Conversation
d6584d9 to
8d5c98c
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It spans a core sim-API rename, numba-kernel compilation semantics (a latent build failure for partially-disabled randomization configs), and an RL recipe change whose committed dt contradicts the PR description, warranting human review.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
This PR aligns the g1-walk-flat FastSAC recipe with holosoma's g1_29dof_fast_sac configuration by adding reset-time dynamics randomization. It introduces a new WalkRandomizationCfg (kp/damping/friction/mass/base-com randomized in-kernel at reset via the sim write program), per-episode gait-period jitter, a per-lane action-delay queue, and a BadDofVelocityTerminationCfg. Supporting this, it renames the single-link sim queries/writes to a Link* namespace and adds a tree-scoped BodyMassesQuery to the backend-neutral sim contract.
Changes:
- Rename
BodyMass*/BodyCom*/BodyCenterOfMass*queries & writes toLink*, addBodyMassesQuery(core contract + MotrixSim backend) returning a body tree's nominal link masses in tree order. - Add reset-time domain randomization (
WalkRandomizationCfg+ dedicated randomized reset kernel), gait-period jitter (WalkCommandCfg.gait_period_randomization_width), action-delay config, andBadDofVelocityTerminationCfg. - Retune the
g1-walk-flatrecipe/config (action scale 0.25, alpha/entropy, 30k iterations) and addtest_walk_randomization.py.
| File | Description |
|---|---|
motrix_env_core/src/.../sim/model.py |
Rename to LinkMassQuery/LinkCenterOfMassQuery, add BodyMassesQuery + abstract compile_body_masses. |
motrix_env_core/src/.../sim/write.py |
Rename BodyMassWrite/BodyComWrite → LinkMassWrite/LinkComWrite; document Link/Body naming. |
motrix_env_core/src/.../sim/__init__.py |
Update exports for renamed/new query types. |
motrix_env_core/src/.../mdp/terminations.py |
Add BadDofVelocityTerminationCfg + kernel (not wired into any recipe; duplicates WBT name). |
motrix_env_motrixsim/src/.../runtime.py |
Rename compile hooks; implement compile_body_masses (tree-order link masses). |
motrix_env_motrixsim/src/.../write_compiler.py |
Rename compile_link_mass/compile_link_com. |
motrix_envs/src/.../humanoid/walk_manager_mdp/randomization.py |
New WalkRandomizationCfg with range validation. |
motrix_envs/src/.../humanoid/walk_manager_mdp/reset.py |
New randomized reset kernel + param assembly; conditional write declaration. |
motrix_envs/src/.../humanoid/walk_manager_mdp/command.py |
Per-lane phase_step buffer with gait-period jitter. |
motrix_envs/src/.../humanoid/cfg.py |
Wire randomization model queries when enabled. |
motrix_envs/src/.../humanoid/g1.py |
Enable full randomization stack on g1-walk-flat (sim still dt=0.01). |
motrix_envs/src/.../quadruped/walk_np.py |
Adopt renamed Link* queries/writes. |
configs/task/g1-walk-flat/motrix.fastsac.yaml |
Alpha/entropy parity + 30k iterations. |
motrix_env_core/tests/* |
Update dispatch tests for renamed hooks. |
motrix_envs/tests/test_walk_randomization.py |
New behavioral tests (some assert exact tuning values). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8d5c98c to
f6bf17d
Compare
f6bf17d to
3495ebf
Compare


Summary
Align the
g1-walk-flatfastsac recipe with holosoma'sg1_29dof_fast_sacconfiguration. Both nightly tracking gates pass under the full randomization stack: lin-vel exp 0.522 (gate >= 0.475), ang-vel exp 0.660 (gate >= 0.533) at 30k iterations.Recipe changes
Domain randomization (holosoma parity, push excluded)
WalkRandomizationCfgwith independently disable-able items, sampled in-kernel at reset through the sim write program:BodyMassesQuery(core contract + MotrixSim backend) returning a body's nominal link masses in body orderMapgetitem is statically compiled, so enabled configs declare a stable write-key schema; degenerate ranges perform no randomized writesWbtJointPositionActionCfg.action_delay_steps: per-lane control-step delay queue (resampled at reset); observations and the action-rate penalty keep tracking the raw undelayed actionsWalkCommandCfg.gait_period_randomization_width: per-episode gait-period jitter (±0.2 s) via a per-lanephase_dtbufferBadDofVelocityTerminationCfg: reusable core termination shared by WBT and other manager tasks; resets lanes whose joint speeds exceed any healthy gait after harsh impactsResults (30k iters, 25–30k window)
Training is stable under the joint perturbation stack (near-full episodes, zero collapses).
Test plan
test_walk_randomization.py(cfg validation, delay behavior, gait band, query wiring)test_humanoid_walk.py/test_wbt_numba.pysuites pass unchanged