Static Grasp Datasets

graspit_py.dataset exports contact-planner JSON to a compressed NumPy archive and a same-stem JSON metadata file. Exporting and loading operate on saved records using NumPy and the Python standard library. Each archive describes one hand and one object.

The exported arrays support geometric quality prediction, grasp ranking, and point-cloud-conditioned grasp-generation experiments. Each sample associates an object-relative hand pose and named joint coordinates with contact geometry and quality samples. A sample represents a static grasp configuration; sequential observations and controller actions belong to a trajectory dataset.

The household-object workflow prepares metric YCB meshes, generates new closures, samples object-surface points, and writes the archives. Its PyTorch example reads those archives into training batches on the CPU. The native GraspIt! engine is needed for generation; consumers can read the NPZ arrays directly with NumPy.

Public Hugging Face Collection

The Household Grasps dataset contains 288 static grasp candidates across six objects and two hands under CC BY 4.0. The Dataset Viewer exposes two configurations: grasps has 288 rows of poses, named coordinates, contacts, and quality samples; objects has six rows of object geometry metadata and paths to shared surface clouds. Both use an examples split. Define object-disjoint training and evaluation partitions for learning studies.

Install datasets to load the public Parquet tables directly:

from datasets import load_dataset

grasps = load_dataset("cenwerem/graspit-py-household", "grasps", split="examples")
objects = load_dataset("cenwerem/graspit-py-household", "objects", split="examples")

The Hub also hosts the twelve complete NPZ/JSON banks, six 2,048-point object clouds, source attribution, and a SHA-256 release manifest. To use the NumPy loader below, install huggingface_hub and download an NPZ file with its JSON sidecar:

from pathlib import Path
from huggingface_hub import snapshot_download
from graspit_py.dataset import load_dataset as load_grasp_bank

root = snapshot_download(
    "cenwerem/graspit-py-household", repo_type="dataset",
    allow_patterns=["npz/leap/ycb_mustard_bottle.*"], token=False)
bank = load_grasp_bank(Path(root) / "npz/leap/ycb_mustard_bottle.npz")
poses_m = bank.arrays["T_object_hand_m"]  # (24, 4, 4)

Household-Object Examples

The example collection contains 24 saved candidates for each of six YCB objects and two hands, Barrett and LEAP. The LEAP configurations below were reconstructed and closed again before rendering. Green markers show contact locations, and \(\varepsilon_{\mathrm{GI}}\) denotes native GraspIt! Ferrari–Canny quality. For these illustrations, we selected saved candidates in descending native quality, subject to a reachable ZArm–LEAP wrist pose with a sideward or downward approach direction. The object frame remains upright, so the images preserve its orientation with respect to gravity. These geometric labels describe the modeled closure.

Download the LEAP mustard-bottle example to try dataset loading with NumPy. Extract the NPZ and JSON sidecar into one directory. The archive contains 24 configurations, their contact and quality arrays, and 2,048 object-surface points. Its attribution file identifies the source geometry and dataset license.

import numpy as np

with np.load("ycb_mustard_bottle.npz", allow_pickle=False) as data:
    points_m = data["object_pointcloud_m"]  # (2048,3)
    poses_m = data["T_object_hand_m"]       # (24,4,4)
    q_rad = data["dofs_rad"]               # (24,16)
    dof_names = data["dof_names"]          # (16,), ordered labels

Arm-Feasible Wrist Poses and MuJoCo Reconstruction

GraspIt! LEAP mustard-bottle grasp reconstructed on the mounted xArm7–LEAP model in MuJoCo with projected contact rings.

GraspIt!-to-MuJoCo Workflow (xArm7–LEAP). Exported hand/object geometry yields the planned mustard-bottle grasp in GraspIt! (27 contacts, \(\varepsilon_{\mathrm{GI}}=0.321\)), mapped onto the mounted xArm7–LEAP scene in MuJoCo (pos_err = 3.2 nm, rot_err = 1.2e-8 rad, minimum hand-to-table clearance 14.3 mm, minimum arm-to-table clearance 44.7 mm, arm-to-object clearance 53.6 mm; zero simulation steps). Download the MuJoCo reconstruction record.

GraspIt! LEAP mustard-bottle grasp reconstructed on the mounted xArm7–LEAP model in MuJoCo with projected contact rings.

GraspIt!-to-MuJoCo Workflow (xArm7–LEAP). Exported hand/object geometry yields the planned mustard-bottle grasp in GraspIt! (27 contacts, \(\varepsilon_{\mathrm{GI}}=0.321\)), mapped onto the mounted xArm7–LEAP scene in MuJoCo (pos_err = 3.2 nm, rot_err = 1.2e-8 rad, minimum hand-to-table clearance 14.3 mm, minimum arm-to-table clearance 44.7 mm, arm-to-object clearance 53.6 mm; zero simulation steps). Download the MuJoCo reconstruction record.

All six illustrated grasp commands were replayed in GraspIt! and mapped to the mounted ZArm–LEAP model. Verification covered arm joint limits, palm position and orientation, arm self-collision, arm–hand clearance, arm–object clearance, and the table and pedestal. Each hand surface remains at least 25 mm above the pedestal top plane. The largest palm forward-kinematics residual was below 1 µm in translation and \(10^{-6}\) rad in rotation. Native and mounted palm-frame vertex sets agreed to within 0.1 µm. The verification concerns the static grasp pose. The verification data include saved grasp identifiers, frame transforms, arm coordinates, and clearance values.

Export

Use a JSON payload written by python -m graspit_py.planning, or a dictionary with the same candidates list. Each candidate follows GraspCandidate.to_dict() in planning/contact_planner.py.

python -m graspit_py.dataset \
  --input candidates.json --out learning/test_hand/mug.npz \
  --hand-id test_hand --object-id mug \
  --dof-names dof_0,dof_1,dof_2,dof_3 \
  --mesh-scale 1 \
  --model-file hand=path/to/hand.xml \
  --model-file object=path/to/mug.xml \
  --model-file object_mesh=path/to/mug.off

The output is mug.npz and mug.json. Repeating the command with the same output path replaces those files. The exporter reads the saved candidate JSON and serializes its fields. Use an output stem or directory distinct from the input JSON; the CLI rejects paths that would replace its source with the metadata sidecar. --model-file LABEL=PATH hashes only the files explicitly listed; list included robot models, meshes, and other dependencies whose provenance you need. Hash XML files and their referenced assets to cover the complete model.

--dof-names must match the candidate’s independent GraspIt! DOF order exactly. A degree of freedom (DOF) is an independently specified hand coordinate. A source hand can have additional joints coupled to these coordinates. The names are caller-supplied labels in the source order. Verify the order before assigning anatomical names. Every record must have the same DOF count.

For exported hands, the household generator retains the adjacent hand manifest’s joint map in metadata.source.hand_joint_map. A source joint angle \(q_j\) is reconstructed as \(q_j=r_j u_{k(j)}+b_j\), where \(u_{k(j)}\) is its named independent coordinate, \(r_j\) is the coupling ratio, and \(b_j\) is the angular offset in radians. The map preserves these values from model export.

--mesh-scale accepts one positive factor or three positive factors in XYZ order. It records the scale already applied to the source model. The exporter preserves the candidate coordinates at their existing scale. A scalar is stored as three equal factors. Model units and scale must agree with the generated source records.

Optionally supply --object-pointcloud-m points.npy. The file must be a finite numeric (P,3) array of object-frame points in meters and must load with allow_pickle=False. The exporter preserves the caller-supplied object-frame points. Supplying this argument adds the optional point-cloud field. Record the point-cloud generation or sensor procedure with the source payload when it matters.

The equivalent Python interface is:

import json
from pathlib import Path
from graspit_py.dataset import export_dataset

source_path = Path("candidates.json")
payload = json.loads(source_path.read_text())
npz_path, metadata_path = export_dataset(
    payload,
    "learning/test_hand/mug.npz",
    hand_id="test_hand",
    object_id="mug",
    dof_names=["dof_0", "dof_1", "dof_2", "dof_3"],
    mesh_scale=1.0,
    model_files={"hand": "path/to/hand.xml", "object": "path/to/mug.xml"},
    source_path=source_path,
    # object_pointcloud_m=points_in_object_frame_m,
)

The caller is responsible for supplying records from one hand/object pair; the original candidate format contains no per-record hand or object identifier. Record order is preserved. A candidate’s optional grasp_id is retained. Otherwise its ID is hand_id/object_id/000000, with the zero-based source row index. These generated IDs refer to rows in that export, not persistent identities across reordered source files.

