Lazy Workspace Calibration (calibration.py)
Use bundled calibration.py (numpy opencv-python)
for lazy, capability-keyed memoization in .robot_calibration.json (following
physical_robot_safety.md). Probe
only what the current task actually needs: in simulation, read exact model
parameters directly (never share .robot_calibration.json between sim and
real); skip fixed-camera calibration whenever a wrist camera alone sees the
workspace; skip probe_surface_z on stiff arms when RGB-D depth already gives
clean target Z.
- Cache, Intrinsics & Staleness:
- Store poses in the robot base frame and camera extrinsics in OpenCV
optical axes (
+Xright,+Ydown,+Zforward). - Call
load_calibration/save_calibration, rescaleKon resolution changes withscale_intrinsics(K, from_wh, to_wh), and guard fixed-cameraT_world_cam/Hwithborder_fingerprint(img)andis_border_stale.
- Store poses in the robot base frame and camera extrinsics in OpenCV
optical axes (
- Surface Height (
probe_surface_z):- Never roll an ad-hoc
|z_fk - z_cmd|probe from scratch (gravity sag causes mid-air false triggers). Callprobe_surface_z(move_z_fn, read_z_fk_fn, z_start, z_min, mode="compliant" | "stiff", read_force_fn=...)over a clear patch with closed jaws; persist bothsurface_z(vision plane) andsurface_z_cmd(table-level command baking in compliance).
- Never roll an ad-hoc
- Hand-Eye (
verify_wrist_extrinsic_sign/fit_wrist_jacobian) & Gripper:- CAD
T_ee_camprior exists: Check axis sign once when populating the cache (or if the mount was bumped) viaverify_wrist_extrinsic_sign(...). - Extrinsics unknown: Execute two orthogonal hover nudges and call
fit_wrist_jacobian(duv_dx, duv_dy, step_x_m, step_y_m)to getJ_xy_uv, then step withjacobian_step_xy(J_xy_uv, uv_target, uv_ref). - Record
closing_axis_ee,open_cmd,closed_cmd, andgripper_empty_closedonce in.robot_calibration.json. - Use fixed-camera
fit_plane_homographyonly as a cached coarse seed for a wrist camera (or fallback when no wrist camera, depth, orT_world_camexists).
- CAD


