dimensionalOS / dimensionalOS/dimos
ConnectedHardware → Protocol; rename current class to ConnectedManipulator
@mustafab0 is already working on this.
Since May 2, 2026.
- Dominant language
- Python
- Stars
- 4.5k
- Forks
- 808
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 233
Description
Problem
ConnectedTwistBase and ConnectedWholeBody both inherit from ConnectedHardware and override .adapter with # type: ignore[override] — a Liskov Substitution Principle violation mypy is being told to swallow. Parent claims .adapter -> ManipulatorAdapter; subclasses return totally different types. Latent crash: any code that reaches connected.adapter.set_control_mode(...) on a non-manipulator instance fails at runtime.
The current ConnectedHardware class is itself misnamed — its read_state / write_command are manipulator-specific (POSITION/VELOCITY/TORQUE mode switching, read_joint_positions(), etc.). The "Hardware" name only fit when manipulators were the only kind.
Proposed fix
- Make
ConnectedHardwarea@runtime_checkable Protocolwith the truly common surface:hardware_id,joint_names,dof,component,read_state(),write_command(),disconnect()..adapteris intentionally not on the Protocol — concrete classes expose it with their own adapter type; callers must narrow. - Rename current concrete
ConnectedHardware→ConnectedManipulator. ConnectedTwistBaseandConnectedWholeBodystop inheriting; satisfy the Protocol structurally as siblings.
Protocol (not ABC) because the three classes share almost no implementation — _initialize_last_commanded and write_command are fundamentally different per kind.
Why it matters
- Removes a known latent runtime crash.
- Drops three
# type: ignore[override]from the codebase, no replacements. - Names match reality; new hardware types just implement the Protocol.
Origin: PR #1954 review comment from @paul-nechifor.
Synced from DIM-832 by summer
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.