File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -341,12 +341,23 @@ def add_hardware(
341341 component : HardwareComponent ,
342342 ) -> bool :
343343 """Register a hardware adapter with the coordinator."""
344+ from dimos .hardware .drive_trains .spec import TwistBaseAdapter as TwistBaseAdapterProto
345+
346+ is_base = component .hardware_type == HardwareType .BASE
347+ is_twist_adapter = isinstance (adapter , TwistBaseAdapterProto )
348+ if is_base != is_twist_adapter :
349+ raise TypeError (
350+ f"Hardware type / adapter mismatch for '{ component .hardware_id } ': "
351+ f"hardware_type={ component .hardware_type .value } but adapter is "
352+ f"{ 'TwistBaseAdapter' if is_twist_adapter else 'ManipulatorAdapter' } "
353+ )
354+
344355 with self ._hardware_lock :
345356 if component .hardware_id in self ._hardware :
346357 logger .warning (f"Hardware { component .hardware_id } already registered" )
347358 return False
348359
349- if component . hardware_type == HardwareType . BASE :
360+ if is_base :
350361 connected : ConnectedHardware = ConnectedTwistBase (
351362 adapter = adapter , # type: ignore[arg-type]
352363 component = component ,
You can’t perform that action at this time.
0 commit comments