Repository navigation
fix: replace the factory calibration with the re-measured geometry - #61
Merged
Merged
Conversation
The shipped default calibration is what a no-argument load_calibration() reads, so it drives the travel clamp and every mm-based target. It carried zero_position_rad 0.052071, max_position_rad -1.357481 and rad_to_mm 61.01229326764816; the shipped unit reads 0.029564, -1.141184 and 73.45731105242119. Both files span the same 86 mm (travel_range_rad * rad_to_mm == 86.0), so neither is self-inconsistent and reading one file alone cannot say which is wrong. Only the absolute values separate them, which is why the shipped geometry is pinned by test rather than checked for internal consistency. rad_to_mm rises by a factor of 1.204, so every mm-based target and the clamp_to_calibrated limits move with it: open() at work_stroke_mm 80.0 lands at a different angle than before. That is what a recalibration is for, not a side effect to be worked around, but it does change the behaviour of anything pinned to the old default. The two direction templates move to the same geometry, so the three shipped files keep describing one unit. The test that used the factory file as its example of a pre-`calibrated`-flag file now writes its own, because the shipped file carries the flag and the fallback it covers is about a missing key, not about that file.
|
🎉 This PR is included in version 1.0.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
The shipped default calibration — what a no-argument
load_calibration()reads — is replaced with the geometry re-measured on the shipped unit. It carriedzero_position_rad 0.052071,max_position_rad -1.357481,rad_to_mm 61.01229326764816; the unit now reads0.029564,-1.141184,73.45731105242119.Both the old and the new file span the same 86 mm (
travel_range_rad * rad_to_mm == 86.0), so neither is self-inconsistent and reading one file alone cannot say which is wrong. Only the absolute values separate them, which is why the shipped geometry is pinned by test rather than checked for internal consistency.This changes behaviour for anything sitting on the old default.
rad_to_mmrises by a factor of 1.204, so every mm-based target (goto,move_to,openatwork_stroke_mm 80.0) and theclamp_to_calibratedlimits move with it:open()lands at a different angle than before. That is what a recalibration is for, but under this repository's version policy it publishes as a patch (fix:), not a major.The two sibling repositories still carry the old geometry —
litegrip-cpp/calibration/factory_calibration.jsonandlitegrip-studio/src/litegrip/factory_calibration.jsonare both unchanged, and the test docstring has until now named the cpp file as the origin of the factory values. They need the same update or the three repos disagree.Changes
src/litegrip/factory_calibration.json— new geometry. It now carries"calibrated": true; the loader treats a missing key astrue(gripper.py:1218), so behaviour is unchanged.src/litegrip/calibration_normal.json,src/litegrip/calibration_reverse.json— move to the same geometry, so all three shipped files keep describing one unit. Direction ordering is unchanged (normalcloses at the larger rad value,reverseat the smaller one).src/litegrip/constants.py— theGripperGeometrydocstring quotes the factory pair as its worked example; updated to1.170748 rad -> 86 mm at 73.45731105242119 mm/rad, and 85 mm at 72.604.tests/test_calibration.py— re-pinned the factory geometry constants, plus the two fixture fixes below.Two test-code edits, neither of which weakens coverage:
test_deriving_from_the_jaw_travel_alone_would_be_shortbounded the shortfall with a magic0.8. On the new geometry the shortfall is1 / 1.170748 = 0.854, so the bound would break on every recalibration. Replaced with the exact identityrad_to_mm - 85/travel == STOP_INSET_MM/travel, which is stricter than the bound it replaces and no longer needs re-tuning.test_old_file_without_the_flag_counts_as_calibratedused the factory file as its example of a pre-calibrated-flag file. The shipped file now carries the flag, so the test writes its own fixture. The fallback it covers — a missing key means calibrated — is untouched.Testing
Also loaded all three files out of band to confirm they agree:
Issues
No issue.
gh issue list --state allshows no open issue and none about the factory geometry; the closest historical one is #43 (shipped calibration files agreeing onkp), which is closed and about a different field.