Skip to content

Comments

fix: calibration workflow when using robot_id with existing calibration files#1528

Merged
imstevenpmwork merged 5 commits intomainfrom
user/azouitine/2025-7-15-fix-calibration
Jul 20, 2025
Merged

fix: calibration workflow when using robot_id with existing calibration files#1528
imstevenpmwork merged 5 commits intomainfrom
user/azouitine/2025-7-15-fix-calibration

Conversation

@AdilZouitine
Copy link
Contributor

@AdilZouitine AdilZouitine commented Jul 17, 2025

What this does

This PR improves the calibration workflow when users provide a robot_id that has an associated calibration file. Previously, if there was a mismatch between the calibration values stored in the motors and those in the calibration file, users were forced to recalibrate from scratch. This was problematic in scenarios where:

  • Another user had used the arm and overridden the calibration values in the motors
  • Motor values had changed over time due to unknown factors

Changes

  • Added a calibration parameter to the calibrate() method across all robot and teleoperator classes
  • Implemented interactive prompts when calibration mismatches are detected:
  • Users can press ENTER to apply the calibration file associated with their robot_id
  • Users can type 'c' and press ENTER to run a fresh calibration if needed
  • Updated the connect() method calls to pass the loaded calibration to the calibrate() method

Affected Classes

Follower Robots:

  • KochFollower
  • LeKiwi
  • SO100Follower
  • SO101Follower
  • BiSO100Follower

Leader Teleoperators:

  • KochLeader
  • SO100Leader
  • SO101Leader
  • BiSO100Leader

Benefits

  • Eliminates unnecessary recalibration when switching between users or calibration profiles
  • Provides flexibility to choose between using existing calibration or creating a new one
  • Improves user experience by reducing setup time when working with pre-calibrated robots
  • Maintains backward compatibility while adding new functionality

This change ensures that users who have already calibrated their robots can quickly restore their calibration settings without going through the entire calibration process again.

@AdilZouitine AdilZouitine added bug Something isn’t working correctly refactor robots Issues concerning robots HW interfaces teleoperators Everything related to teleoperators labels Jul 17, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the calibration workflow by allowing use of existing calibration files via an interactive prompt and by passing calibration data through connect() into calibrate().

  • Adds a calibration parameter to calibrate() across leader and follower classes
  • Prompts user to choose between existing calibration file or fresh calibration
  • Updates connect() to forward loaded calibration data

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/lerobot/teleoperators/so101_leader/so101_leader.py Updated connect() and calibrate() signature, added interactive prompt logic
src/lerobot/teleoperators/so100_leader/so100_leader.py Same calibration-parameter and prompt changes as above
src/lerobot/teleoperators/koch_leader/koch_leader.py Same calibration-parameter and prompt changes as above
src/lerobot/robots/so101_follower/so101_follower.py Added calibration param to follower connect() and interactive prompt in calibrate()
src/lerobot/robots/so100_follower/so100_follower.py Added calibration param to follower connect() and interactive prompt in calibrate()
src/lerobot/robots/lekiwi/lekiwi.py Added calibration param to connect() and interactive prompt in calibrate()
src/lerobot/robots/koch_follower/koch_follower.py Added calibration param to follower connect() and interactive prompt in calibrate()
src/lerobot/robots/bi_so100_follower/bi_so100_follower.py Updated calibrate() to forward child arms’ calibration parameters
Comments suppressed due to low confidence (3)

src/lerobot/teleoperators/so101_leader/so101_leader.py:87

  • [nitpick] This log message may be misleading since no mismatch is actually verified before prompting. Consider changing it to something like "Calibration file provided for robot id {self.id}" to accurately reflect the condition.
            logging.info("Mismatch between calibration values in the motor and the calibration file")

src/lerobot/teleoperators/so101_leader/so101_leader.py:85

  • [nitpick] The parameter name calibration shadows the instance attribute and may cause confusion. Consider renaming it to something like provided_calibration.
    def calibrate(self, calibration: dict[str, MotorCalibration] | None = None) -> None:

src/lerobot/teleoperators/so101_leader/so101_leader.py:89

  • Add unit tests (with input mocking) to verify both branches of the interactive prompt — using the provided calibration file and running a fresh calibration — to prevent regressions.
            user_input = input(

aliberts
aliberts previously approved these changes Jul 18, 2025
Copy link
Contributor

@aliberts aliberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@imstevenpmwork imstevenpmwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@imstevenpmwork imstevenpmwork merged commit 26cb461 into main Jul 20, 2025
15 of 16 checks passed
@imstevenpmwork imstevenpmwork deleted the user/azouitine/2025-7-15-fix-calibration branch July 20, 2025 21:41
milong26 pushed a commit to milong26/lerobot_diy that referenced this pull request Aug 26, 2025
Ricci084 pushed a commit to JeffWang987/lerobot that referenced this pull request Sep 5, 2025
BillmanH pushed a commit to BillmanH/lerobot that referenced this pull request Sep 7, 2025
sandhya-cb pushed a commit to sandhya-cb/lerobot-clutterbot that referenced this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn’t working correctly robots Issues concerning robots HW interfaces teleoperators Everything related to teleoperators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants