Skip to content

BB.Error.Invalid.Bridge.* modules collide between feetech and robotis drivers #145

Description

@jimsynz

Summary

bb_servo_feetech and bb_servo_robotis each define the same four fully-qualified error modules in the BB.Error.* namespace (owned by bb core):

  • BB.Error.Invalid.Bridge.InvalidParamId
  • BB.Error.Invalid.Bridge.ReadOnly
  • BB.Error.Invalid.Bridge.TorqueMustBeDisabled
  • BB.Error.Invalid.Bridge.UnknownParam

The definitions are byte-identical apart from the copyright year and a couple of words in the doc strings (Feetech/Dynamixel, firmware version/model number, firmware version).

Why it matters

A mixed-hardware robot driving both a Feetech bus and a Dynamixel bus — a perfectly plausible build — pulls both deps into one application. The BEAM loads whichever module compiles last, emits a "redefining module" warning, and silently discards the other definition. Any pattern match or is_struct/2 check against the discarded module's doc-string wording is now load-order dependent. The two modules happen to be behaviourally equivalent today, so this is latent rather than actively broken — but it's a collision in a namespace neither package owns.

Broader context

These two drivers are structural twins: identical file trees, ~750-line controllers sharing logic with drift, plus duplicated bridge.ex (207 vs 216 lines) and param_metadata.ex (164 vs 229 lines). The bus-servo pattern is now proven across feetech, robotis, and the bridge/param-metadata scaffolding in each — past the three-implementations threshold.

Options

  1. Move the shared BB.Error.Invalid.Bridge.* modules into bb core. Smallest fix for the collision itself; both drivers depend on bb already. Resolves the namespace ownership cleanly without committing to a larger extraction.
  2. Extract a bb_servo_bus library holding the shared bridge behaviour, param-metadata scaffolding, and error modules, with feetech/robotis as thin hardware-specific layers. Addresses the structural duplication too, but is a bigger commitment.

Recommend (1) now to kill the collision, and treat (2) as a separate decision once the shared surface is better understood.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions