Grasping using PyBullet
Project description
Grasping with PyBullet
This package provides an interface for grasp planning using PyBullet. It includes a grasp planner that can generate grasp candidates for a given object.
Installation
Pure Python
- You can install the package using pip:
python3 -m pip install pybullet_grasper- when using python3.8 you might need to install upgrade pip and install development version of open3d
- Or clone this repository
git clone https://github.com/rustlluk/pybullet_grasper.git; go to src/pybullet_grasper and install it locally:python3 -m pip install -e .
ROS
- You can install the package in ROS1 Noetic workspace
- Clone the repository or put the pybullet_grasper folder (inside src of this repo) to src of your ROS workspace
- should be as
catkin_ws/src/pybullet_grasper- this includes setup.py, src, objects, etc.
catkin_buildit
- should be as
- Clone the repository or put the pybullet_grasper folder (inside src of this repo) to src of your ROS workspace
- See the repo of ShapeGrasp repo for Dockerfile and Docker installation instructions
Usage
Pure Python
- The easier option is to either:
- CLI in command line run
python3 -m pybullet_grasper.grasper_mainto see a demo of the grasp planner. This will print the results (if debug enabled) and/or save them to a file (if save_path provided)- possible command line options:
--object_name/-o: path to the .obj file- can be a relative path with respect to current folder, an absolute path, or a path related to installed path and be in pybullet_grasper/objects (when installed through pip it will be in sys.prefix/share/pybullet_grasper/objects)
--config_name/-c: path to .yaml config file- can be a relative path with respect to current folder, an absolute path, or a path related to installed path and be in pybullet_grasper/configs (when installed through pip it will be in sys.prefix/share/pybullet_grasper/config)
--ros/-r: whether to use ROS or not- if True, it will run the grasper as ROS node
- requires roscore running and rospy installed
--service/-s: call the ROS service- requires node with rosservice running
- here the object and config paths must be absolute, or the files must be located in ws/src/pybullet_grasper/configs and ..../objects, respectively
--save_path/-sp: path where to save the generated grasps; str or None- will be saved as file with values seperated by ";", so it is recommended to use .csv format
- if None -> nothing will be saved
- possible command line options:
- API you can import the package main as
from pybullet_grasper.grasper_main import mainand call itresult = main(object_name, config_name, ros=False, service=False), where:- object_name: path to the .obj file
- can be a relative path with respect to current folder, an absolute path, or a path related to installed path and be in pybullet_grasper/objects (when installed through pip it will be in sys.prefix/share/pybullet_grasper/objects)
- config_name: path to .yaml config file
- can be a relative path with respect to current folder, an absolute path, or a path related to installed path and be in pybullet_grasper/configs (when installed through pip it will be in sys.prefix/share/pybullet_grasper/config)
- ros: boolean, whether to run as a ROS node or not
- service: boolean, whether to call as ROS service or not
- save_path: str or None; path where to save the generated grasps
- will be saved as file with values seperated by ";", so it is recommended to use .csv format
- if None -> nothing will be saved
- result: pybullet_grasper.utils.GenerateGraspsResponse object
- see utils.py for details on the response object and its attributes
- see examples/example.py for usage
- object_name: path to the .obj file
- Low-level API you can import directly
from pybullet_grasper.grasp_generator import GraspGenerator- see grasper_main.py for usage
- CLI in command line run
ROS
- When you have ROS installed and the package installed, you can:
- ROS Node run the script as node (works the same as pure python basically, but uses ROS messages etc.)
- use either the CLI or API options described above, but with
--ros/-r(in CLI) or ros argument (API) set to True- see also grasper_main.py for low-level usage
- roscore must be running for this
- use either the CLI or API options described above, but with
- ROS Service call the ROS service to get grasp candidates
- to just test it, you can use the CLI (with
--service/-soption) or API (withservice=Trueargument) options described above - roscore and grasp_generator_service.py node must be running for this
- you can run
roslaunch pybullet_grasper main.launchto run the roscore and service
- you can run
- Otherwise, the service file is defined as:
and can be called as (see also example_service.py):std_msgs/String object_name std_msgs/String[] grasp_type float32[] init_position --- geometry_msgs/Pose[] poses float32[] qualities float32[] poses_after_grasps
or from the command line as:import rospy from pybullet_grasper.srv import GenerateGrasps, GenerateGraspsRequest if __name__ == "__main__": # Here the path must be absolute or the .yaml must be in ws/src/pybullet_grasper/configs and .obj in ws/src/pybullet_grasper/objects config_name = "example.yaml" object_name = "example.obj" rospy.init_node("grasp_generator_node") rospy.set_param("config_name", config_name) rospy.wait_for_service("generate_grasps") generate_grasps = rospy.ServiceProxy("generate_grasps", GenerateGrasps) request = GenerateGraspsRequest() request.object_name.data = object_name request.init_position = [0, 0, 0] result = generate_grasps.call(request)rosservice call /generate_grasps "{object_name: {data: 'example.obj'}, grasp_type: [{data: 'example.yaml'}], init_position: [0.0, 0.0, 0.0]}"
- to just test it, you can use the CLI (with
- ROS Node run the script as node (works the same as pure python basically, but uses ROS messages etc.)
Config files
The pacakge uses .yaml config files to specify both parameters of the grasp planner and visualization/debug options. The default one can be found in src/pybullet_grasper/configs/default.yaml The main things to change are:
- gripper: for now "robotiq" or "barrett"
- users can add new grippers adding the API in a similar form to the existing ones, available in bullet_classes.py
- debug: boolean; when True additional prints are shown. Also neccessary when visualization.show_last enabled
- visualization.show_last: boolean; when True, the best generated grasp candidate is visualized.
- Requires debug to be True as well.
- visualization.debug_sleep: float; when show_last is enabled, it will most probably run super fast. debug_sleep can make the rendering slower (0.01) is a good value on most machines
- analytical.enabled: boolean; when True, friction cones and GWS are computed (with epsilon-quality and GWS volume) and
can be shown in the visualizer if show_last is enabled
- very preliminary version, will most like not work every time
Input Meshes and Processing
- the input meshes must be in .obj format (Wavefront OBJ format). You can use third-party libraries like Meshlab, open3D, or Blender to convert your meshes to .obj format if they are in a different format.
- We further employ the VHACD library to perform convex decomposition of the meshes. This steps takes some time in the beginning. But it is necessary for detection collision of object and gripper properly
License
This work is licensed under a Creative Commons Attribution 4.0 International License.
See licences of the used libraries like PyBullet, Open3D, etc. for more details.
Citing
When used, please cite this repository as follows:
@misc{rustler2026shapegraspsimultaneousvisuohapticshape,
title={ShapeGrasp: Simultaneous Visuo-Haptic Shape Completion and Grasping for Improved Robot Manipulation},
author={Lukas Rustler and Matej Hoffmann},
year={2026},
eprint={2605.02347},
archivePrefix={arXiv},
primaryClass={cs.RO},
url={https://arxiv.org/abs/2605.02347},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybullet_grasper-0.0.2.tar.gz.
File metadata
- Download URL: pybullet_grasper-0.0.2.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d43bf8bbdb8234c736071de7915b9f08b677e4d2d765ac9d81f821e171f1c8f
|
|
| MD5 |
2c48f32f0276182608bb9f56edf8e35b
|
|
| BLAKE2b-256 |
5e31d909ac166a0503e767918efa8f57bb4b9e828c04a8fea129a4c43c7dc0e7
|
Provenance
The following attestation bundles were made for pybullet_grasper-0.0.2.tar.gz:
Publisher:
pypi.yaml on rustlluk/pybullet_grasper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybullet_grasper-0.0.2.tar.gz -
Subject digest:
7d43bf8bbdb8234c736071de7915b9f08b677e4d2d765ac9d81f821e171f1c8f - Sigstore transparency entry: 1440012203
- Sigstore integration time:
-
Permalink:
rustlluk/pybullet_grasper@193eebe8eab1c386f23006d421540437ccd40e15 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rustlluk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@193eebe8eab1c386f23006d421540437ccd40e15 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pybullet_grasper-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pybullet_grasper-0.0.2-py3-none-any.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2a94c264e34dd06fbe6623835b2e22c1e5730d9cb2cf711ef9cfba8c59c7c90
|
|
| MD5 |
fb4245961cacea4658375bd545a2d509
|
|
| BLAKE2b-256 |
1fb13eafd3ad7a8233bc83e22d43915493981ad16c7cfad9c7f91499af1ba114
|
Provenance
The following attestation bundles were made for pybullet_grasper-0.0.2-py3-none-any.whl:
Publisher:
pypi.yaml on rustlluk/pybullet_grasper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybullet_grasper-0.0.2-py3-none-any.whl -
Subject digest:
b2a94c264e34dd06fbe6623835b2e22c1e5730d9cb2cf711ef9cfba8c59c7c90 - Sigstore transparency entry: 1440012205
- Sigstore integration time:
-
Permalink:
rustlluk/pybullet_grasper@193eebe8eab1c386f23006d421540437ccd40e15 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/rustlluk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@193eebe8eab1c386f23006d421540437ccd40e15 -
Trigger Event:
workflow_dispatch
-
Statement type: