Skip to main content

A binding of gpg using pybind11 and CMake

Project description

Grasp Pose Generator

Grasp Pose Generator is a Python package that provides bindings for the C++ Grasp Pose Generator (GPG), enabling the creation of grasp candidates for 3D point clouds. This tool is essential for robotic manipulation tasks, allowing robots to determine feasible grasping positions on objects represented by point clouds.

Features

  • Generate 6-DOF grasp poses for 2-finger grippers.
  • Evaluate grasp candidates for antipodal properties using geometric conditions.
  • Seamless integration with Python for easy incorporation into robotic pipelines.

Installation

To install the grasp_pose-generator package, use pip:

pip install grasp-pose-generator

Build

To build the grasp-pose-generator package from source, follow these steps:

Steps

  1. Install Vcpkg and configure it on your system.

  2. Clone the Pybind11 repository into a dependencies directory in your project root:

    mkdir dependencies
    cd dependencies
    git clone https://github.com/pybind/pybind11.git
    
  3. Install the package:

    pip install .
    

This process will compile the C++ code using the Vcpkg dependencies and the Pybind11 bindings.

Usage

Here's a basic example demonstrating how to generate grasp poses for a given point cloud:

import numpy as np
import grasp_pose_generator as gpg

# Generate a random point cloud (replace with your actual point cloud data)
points = np.random.rand(3000, 3)  # n x 3 numpy array

# Parameters
num_samples = 10000
show_grasp = False
gripper_config_file = "path/to/gripper_params.cfg"  # Replace with the path to your gripper configuration file

# Generate grasps
grasps = gpg.generate_grasps(points, num_samples, show_grasp, gripper_config_file)

# Convert grasps to transformation matrices
pose_list = []
for grasp in grasps:
    pose = np.eye(4)
    pose[:3, 0] = grasp.get_grasp_approach()
    pose[:3, 1] = grasp.get_grasp_binormal()
    pose[:3, 2] = grasp.get_grasp_axis()
    pose[:3, 3] = grasp.get_grasp_bottom()
    pose_list.append(pose)

Ensure that you have a valid gripper configuration file. An example configuration file can be found in the gripper_params.cfg.

Example with a Simple Box

To visualize grasp generation on a simple box, you can run the provided example script:

python example/example.py

Press R during the visualization to see the generated grasp poses.

Build

Prerequisites

  • Python 3.11 or later
  • Vcpkg installed and configured
  • A C++ compiler (e.g., GCC, MSVC, Clang)

License

This project is licensed under the MIT License.

Acknowledgments

This package is an improved and extended version of the original pyGPG by Hongzhuo Liang. The core grasp generation functionality is based on the Grasp Pose Generator (GPG) by Andreas ten Pas.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grasp_pose_generator-1.0.1.tar.gz (443.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grasp_pose_generator-1.0.1-cp312-cp312-win_amd64.whl (22.7 MB view details)

Uploaded CPython 3.12Windows x86-64

File details

Details for the file grasp_pose_generator-1.0.1.tar.gz.

File metadata

  • Download URL: grasp_pose_generator-1.0.1.tar.gz
  • Upload date:
  • Size: 443.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for grasp_pose_generator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 291d796a9e76862b38004408f229f86829815bf2e771f14632140b9283d81676
MD5 d06a3b6843b0cb62295d02407c0be582
BLAKE2b-256 ac20aa2991b0828f301925cf49a3081c992e6106c7c463c8e15ff7c072be2ff2

See more details on using hashes here.

File details

Details for the file grasp_pose_generator-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for grasp_pose_generator-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8728e0e81ef9a0d8d4da94e8d5f1f9a421e9fb8f2f8b6b5919a4f8d219d9314b
MD5 c37ef3e2d1e7b75383143cdf1d65ee87
BLAKE2b-256 015f15d301e82d76d97d74f7e349df632e9f6bcb450fa375548fb3c324a56192

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page