fix: symmetric calibration for wrist_roll motors in SO-101#3320
Open
cwzhong627-source wants to merge 2 commits intohuggingface:mainfrom
Open
fix: symmetric calibration for wrist_roll motors in SO-101#3320cwzhong627-source wants to merge 2 commits intohuggingface:mainfrom
cwzhong627-source wants to merge 2 commits intohuggingface:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(robots): ensure symmetric wrist_roll calibration for SO-101
Type / Scope
Summary / Motivation
Current calibration for wrist_roll (full-turn motors) in SO-101 robots relies on a hardcoded range or an asymmetric logic, which causes the software "zero" point to deviate from the physical orientation set by the user during the calibration process.
This PR implements a symmetric range strategy. By calculating a safe_delta centered at the current physical position, we ensure that the software center ((min + max) / 2) perfectly aligns with the user-defined physical zero. This fixes the "offset wrist" issue and ensures consistent range of motion in both directions.
Related issues
Fixes / Closes: #3193
What changed
How was this tested (or how to run locally)
lerobot-calibrateand set the wrist to a specific orientation.calibration.json.range_minandrange_maxare symmetric around the set position (e.g.,current_pos=2028resulted inmin=0,max=4056).Bash
Checklist (required before merge)
pre-commit run -a) - Note: If you haven't run this, you can check if CI passes.pytest)Reviewer notes
The core logic uses
safe_deltato prevent the range from exceeding the physical limits (0-4095) while maintaining symmetry. This is crucial becausemotors_bus.pyuses the arithmetic mean of the range to define the normalized zero point.