grasp_object · RoboTwin
End-to-end grasp atomic. Combines perception (find_pixel) + grasp pose
generation (GraspGen via get_grasp_pose) + reachability filter
(is_reachable) + retry loop (move_fingertip_to per candidate, gripper
close, verify_holding_visual) + lift on success.
Why this exists
Profiling 30-turn collect_pens runs showed VLM spent most turns writing
the same boilerplate retry loop in Python. The loop is mechanical — it
should be a single tool call. The VLM's job is high-level decisions
(which object, which arm), not implementing the grasp state machine.
Algorithm
- find_pixel(object, location='center') → (u, v)
- unproject_pixel + ±2cm slab → z_min, z_max for point-cloud filter
- get_grasp_pose(object=object, top_k=top_k, z_min, z_max)
- (optional) filter candidates by approach-axis dot world-(-Z) > cos(60°)
- filter candidates by is_reachable(arm, candidate.flange)
- for each remaining candidate (sorted by score):
a. open gripper
b. move_fingertip_to(arm, candidate.tcp_xyz + 0.10 hover, quat=cand.quat)
c. move_fingertip_to(arm, candidate.tcp_xyz, quat=cand.quat)
d. gripper(arm, 'close')
e. verify_holding_visual(arm, object) → if True: break (success)
f. open + retreat to next candidate
- Return ok = True iff any candidate succeeded; attempts list with
per-candidate diagnostics for VLM to introspect on failure.