grasp_obb · RoboTwin
CaP-X-style OBB top-down grasp for regular objects (boxes, cubes,
cylinders, short poles). One call runs the whole camera/depth pipeline without
reading task state.
Why this exists
For regular shapes, a learned grasp net can place the jaws off-axis or on the
front shell. CaP-X's proven discipline is simpler and more reliable: fit an
oriented bounding box to the object's point cloud and grasp top-down
with the fingers closing across the box's narrow horizontal side, descending
to the body center height (not the top face — descend INTO the body).
How it works
look(refresh head_camera).- object_mask — Grounded-SAM mask of the named object. A mask covering
>40% of the frame is REJECTED (CaP-X lesson: SAM's top mask is often the
whole table).
- object_cloud — unproject the masked depth to a world-frame cloud (reuses
graspgen_infer.predict_grasps_with_mask's depth→world math).
- filter_noise — DBSCAN(eps=0.005, min_samples=10), keep the largest
cluster (mirrors CaP-X filter_noise, plus largest-cluster to shed mask
bleed).
- object_obb — open3d
OrientedBoundingBox(center, extent, R). - topdown_grasp_from_obb — yaw from the OBB's R (fingers close across the
shortest horizontal extent), composed with the base top-down quat
[0.5, -0.5, 0.5, 0.5]; TCP z = OBB body-center height.
- hover above →
descend_tcp_to_zto the grasp z →gripperclose →
is_holding + verify_holding_visual. If not held, retry ONCE ~1.5 cm
lower (descend further into the body).
Success criteria
held: true— bothis_holding(finger proprioception) and
verify_holding_visual confirm the grip after the lift.
Failure modes
- No / whole-scene mask →
ok: False, reason names the segmentation miss.
Pass a more concrete object noun phrase, or u,v to disambiguate.
- Too few depth points (object occluded / out of the head-camera view) →
ok: False. Try scan_wrist first or a different camera-visible pose.
- Grip missed even after the lower retry →
ok: False; the object may be
irregular (use grasp_diverse) or the OBB axis was wrong (bad mask).
Enabling
Enabled by default (validated via /tmp/pb/validate_obb_grasp.py). Set
ROBORSI_OBB_GRASP=0 to disable — it then returns
{ok: False, reason: "disabled"} without touching the sim.