Skip to content

fix: replace the default factory calibration with measured values - #12

Merged
cao-xiao-hao merged 1 commit into
mainfrom
fix/replace-default-factory-calibration
Sep 29, 2026
Merged

cao-xiao-hao merged 1 commit into
mainfrom
fix/replace-default-factory-calibration

Conversation

@cao-xiao-hao

Copy link
Copy Markdown
Contributor

Summary

src/litegrip/factory_calibration.json is the last entry of the automatic load
chain, so it is what an uncalibrated unit runs on. Its numbers were nominal for a
120 mm stroke unit (1.605 rad × 74.8 mm/rad); the measured unit travels 86.0 mm
over 1.409552 rad. This replaces the file with the measured values.

Two things a reviewer should see before merging:

  • This breaks the default travel for existing consumers. Anyone relying on the
    built-in fallback gets a different stroke (120 mm → 86.0 mm) and a different
    rad_to_mm (74.8 → 61.01229326764816) without changing their code. Under the
    version policy this ships as a patch (fix:), not a major — no BREAKING CHANGE:
    was approved. Say so now if it should be a major.
  • kp drops from 100.0 to 5.0. The field is carried by the file and
    load_calibration() applies it to GripperConfig, so it overrides
    GripperParams.DEFAULT_KP on the fallback path — a 20× softer grip. If 5.0 is
    a value measured for one bench setup rather than the shipped default, drop that
    line before merging.

Changes

  • src/litegrip/factory_calibration.json: zero_position_rad 0.114 → 0.052071,
    max_position_rad -1.491 → -1.357481, travel_range_rad 1.605 → 1.409552,
    rad_to_mm 74.8 → 61.01229326764816, kp 100.0 → 5.0.
  • Everything else (channel, can_id, mst_id, canfd_mode, motor_type, kd,
    grasp_torque_threshold) is unchanged.
  • No code or documentation change: the README describes the factory file as a normal
    mount without quoting its numbers, and the ordering of the limits still makes it a
    normal mount (0.052071 > -1.357481), so mount still reads "normal" and the
    template fallback guard still holds.

Testing

Baseline before the change, and again after it — same result:

$ python3 -m unittest discover -s tests -t tests -v
----------------------------------------------------------------------
Ran 105 tests in 1.720s

OK

Loaded the new file directly to confirm the derived values:

$ PYTHONPATH=src python3 -c "from litegrip import LiteGrip; from litegrip.gripper import _FACTORY_CALIB; g=LiteGrip('can0'); print(g.load_calibration(_FACTORY_CALIB))"
True

mount = normal, pos_closed_rad = 0.052071, pos_open_rad = -1.357481,
rad_to_mm = 61.01229326764816, kp, kd = 5.0 2.0, calibrated = True,
stroke_mm = 86.0.

The data is internally consistent: 1.409552 × 61.01229326764816 = 86.0000, which
matches travel_range_rad and the two limits (0.052071 - (-1.357481) = 1.409552).

Issues

None.

The factory file is the last entry of the automatic load chain, so its
numbers are what a unit runs on before it is calibrated on site.  The
shipped values were nominal for a 120 mm stroke unit (1.605 rad x
74.8 mm/rad); this unit travels 86.0 mm over 1.409552 rad, which is
61.0123 mm/rad.

The two limits keep their ordering, so the fallback stays a normal
mount and the direction the templates guard against is unchanged.

The file also carries kp 5.0 where it carried 100.0, and
load_calibration applies that field to GripperConfig, so the fallback
path now commands a softer grip.
@cao-xiao-hao
cao-xiao-hao merged commit 8db7686 into main Sep 29, 2026
1 check passed
@cao-xiao-hao
cao-xiao-hao deleted the fix/replace-default-factory-calibration branch September 29, 2026 05:19
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.5.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant