Skip to content

sync_read does not detect partial motor failures (missing isAvailable check) #11

@Escenda

Description

@Escenda

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:

  1. Detect which motors are responding
  2. Show errors for disconnected/failed motors
  3. Continue operating with the motors that are still working

Currently, we cannot reliably detect partial failures.

Proposed Solution

  1. Add isAvailable() check in _sync_read()
  2. Return None or a sentinel value for motors that didn't respond
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions