Problem
sync_read does not check isAvailable() before calling getData(), making it impossible to detect partial motor failures in a sync read operation.
Current Behavior
In motors_bus.py line 1118:
values = {id_: self.sync_reader.getData(id_, addr, length) for id_ in motor_ids}
When a motor fails to respond during sync_read:
- The overall
comm result may still be COMM_SUCCESS if other motors responded
getData() returns 0 for non-responding motors
- This
0 is indistinguishable from a valid position value of 0
Expected Behavior
The implementation should check isAvailable() before calling getData():
values = {}
for id_ in motor_ids:
if self.sync_reader.isAvailable(id_, addr, length):
values[id_] = self.sync_reader.getData(id_, addr, length)
else:
values[id_] = None # or raise, or handle differently
Use Case
When building real-time motor position streaming (e.g., for calibration UI), we need to:
- Detect which motors are responding
- Show errors for disconnected/failed motors
- Continue operating with the motors that are still working
Currently, we cannot reliably detect partial failures.
Proposed Solution
- Add
isAvailable() check in _sync_read()
- Return
None or a sentinel value for motors that didn't respond
- Or add a new parameter like
partial_failure_mode to control behavior
Related Code
src/lerobot/motors/motors_bus.py - _sync_read() method (line 1095-1119)
- scservo_sdk
GroupSyncRead.isAvailable() - available but not used
Problem
sync_readdoes not checkisAvailable()before callinggetData(), making it impossible to detect partial motor failures in a sync read operation.Current Behavior
In
motors_bus.pyline 1118:When a motor fails to respond during
sync_read:commresult may still beCOMM_SUCCESSif other motors respondedgetData()returns0for non-responding motors0is indistinguishable from a valid position value of0Expected Behavior
The implementation should check
isAvailable()before callinggetData():Use Case
When building real-time motor position streaming (e.g., for calibration UI), we need to:
Currently, we cannot reliably detect partial failures.
Proposed Solution
isAvailable()check in_sync_read()Noneor a sentinel value for motors that didn't respondpartial_failure_modeto control behaviorRelated Code
src/lerobot/motors/motors_bus.py-_sync_read()method (line 1095-1119)GroupSyncRead.isAvailable()- available but not used