Skip to content

Introduce RobotDef protocol and robot registry#268

Draft
yuecideng wants to merge 7 commits into
mainfrom
feat/robot-definition-protocol
Draft

Introduce RobotDef protocol and robot registry#268
yuecideng wants to merge 7 commits into
mainfrom
feat/robot-definition-protocol

Conversation

@yuecideng
Copy link
Copy Markdown
Contributor

Description

This PR introduces a RobotDef protocol and registry-driven robot definition flow for simulation robots, and migrates existing robot definitions to the new interface.

Motivation and context:

  • Standardize robot definition contracts across robot implementations.
  • Enable name-based robot lookup/instantiation through a central registry.
  • Improve maintainability by separating robot definition data from module wiring.

Dependencies: None.

Related issue: N/A (no linked issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Not applicable.

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

🤖 Generated with Claude Code

yuecideng and others added 7 commits May 13, 2026 02:13
Introduce a runtime-checkable RobotDef protocol that defines the
contract for robot definitions in EmbodiChain. The protocol specifies
required properties (name, urdf_cfg, control_parts, solver_cfg,
drive_pros, attrs) and a build_cfg method that converts a RobotDef
into a RobotCfg with support for property copying and merge overrides.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds a global robot registry (register_robot, get_robot_def, build_robot_cfg)
so callers can reference robots by string name without knowing import paths.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Refactor CobotMagic to implement the RobotDef protocol and register it
in the global robot registry under the name "CobotMagic". All existing
configuration values (URDF paths, transforms, control parts, solver
configs, drive properties, rigid-body attributes) are preserved exactly.

CobotMagicCfg.from_dict() continues to work as a backward-compatible
wrapper that delegates to CobotMagicDef().build_cfg(). The __init__.py
exports both CobotMagicDef and CobotMagicCfg.

Tests added:
- test_cobotmagic_def_builds_valid_cfg: verifies uid, urdf_cfg,
  control_parts, solver_cfg
- test_cobotmagic_def_registry: verifies get_robot_def("CobotMagic")
  works and produces correct cfg
- test_cobotmagic_backward_compat_from_dict: verifies the legacy
  CobotMagicCfg.from_dict({}) path still works

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add DexforceW1Def implementing the RobotDef protocol, registered as
"DexforceW1" in the global robot registry. The existing DexforceW1Cfg
class retains backward compatibility by delegating from_dict to
DexforceW1Def.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@yuecideng yuecideng added enhancement New feature or request robot Module related to robot dexsim Things related to dexsim docs Improvements or additions to documentation labels May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dexsim Things related to dexsim docs Improvements or additions to documentation enhancement New feature or request robot Module related to robot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant