Skip to content

Query servos directly for IsMoving instead of the isMoving atomic flag #22

Description

Salvaged from #8 (closed as stale — 26 commits behind main, wrong feetech base).

Today so101.IsMoving returns s.isMoving.Load() — an atomic flag we set/clear around our own motion calls (arm.go). That reports our intent to move, not the servos' actual state, so it can be wrong when motion is interrupted, when the arm is back-driven, or when a joint is still settling after the flag clears.

#8 proposed asking the hardware instead:

func (s *so101) IsMoving(ctx context.Context) (bool, error) {
    for _, servoID := range s.armServoIDs {
        moving, err := s.controller.IsServoMoving(ctx, servoID)
        if err != nil {
            return false, err
        }
        if moving {
            return true, nil
        }
    }
    return false, nil
}

Notes / open questions

  • Verify IsServoMoving exists / has an equivalent in feetech-servo v0.6.0 (main's current version; feat: enhance servo movement detection and motor configuration #8 was on 0.4.x).
  • This adds a serial round-trip per call — confirm callers (motion planner polling) tolerate the latency, or keep the atomic flag as a fast-path and only hit hardware when needed.
  • Should apply to the gripper (servo 6) as well as the arm servos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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