Skip to main content

geometry

Pure-math 3D geometry toolbox — back-project masks and depth to point clouds, DBSCAN-filter noise, fit oriented bounding boxes, derive top-down/front grasp poses, and reconstruct collision worlds from RGB-D frames. Use when a workflow needs perception geometry or planner inputs computed on CPU with no model weights.

Source facts

Repository
graph-robots/open-robot-skills
Last source activity
September 5, 2026 at 02:17
Detected SKILL.md language
English
Stars
58
Forks
8

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

File Explorer
6 files

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
geometry
description
Pure-math 3D geometry toolbox — back-project masks and depth to point clouds, DBSCAN-filter noise, fit oriented bounding boxes, derive top-down/front grasp poses, and reconstruct collision worlds from RGB-D frames. Use when a workflow needs perception geometry or planner inputs computed on CPU with no model weights.
license
MIT
compatibility
requires gap>=0.1
metadata
{"category":"perception","tags":["perception","planning","geometry"]}
gap
{"requires":{},"serving":{"command":["python","-m","gap_core.rpc.server","--bundle","geometry"],"protocol":"stdio-msgpack"},"tools":[{"geometry.depth_to_point_cloud":"Convert a metric depth image to a camera-frame point cloud."},{"geometry.mask_to_world_points":"Back-project a 2D mask to 3D world points via depth + calibration."},{"geometry.pixel_to_world_point":"Back-project a single pixel to a 3D world point."},{"geometry.transform_points":"Apply a rigid SE(3) transform to 3D points."},{"geometry.fit_planar_feature":"Fit a 6D frame, normal, median radius, and robust inner/outer radii to a ring, loop, rim, or planar opening cloud."},{"geometry.fit_linear_feature":"Fit an axis and robust endpoints to a rod, peg, shaft, or hook cloud."},{"geometry.cloud_to_attachment":"Convert an observed object cloud into an attached collision model and object-to-TCP transform."},{"geometry.compute_feature_mate":"Compute metric approach, engagement, and seating poses for compatible held and fixture features."},{"geometry.exclude_robot_points":"FK-sphere removal of robot-body points from a cloud (7-DOF Franka; other arms pass through)."},{"geometry.filter_noise":"DBSCAN noise filtering (keeps all non-noise points)."},{"geometry.compute_obb":"Fit an upright oriented bounding box to 3D points (HyRL fit)."},{"geometry.filter_and_compute_obb":"DBSCAN filter then OBB fit in one call."},{"geometry.top_down_grasp_from_obb":"One world-aligned top-down grasp pose from an OBB."},{"geometry.top_down_grasp_candidates":"Fan of top-down grasp candidates (canonical primary+alt first)."},{"geometry.select_top_down_grasp":"Pick the most top-down grasp from candidates."},{"geometry.front_grasp_from_obb":"Front-approach grasp/pre-grasp for handles (drawers, doors)."},{"geometry.build_world_config":"Reconstruct a multi-surface collision world from RGB-D; touching planes are separated into closed slabs, residual non-planar clusters are meshed independently, and optional live robot spheres remove self-returns before meshing."},{"geometry.rotate_quat_z90":"Rotate a wxyz quaternion 90 degrees around world Z."},{"geometry.compute_drop_position":"Drop position above a container OBB."},{"geometry.compute_xy_distance":"XY-plane distance between two 3D points."},{"geometry.iou":"IoU of two axis-aligned 2D boxes."},{"geometry.pose_distance":"Euclidean distance between two 3D positions."}]}
# geometry Pure-math perception/planning geometry as in-process typed tools, from mask back-projection through OBB fitting to grasp-candidate generation, plus the two scalar helpers (`geometry.iou`, `geometry.pose_distance`). Fully CPU — no model weights, no GPU. ## When to use - Turning a segmentation mask + depth + camera calibration into world-frame points (`mask_to_world_points`) and an object OBB (`filter_and_compute_obb`). - Deriving grasp poses from an OBB: `top_down_grasp_candidates` for tabletop pick (feed the full list to `curobo.plan_to_grasp_poses` as a goalset), `front_grasp_from_obb` for horizontal interactions (drawer/door handles). - Building the collision world for the planner: `build_world_config` with the target's mask in `object_masks` so the planner can `ignore_obstacle_names` it. - Estimating feature geometry for constrained mating: use `fit_planar_feature` for loops/openings and `fit_linear_feature` for rods/pegs. Their axis signs are geometrically ambiguous, so pass a workcell- or camera-derived `normal_hint` / `axis_hint` when direction matters. ## Install ```bash uv sync --extra geometry # open3d + scikit-learn (cv2/scipy come with gap core) # (pip: pip install -e ".[geometry]") ``` The module imports lazily — the bundle loads (and the light tools work) without the extra; only OBB fitting, DBSCAN filtering and world reconstruction need open3d/sklearn/cv2. ## Gotchas (carried over from the service) - **OBB `extent` is HALF-extents** (gap.types convention, same as the proto). `compute_obb` is upright-only: rotation is around world Z (no 3D tilt), and extents use the 2nd/98th percentile of points, not strict min/max. - Single-camera clouds are 2.5D: only camera-facing surfaces are observed, so OBB centers carry a few cm of depth bias on opaque objects. (The service's rehearsal-sandbox ground-truth snap that compensated for this in-container was deliberately NOT ported — it depended on a `/app` sandbox file.) - A fitted plane normal has two valid signs and a fitted line has two valid directions. The feature-fit tools expose hints solely to resolve that sign; callers must derive the hint from observed support geometry, camera viewing direction, or a declared workcell frame rather than an evaluator target. - `top_down_grasp_candidates` default `z_offset=-0.04`: fingertip 4 cm below the OBB top. With `z_offset=0.0` the fingers close above the object (silent empty grip). Grasp Z is clamped to -0.05 m (table-clearance floor; LIBERO table top is at world z=0). - `mask_to_world_points` keeps only depths in [0.015, 20.0] m (HyRL bounds); invalid/zero-depth pixels are dropped. - `filter_noise` returns the ORIGINAL cloud unchanged when DBSCAN labels everything noise (defensive fallback, mirrors HyRL). - `build_world_config`: table removal only runs when `table_z_threshold != 0` (typical -0.01); robot-point exclusion is Franka-only (simplified DH FK) and skips non-7-DOF joint states; prefer explicit `object_masks` over the `target_obb` projection fallback — masks are pixel-accurate, the OBB projection is a corner-AABB approximation inflated by 2 cm. - `top_down_grasp_from_obb` yaw is NOT derived from the OBB — fingers may close across the wide axis; use the candidate fan when orientation matters.
View on GitHub