dimensionalOS / dimensionalOS/dimos

ConnectedHardware → Protocol; rename current class to ConnectedManipulator

Open
#1,960 0 comments 0 reactions 1 assignee View on GitHub

@mustafab0 is already working on this.

Since May 2, 2026.

chore manipulation
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

  1. Make ConnectedHardware a @runtime_checkable Protocol with the truly common surface: hardware_id, joint_names, dof, component, read_state(), write_command(), disconnect(). .adapter is intentionally not on the Protocol — concrete classes expose it with their own adapter type; callers must narrow.
  2. Rename current concrete ConnectedHardwareConnectedManipulator.
  3. ConnectedTwistBase and ConnectedWholeBody stop 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.