descend_tcp_to_z
Closed-loop residual descend that compensates cuRobo's z-undershoot.
Why this exists
cuRobo's plan_path / move_fingertip_to reliably terminates ~1–3 cm ABOVE
the commanded z (documented in grasp_object). For chunky objects that slack is
harmless. For thin / low objects (pens, flat markers, shallow bowls) it is
fatal: the gripper jaws close on air above the object instead of straddling
it at grasp height. This is the dominant collect_pens failure.
How it works
- Command a
move_fingertip_todescend totarget_z. - Measure the actual fingertip TCP z from the robot's own EE pose.
- If the TCP is still above
target_zby more thantol_m, **over-command
downward** by the residual error (≥ min_step, ≤ max_step) and descend
again — never below the floor_z damage cap.
- Repeat up to
max_itersuntil the measured TCP reachestarget_z.
Because cuRobo undershoots, commanding progressively lower z lands the TCP on the
true target. Returns reached + the full z_history so the caller can see the
convergence.
Success criteria
reached: true— measured fingertip TCP z withintol_moftarget_z.
Failure modes
- Hits
floor_zbefore reaching target (object lower than the damage cap allows,
or a bad target_z) → reached: false, inspect z_history.
- IK-infeasible descend (joint limits / collision) →
move_fingertip_torefuses;
z_history stops moving. Re-ground the target xy first.