Skip to content

feat: SimBackend unified model property API - #176

Merged
TATP-233 merged 2 commits into
mainfrom
feat/unified-backend-model-api
Apr 9, 2026
Merged

TATP-233 merged 2 commits into
mainfrom
feat/unified-backend-model-api

Conversation

@TATP-233

@TATP-233 TATP-233 commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add 7 unified abstract methods to SimBackend base class: num_actuators, num_dof_vel, get_actuator_ctrl_range(), get_keyframe_qpos(), get_init_qvel(), get_body_ids(), get_joint_range()
  • Implement in both MuJoCoBackend and MotrixBackend, normalizing API differences (e.g. ctrl range shape transposition, keyframe access patterns)
  • Refactor G1/Go1/Go2 base.py: replace all hasattr(model, ...) branches with unified backend calls, remove import mujoco dependency
  • Refactor tracking.py: use get_body_ids() for body ID resolution and get_joint_range() delegation
  • Add 158 lines of tests covering both backends and cross-backend consistency

Test plan

  • ruff check passes on all changed files
  • pyright passes with 0 errors
  • pytest — 568 passed, 0 failures (includes new model property tests + cross-backend consistency)

Closes #131

Add abstract methods (num_actuators, num_dof_vel, get_actuator_ctrl_range,
get_keyframe_qpos, get_init_qvel, get_body_ids, get_joint_range) to
SimBackend base class with implementations in MuJoCoBackend and
MotrixBackend. Refactor G1/Go1/Go2 base.py and tracking.py to use the
unified interface, eliminating all hasattr(model, ...) branches that
leaked backend differences into environment code.

Closes #131
Add explicit type annotations for intermediate variables and use
np.array with dtype instead of np.asarray to satisfy mypy's
no-any-return checks on untyped third-party model attributes.
@TATP-233
TATP-233 merged commit b1c8fa7 into main Apr 9, 2026
5 checks passed
@TATP-233
TATP-233 deleted the feat/unified-backend-model-api branch April 9, 2026 16:00
TATP-233 added a commit that referenced this pull request May 4, 2026
feat: SimBackend unified model property API
TATP-233 added a commit that referenced this pull request May 30, 2026
feat: SimBackend unified model property API
TATP-233 added a commit that referenced this pull request Sep 4, 2026
feat: SimBackend unified model property API
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.

Work: SimBackend 统一模型属性接口 — 消除环境层 hasattr 分支

2 participants