Barrett Breakaway Coordinates

The native Barrett model uses breakaway DOFs. Its four independent values are actuator coordinates; the finger joint configuration also depends on contacts formed during closure. Reload the native hand model and replay the stored preshape, palm pose, closing-coordinate mask, and autograsp settings to reconstruct a grasp. The saved contacts and quality labels describe the generated closure. LEAP coordinates specify its independently actuated joints.

Coordinates and Precision

The source T_object_hand_mm maps hand-base coordinates into the object frame. The exported T_object_hand_m has the same rotation and homogeneous last row; only its translation is divided by 1000. For column-vector coordinates, p_object_m = R_object_hand @ p_hand_m + t_object_hand_m. The source model defines the hand-base frame.

Source contact positions are already in the object frame. Their coordinates are divided by 1000 in their existing object frame. Contact normals point into the object, are expressed in the object frame, and remain unchanged. Normals and approach directions must be unit vectors within the validation tolerance and retain their accepted source values. DOF and preshape values remain in radians. The source roll angle remains in degrees under its explicit roll_deg name.

All real-valued arrays use float64. Python/JSON floating-point values are retained at that precision. The meter conversion uses floating-point division by exactly 1000; rotations, angles, normals, and quality labels retain their source values. Integer offsets and shapes use int64, presence masks use Boolean arrays, and text uses NumPy Unicode arrays.

Schema 1.0

The schema name is graspit-py.static-grasps. Both files carry version 1.0. Let N be the number of grasps, D the number of independent DOFs, C the total number of contacts, F the number of source friction samples, E the total number of epsilon sample values, K the total number of task sample values, and P the optional point count.

NPZ field

Shape

Dtype

Meaning

schema_version

scalar

Unicode

1.0

hand_id, object_id

scalar each

Unicode

Caller-supplied hand and object identity

dof_names

(D,)

Unicode

Independent DOF names in source order

grasp_ids

(N,)

Unicode

Unique record IDs within this archive

mesh_scale

(3,)

float64

Already-applied XYZ model scale

friction_samples

(F,)

float64

Source planner friction coefficients in column order

T_object_hand_m

(N,4,4)

float64

Hand-base to object transform, translation in meters

dofs_rad

(N,D)

float64

Closed independent hand DOF configurations

preshape_rad

(N,D)

float64

Source pre-closure independent DOF configurations

closing_mask

(N,D)

bool

DOFs allowed to close; source closing=None means all true

approach_dir

(N,3)

float64

Hand travel direction in the object frame

roll_deg

(N,)

float64

Source approach roll in degrees

contact_positions_m

(C,3)

float64

Nominal object-frame contact positions in meters

contact_normals

(C,3)

float64

Corresponding inward object-frame unit normals

contact_offsets

(N+1,)

int64

Contact boundaries per record

native_epsilon

(N,)

float64

Unmodified native GraspIt! epsilon at nominal closure

nominal_epsilon

(N,)

float64

Recomputed epsilon at nominal closure and the middle friction column

expected_epsilon

(N,)

float64

Source mean of all epsilon sample values

epsilon_cvar

(N,)

float64

Source lower-tail mean of epsilon at planner.tail_mass

score

(N,)

float64

Source ranking score interpreted by score_kind

score_kind

(N,)

Unicode

epsilon or task_wrench_capacity

epsilon_samples

(E,)

float64

Flattened recomputed pose/friction epsilon matrices

epsilon_sample_offsets

(N+1,)

int64

Epsilon value boundaries per record

epsilon_sample_shapes

(N,2)

int64

Original pose-by-friction matrix shapes

task_present

(N,)

bool

Task-sample array presence

task_samples

(K,)

float64

Flattened task wrench capacity matrices

task_sample_offsets

(N+1,)

int64

Task value boundaries per record

task_sample_shapes

(N,2)

int64

Original task matrix shapes, (0,0) when absent

nominal_task, expected_task

(N,) each

float64

Source task summaries; zero placeholders when absent

nominal_task_present, expected_task_present

(N,) each

bool

Presence masks for the respective task summaries

object_pointcloud_m

(P,3)

float64

Optional caller-supplied object-frame points in meters

