grasping-direct-ik
Direct-IK grasp: rotate the gripper to grasp orientation at a safe height
above the target, then descend straight down, then close. No trajectory
planner — works on platforms where CuRobo is not deployed, or in
uncluttered scenes where planning is overkill.
Nothing here is written for one hand. The grasp rotation is composed by the
connector's robot.grasp_frame from the hand's measured approach and closing
axes, the fingertip floor and the hover clearance come from
robot.describe_gripper / robot.describe_workspace, so the same subgraph
grasps the same way on a hand that closes along tool-local x and on one that
closes along tool-local y.
When to use
- The
curobo tool bundle is not deployed (no collision-aware planner
available).
- The scene is uncluttered enough that a straight-line approach is safe.
When NOT to use
- Cluttered scenes where the arm must thread between obstacles. Prefer
grasping-with-planner if available.
Recommended subgraph state flow
The subgraph state machine the agent generates should look like (7 states):
open → compute_grasp → refine_grasp → compute_align → rotate_align → descend → close → grasped
(grasped is the success-marker noop from sg.add_exit("grasped"),
with an edge to END.)
State details:
open — type: tool, tool: "robot.open_gripper", inputs: { settle_steps: 40 }.
compute_grasp — type: tool, tool: "geometry.top_down_grasp_candidates",
inputs: { obb: Ref("in.target_obb") }.
refine_grasp — type: script, file
scripts/<sg>/refine_top_down_grasp.py (from this bundle's
canonical_scripts). Inputs:
grasp_pose = Ref("compute_grasp.candidates.poses.0"),
target_obb = Ref("in.target_obb"). Returns grasp_pose: the candidate
with its rotation rebuilt so this hand's closing axis lies across the
OBB's short horizontal axis (robot.describe_gripper +
robot.grasp_frame(approach=-z, close_heading_deg)), and its Z raised to
the fingertip floor (support_z + finger.reach_m + finger.clearance_m)
when the hand states its finger envelope. Keep this state: the candidate
fan is world-aligned and a thin object's centred grasp jams the jaws on
the table without the floor.
compute_align — type: script, file
scripts/<sg>/compute_align_pose.py. Inputs:
grasp_pose = Ref("refine_grasp.grasp_pose"),
target_obb = Ref("in.target_obb"), optionally clearance (a literal in
metres). Returns align_pose at the grasp XY and rotation, with
z = max(obb_top, grasp_z) + clearance. Omit clearance (or pass 0)
and the script asks robot.describe_workspace for align_clearance_m —
the hand's own envelope above the fingertips. Pin it (e.g. 0.12) when
the held object is what needs the room, such as a long tool that will
hang below the fingertips on the way up.
rotate_align — type: tool, tool: "robot.go_to_pose",
inputs: { pose: Ref("compute_align.align_pose") }.
descend — type: tool, tool: "robot.go_to_pose",
inputs: { pose: Ref("refine_grasp.grasp_pose") } — the same pose
compute_align was given, so hover and grasp share one rotation.
close — type: tool, tool: "robot.close_gripper", inputs: { settle_steps: 60 }.
Edge directly from close to the grasped success marker; the
subgraph's on_error: "failed" catches any raise from earlier steps.
Whether the gripper actually closed on the object is checked by the
target_held postcondition checkpoint (see ## Checkpoints), NOT by
a re-check-and-raise node (none such exists).
"edges": [ ..., ["close", "grasped"], ["grasped", "END"] ],
"conditional_edges": {},
"exit": { "router_field": null, "success_values": ["grasped"] },
"on_error": "failed"
The lift onto a safe carry height is handled by the next
transporting-objects subgraph (its waypoint_move script lifts before
lateral motion); do NOT add a lift step here.
scripts/<sg>/plan_to_pose.py is the optional planned variant of a single
leg: it calls curobo.plan_to_pose from the observation's joint state to a
target pose and returns the trajectory (raising PlanningFailed when the
planner refuses) for a platform that deploys CuRobo as a fast single-pose IK
fallback without the goalset grasp planner.
Hard rules
- Use
geometry.top_down_grasp_candidates (returns
candidates: {poses: list[Se3Pose]}), not
geometry.top_down_grasp_from_obb (single bare pose). The refine and
align-pose constructions assume compute_grasp.candidates.poses.0 exists.
- The
align_pose descends straight down with the gripper pre-rotated.
Do NOT skip the compute_align + rotate_align states — a direct
robot.go_to_pose to the grasp pose blends rotation and descent and
twists the gripper against the object.
descend uses the pose compute_align was given (refine_grasp.grasp_pose).
Never descend to the raw candidate after hovering at the refined rotation.
Required end states
| End state |
Meaning |
grasped |
Gripper has closed on the object after the descend. Route to next subgraph (typically transporting-objects). |
failed |
Any grasp-attempt failure: planning failure or trajectory execution error (a raise to on_error). Coordinator routes to abort. Lives only in on_error — never declare a failed node. |
See also
references/design_align_then_descend.md — why pre-rotate-then-descend
beats blended rotate+descend.
scripts/refine_top_down_grasp.py — the close-axis rotation and fingertip
floor, read off the live hand.
scripts/compute_align_pose.py — the canonical align-pose construction.
scripts/plan_to_pose.py — the optional CuRobo single-pose leg.
1---2name: grasping-direct-ik3description: Direct IK align-then-descend grasping. The gripper pre-rotates to the grasp orientation at a safe height ABOVE the target before descending straight down, avoiding the twist-while-closing failure mode of a blended rotate+descend. The grasp rotation is rebuilt so the hand's declared closing axis (robot.describe_gripper, composed by robot.grasp_frame) closes across the target's short horizontal axis, and the hover clearance is the hand's own (robot.describe_workspace) unless the workflow pins it. Use when no trajectory planner (curobo) is deployed or the scene is uncluttered enough that a straight-line approach is safe.4license: Apache-2.05---67# grasping-direct-ik89Direct-IK grasp: rotate the gripper to grasp orientation at a safe height10above the target, then descend straight down, then close. No trajectory11planner — works on platforms where CuRobo is not deployed, or in12uncluttered scenes where planning is overkill.1314Nothing here is written for one hand. The grasp rotation is composed by the15connector's `robot.grasp_frame` from the hand's measured approach and closing16axes, the fingertip floor and the hover clearance come from17`robot.describe_gripper` / `robot.describe_workspace`, so the same subgraph18grasps the same way on a hand that closes along tool-local x and on one that19closes along tool-local y.2021## When to use2223- The `curobo` tool bundle is not deployed (no collision-aware planner24 available).25- The scene is uncluttered enough that a straight-line approach is safe.2627## When NOT to use2829- Cluttered scenes where the arm must thread between obstacles. Prefer30 `grasping-with-planner` if available.3132## Recommended subgraph state flow3334The subgraph state machine the agent generates should look like (7 states):3536```text37open → compute_grasp → refine_grasp → compute_align → rotate_align → descend → close → grasped38```3940(`grasped` is the success-marker `noop` from `sg.add_exit("grasped")`,41with an edge to `END`.)4243State details:44451. **`open`** — `type: tool`, `tool: "robot.open_gripper"`, `inputs: { settle_steps: 40 }`.462. **`compute_grasp`** — `type: tool`, `tool: "geometry.top_down_grasp_candidates"`,47 `inputs: { obb: Ref("in.target_obb") }`.483. **`refine_grasp`** — `type: script`, file49 `scripts/<sg>/refine_top_down_grasp.py` (from this bundle's50 `canonical_scripts`). Inputs:51 `grasp_pose = Ref("compute_grasp.candidates.poses.0")`,52 `target_obb = Ref("in.target_obb")`. Returns `grasp_pose`: the candidate53 with its rotation rebuilt so this hand's closing axis lies across the54 OBB's short horizontal axis (`robot.describe_gripper` +55 `robot.grasp_frame(approach=-z, close_heading_deg)`), and its Z raised to56 the fingertip floor (`support_z + finger.reach_m + finger.clearance_m`)57 when the hand states its finger envelope. Keep this state: the candidate58 fan is world-aligned and a thin object's centred grasp jams the jaws on59 the table without the floor.604. **`compute_align`** — `type: script`, file61 `scripts/<sg>/compute_align_pose.py`. Inputs:62 `grasp_pose = Ref("refine_grasp.grasp_pose")`,63 `target_obb = Ref("in.target_obb")`, optionally `clearance` (a literal in64 metres). Returns `align_pose` at the grasp XY and rotation, with65 `z = max(obb_top, grasp_z) + clearance`. Omit `clearance` (or pass `0`)66 and the script asks `robot.describe_workspace` for `align_clearance_m` —67 the hand's own envelope above the fingertips. Pin it (e.g. `0.12`) when68 the *held* object is what needs the room, such as a long tool that will69 hang below the fingertips on the way up.705. **`rotate_align`** — `type: tool`, `tool: "robot.go_to_pose"`,71 `inputs: { pose: Ref("compute_align.align_pose") }`.726. **`descend`** — `type: tool`, `tool: "robot.go_to_pose"`,73 `inputs: { pose: Ref("refine_grasp.grasp_pose") }` — the same pose74 `compute_align` was given, so hover and grasp share one rotation.757. **`close`** — `type: tool`, `tool: "robot.close_gripper"`, `inputs: { settle_steps: 60 }`.76 Edge directly from `close` to the `grasped` success marker; the77 subgraph's `on_error: "failed"` catches any raise from earlier steps.78 Whether the gripper actually closed on the object is checked by the79 `target_held` postcondition checkpoint (see `## Checkpoints`), NOT by80 a re-check-and-raise node (none such exists).8182 ```json83 "edges": [ ..., ["close", "grasped"], ["grasped", "END"] ],84 "conditional_edges": {},85 "exit": { "router_field": null, "success_values": ["grasped"] },86 "on_error": "failed"87 ```8889 The lift onto a safe carry height is handled by the next90 `transporting-objects` subgraph (its `waypoint_move` script lifts before91 lateral motion); do NOT add a lift step here.9293`scripts/<sg>/plan_to_pose.py` is the optional planned variant of a single94leg: it calls `curobo.plan_to_pose` from the observation's joint state to a95target pose and returns the `trajectory` (raising `PlanningFailed` when the96planner refuses) for a platform that deploys CuRobo as a fast single-pose IK97fallback without the goalset grasp planner.9899## Hard rules1001011. Use `geometry.top_down_grasp_candidates` (returns102 `candidates: {poses: list[Se3Pose]}`), not103 `geometry.top_down_grasp_from_obb` (single bare pose). The refine and104 align-pose constructions assume `compute_grasp.candidates.poses.0` exists.1052. The `align_pose` descends straight down with the gripper pre-rotated.106 Do NOT skip the `compute_align` + `rotate_align` states — a direct107 `robot.go_to_pose` to the grasp pose blends rotation and descent and108 twists the gripper against the object.1093. `descend` uses the pose `compute_align` was given (`refine_grasp.grasp_pose`).110 Never descend to the raw candidate after hovering at the refined rotation.111112## Required end states113114| End state | Meaning |115|---|---|116| `grasped` | Gripper has closed on the object after the descend. Route to next subgraph (typically `transporting-objects`). |117| `failed` | Any grasp-attempt failure: planning failure or trajectory execution error (a raise to `on_error`). Coordinator routes to abort. Lives only in `on_error` — never declare a `failed` node. |118119120## See also121122- `references/design_align_then_descend.md` — why pre-rotate-then-descend123 beats blended rotate+descend.124- `scripts/refine_top_down_grasp.py` — the close-axis rotation and fingertip125 floor, read off the live hand.126- `scripts/compute_align_pose.py` — the canonical align-pose construction.127- `scripts/plan_to_pose.py` — the optional CuRobo single-pose leg.