solve_relational_keypoint (ReKep)
Encodes a goal as a relational constraint between a keypoint on the held
object and a keypoint on a target object. Grounds both with the VLM
(find_pixel → unproject_pixel), computes
delta = (target_kp + offset) - moving_kp, and applies it to the holding
arm's end-effector (translation only; orientation unchanged).
Usage
arm: the arm holding the moving object.moving_keypoint: phrase for the held-object keypoint.target_object/target_keypoint: the target and its keypoint.offset_xyz: world offset added to the target keypoint (default
[0, 0, 0.02] — 2 cm above).
dry_run: default True — returnsdelta_xyz+target_ee_pose
without moving. Set False (or feed target_ee_pose to move_to_pose)
to execute.
Failure modes
- Either keypoint fails to ground/unproject →
ok=Falsewith the
offending keypoint + reason.
- Single-camera unproject + VLM jitter make the geometry approximate —
inspect delta_xyz under dry_run before committing.
- Translation-only: a goal needing pour-tilt rotation is NOT solved here
(see the ReKep-rotation TODO in policy.py).
target_ee_posemay be IK-unreachable → on dry_run=False the
move_to_pose plan is refused and ok=False with move_note.