-
Notifications
You must be signed in to change notification settings - Fork 0
Task/Simplify SDK wrapper: Add backend registry with auto-discovery #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryThis PR introduces a plugin-style backend registry with automatic discovery, eliminating the need to manually update coordinator code when adding new robot backends. The refactoring also standardizes unit conversion patterns across backends and renames "orchestrator" to "coordinator" throughout the codebase. Key Changes:
Issues Found:
The registry pattern is well-designed and significantly simplifies adding new backends. The unit conversion standardization improves code maintainability. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Coordinator as ControlCoordinator
participant Registry as BackendRegistry
participant PkgUtil as pkgutil
participant Backend as XArmBackend
User->>Coordinator: start()
Coordinator->>Coordinator: _setup_from_config()
Coordinator->>Coordinator: _create_backend(component)
Coordinator->>Registry: backend_registry.create("xarm", ...)
alt First call - discovery needed
Registry->>Registry: _discover()
Registry->>PkgUtil: iter_modules(dimos.hardware.manipulators)
PkgUtil-->>Registry: ["mock", "piper", "xarm", ...]
loop For each subpackage
Registry->>Registry: importlib.import_module("dimos.hardware.manipulators.xarm.backend")
Registry->>Backend: hasattr(module, "register")
Backend-->>Registry: True
Registry->>Backend: module.register(self)
Backend->>Registry: registry.register("xarm", XArmBackend)
end
Registry->>Registry: _discovered = True
end
Registry->>Backend: XArmBackend(**kwargs)
Backend-->>Registry: backend instance
Registry-->>Coordinator: backend instance
Coordinator->>Backend: backend.connect()
Backend-->>Coordinator: True
Coordinator->>Coordinator: add_hardware(backend, component)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 3 comments
c66963b to
35d740c
Compare
| TaskName = str | ||
|
|
||
|
|
||
| class HardwareType(Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used and what is difference between manipulator and gripper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grippers are parallel jaw grippers, dextrous hands etc. manipulators are just the 6-dof arms.
I have kept the current xarm gripper integrated with the manipulator for now. Can be separated later.
|
|
||
|
|
||
| @dataclass | ||
| class HardwareComponent: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default shouldnt we build this from URDF automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes by default.
As a feature, the URDF should be the only source of truth for the robot config. A user should only need to modify their existing robot_descriptions and the control module, the manipulation module and the sim module would use as a source.
|
Super hard to read since 80% of the diff is just the name changes |
|
Need to in future actually PR the stuff relevant to the PR not unrelated sematnic changes |
35d740c to
4f6d4dc
Compare
…oint type classes
Every backend must implement its own conversion based on the sdk.
4f6d4dc to
3c0bfb0
Compare
Simplify SDK wrapper: Add backend registry with auto-discovery and unified hardware schema
Backend Registry with Auto-Discovery: Added registry.py that auto-discovers manipulator backends using pkgutil.iter_modules(). Adding a new robot backend now only requires creating a subpackage with a register() function - no need to edit the coordinator.
Consistent Unit Conversion Pattern: Standardized unit conversion constants at module level (MM_TO_M, RAD_TO_MILLIDEG, etc.) instead of inline magic numbers or static methods.