Contact slices use contact_offsets[i]:contact_offsets[i+1]. Samples are stored in C order and reconstructed using their own offsets and two-dimensional shapes. Task matrices, when present, match that record’s epsilon matrix shape. An absent task matrix has an empty slice. Always use presence masks for optional task summaries; a present value of zero is distinct from an absent value. An archive with no grasps is valid and retains (0,D) configuration arrays and offset arrays containing only zero.

Sample row 0 represents nominal closure. Subsequent rows represent closures after perturbing the standoff pose and approach direction according to the source planner configuration. Failed closures contribute zero quality in the planner. Columns follow planner.friction_samples. If that source configuration is missing, friction_samples is empty and the column coefficients are unknown. Sample shapes remain explicit. Geometry fields describe the nominal pose and contacts; uncertainty arrays contain quality values for the sampled closures.

The exporter preserves source quality labels. Native epsilon uses the native GraspIt! convention. The other epsilon labels come from the Python GWS analysis in the source planner. The current planner uses eight friction-cone edges per contact, a unit total normal-force budget, and torques normalized by each closure’s maximum contact distance to the object center (with a 0.01 mm minimum). Keep these labels distinct when training or comparing metrics. The household workflow retains its wrench origin and metric conventions in the JSON metadata. With no task samples, score_kind="epsilon" means the source planner ranked by epsilon_cvar. With task samples, score_kind="task_wrench_capacity" means it ranked by the lower-tail mean of task wrench capacity. nominal_task uses the nominal row’s middle friction column and expected_task is the sample mean. These are geometric ranking quantities under the source contact and friction model.

Metadata and Validation

The JSON file records IDs, ordered DOF names, frame and unit meanings, the exact shape and dtype of every array, and descriptions of all score fields. Its source object retains all original top-level fields except candidates, including the hand configuration, planner configuration, source units, runtime, and rejections when supplied.

provenance.source_sha256 hashes the complete source payload serialized as UTF-8 JSON with sorted keys, compact separators, and no NaN/Infinity values. config_sha256 hashes the hand, planner, and units fields with the same serialization; absent fields are represented as JSON null. When source_path is supplied, source_file_sha256 also hashes the original file bytes. Each explicit model_files entry records its path and file-byte SHA-256. An empty model-file mapping means no model contents were verified. Paths can be relative and are recorded as supplied; hashes identify the bytes at export time.

The exporter validates finite real values, rigid homogeneous transforms, ordered unique DOF names, DOF vector sizes, unit normals/directions, sample matrix shapes, friction-column counts when known, and closing indices before writing. Rotation orthonormality and determinant checks use absolute tolerance 1e-6; unit-vector checks use 1e-5. The loader always uses np.load(..., allow_pickle=False) and rejects unknown versions, field/shape/ dtype mismatches, nonfinite data or metadata, inconsistent offsets, and invalid presence masks. Validation checks structure and geometry. Verify physical model identity, source IDs, and summary scores against their underlying records when preparing experiments.

Load for NumPy or PyTorch

import numpy as np
from graspit_py.dataset import load_dataset

dataset = load_dataset("learning/test_hand/mug.npz")
a = dataset.arrays
i = 0
T_object_hand_m = a["T_object_hand_m"][i]  # (4,4), float64
q_rad = a["dofs_rad"][i]                  # (D,), named by a["dof_names"]
begin, end = a["contact_offsets"][i:i+2]
contacts_m = a["contact_positions_m"][begin:end]
begin, end = a["epsilon_sample_offsets"][i:i+2]
epsilon = a["epsilon_samples"][begin:end].reshape(a["epsilon_sample_shapes"][i])
task = None
if a["task_present"][i]:
    begin, end = a["task_sample_offsets"][i:i+2]
    task = a["task_samples"][begin:end].reshape(a["task_sample_shapes"][i])

# Only if PyTorch is already installed and wanted by the caller:
# import torch
# q_tensor = torch.from_numpy(np.ascontiguousarray(a["dofs_rad"]))
# pose_tensor = torch.from_numpy(np.ascontiguousarray(a["T_object_hand_m"]))

PyTorch is an optional consumer of the exported arrays. The arrays above retain float64; choose and document any later dtype conversion or normalization in the learning pipeline. Define the observation source, target representation, split strategy, and controller contract separately if these static configurations become training targets.