Skip to content

refactor(robots): extract reusable model configurations and assets - #101

Merged
wlgys8 merged 1 commit into
mainfrom
refactor/robot-model-package
Oct 7, 2026
Merged

wlgys8 merged 1 commit into
mainfrom
refactor/robot-model-package

Conversation

@wlgys8

@wlgys8 wlgys8 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR 2 of the robot/deployment refactor, independently based on main after PR #100.

  • Extract reusable simulation robot configurations and their MJCF/URDF, mesh and texture assets into the core-only motrix-robots workspace package.
  • Keep all seven models' existing configuration, key poses, actuator parameters and public registry IDs unchanged (anymal_c, dex-evt, g1-29dof, go1, go2, k1, microduck).
  • Discover installed robot plugins lazily in motrix_env_core.registry through the motrix_env_core.robots entry-point group. motrix-robots declares builtin = "motrix_robots.registration:register"; applications need no explicit registration imports. Direct builtin model imports still do not discover plugins, import training/simulators or read assets.
  • Expose robot and helper types through the deliberate motrix_robots public API (from motrix_robots import Microduck, UnitreeGo2Robot). Model modules and model assets are flat at package root; internal consumers import definition modules directly. Remove the old motrix_envs.robot forwarding modules, without compatibility aliases.
  • Update training, view/replay/converter scripts, existing deployment-profile consumers, robot documentation generator and model resource references.
  • Compose ANYmal and Go1 task-owned scenes with extracted robot configurations; Go1 stairs keeps its motor-actuator model, native solver options and initial state. Keep task terrain XML/materials/heightmaps and motphys-ground.png in motrix_envs, not in the robot package. Motion conversion uses the G1 model-only XML rather than a ground-scene wrapper.
  • Update workspace/dependency metadata, asset notices and bilingual documentation.

Scope

This is ownership and packaging work only. It does not include deployment runtime/task/artifact changes, Unitree hardware configuration extraction, new sensor declarations, SimCfg changes, robot-ID renaming or robot tuning. PR #100 actuator code is unchanged. The source big branch is preserved.

Most changed files are asset renames. The model package depends only on motrix-env-core; motrix-envs depends on motrix-robots.

Review and preservation

An independent read-only subagent reviewed the settled implementation and approved it with no material findings.

  • All seven builtin model configurations match the baseline except relocated model-file paths.
  • Original extraction verified 256 robot/Go1/shared-texture assets, including expanded LFS content against original SHA256 identifiers. Subsequent review keeps only model assets in the robot package: terrain/materials/heightmaps remain in environments, the duplicate ground texture is removed, and unused G1/Dex-EVT ground-scene wrappers are removed. Relocated model assets and terrain binaries preserve their content.
  • All XML/URDF include, mesh and texture dependencies resolve inside the new package.
  • Independently reconstructed the original ANYmal XML scene and compared it with composition through the extracted model: identical initial DOF vector and body/geom/actuator/sensor counts.
  • Deliberately excluded the unrelated Go1 accelerometer and Go2 hardware lie_down pose additions from the source big branch.

Validation

  • Independent source-isolated review suite: 128 passed.
  • Model package suite: 31 passed; affected consumer suites: 121 passed.
  • Built both robot and environment wheels; imported all seven robot configurations from the wheel layout and compiled all seven with MuJoCo successfully.
  • CI-pinned Ruff 0.15.16 formatting check, all pre-commit hooks, lockfile check and diff whitespace checks passed.
  • Strict full English and Chinese Sphinx builds and robot documentation generator --check passed.
  • Initial package-extraction broad integration suite: 783 passed, 3 skipped, using worktree source and matching baseline plugin metadata. An earlier CLI failure was traced to locally installed plugin metadata from the source big branch; corrected test isolation without source changes.
  • After adding automatic robot discovery: 335 tests passed (core, models, scene/robot consumers and CLI/view), plus 46 independent review tests passed. Rebuilt-wheel smoke test constructs go2 from core alone and lists all seven IDs without importing training or simulators.
  • After flattening the public API, removing forwarding modules and separating task resources: 395 tests passed; final robot/environment wheels successfully load root model exports and compile Go1 stairs with unchanged motor controls and solver options. CI-pinned format check, all hooks, lock check and strict English/Chinese Sphinx builds passed again. Independent review additionally compared native stairs options/state/control/sensor semantics and G1 model-only FK with baseline.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Although no concrete defects were found, the change is very large (200+ relocated assets, a new core discovery subsystem, and a behavioral ANYmal scene-composition change) and warrants final human review.

0 open findings

What changed in this PR

This PR is step 2 of a robot/deployment refactor (following merged PR #100). It extracts the seven built-in simulation robot configurations and their MJCF/URDF, mesh, and texture assets out of motrix_envs into a new core-only motrix-robots workspace package, and switches robot registration from import-time side effects to lazy entry-point discovery in motrix_env_core.registry (group motrix_env_core.robots). Public registry IDs, key poses, actuator parameters, and motrix_envs.robot import paths are preserved (the latter as thin forwarding facades), so the change is primarily ownership/packaging rather than behavior.

Changes:

  • Add motrix-robots package (config classes, builtins/* robot definitions, relocated LFS assets, entry-point registration.register) and wire it into workspace/lock metadata.
  • Add lazy robot discovery to the core registry and migrate internal consumers (scripts, tests, ANYmal task scene composition) to import robot classes from motrix_robots.builtins.*.
  • Update bilingual READMEs/docs and package counts (twelve → thirteen).
File Description
motrix_robots/​pyproject.toml New package metadata, core-only dep, motrix_env_core.robots entry point.
motrix_robots/​src/​.../​registration.py Entry-point callback registering the seven preserved robot IDs.
motrix_robots/​src/​.../​builtins/​{quadruped,humanoid}.py Relocated model-config base classes with validation.
motrix_robots/​src/​.../​builtins/​assets/​**, common/​*.png Relocated LFS MJCF/URDF/mesh/texture assets (incl. texture-path fixes).
motrix_robots/​tests/​test_assets.py Asserts bundled XML/URDF mesh/texture references form a package-local closure.
pyproject.toml, uv.lock Register motrix_robots as workspace member/source.
scripts/​motion/​replay.py, scripts/​private/​* Import robot classes from motrix_robots.builtins.*.
tests/​test_view_script.py Import UnitreeGo2Robot from the new package.
README.md, README.zh-CN.md Document the new package and update the package count.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@wlgys8
wlgys8 force-pushed the refactor/robot-model-package branch from 3518cf7 to c6aa573 Compare October 7, 2026 17:01
@wlgys8
wlgys8 merged commit 72ef650 into main Oct 7, 2026
6 checks passed
@wlgys8
wlgys8 deleted the refactor/robot-model-package branch October 13, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants