This repository contains the implementation of the paper:
DiPGrasp: Parallel Local Searching for Efficient Differentiable Grasp Planning
Wenqiang Xu, Jieyi Zhang, Tutian Tang, Zhenjun Yu, Yutong Li, Cewu Lu (* = Equal contribution)
IEEE Robotics and Automation Letters
The code could run on both Linux and Windows system.
Install anaconda or miniconda. Supposing that the name dipgrasp
is used for conda environment:
conda create -n dipgrasp python=3.10
conda activate dipgrasp
Then, install dependencies with pip install
pip install -r requirements.txt --no-deps
We upload the objects mentioned in paper and some essential components on https://huggingface.co/datasets/robotflow/DipGrasp
You can follow the instructions to download the assets.
After downloading, you should move the assets
directory to the project main directory:
mv path/to/assets .
Please use the following command to install the dependency libraries for RFUniverse:
sudo apt install minizip libc6-dev
If you are using Ubuntu 22.04, you’ll also need to run this additional command:
sudo ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
This version is structured to guide users step-by-step, making it easy to follow.
You can run the following command to generate the grasp pose:
python main.py
We use Schunk SVH hand as our default gripper. You could see the object and the gripper with generated pose after it generate each batch of pose.
The output pose will be saved at output
directory, consisting of two numpy files pose.npy
and joint_state.npy
. The pose.npy
contains a numpy array with shape (N, 4, 4)
,
while the joint_state.npy
contains a numpy array with shape (N, D)
, where N
is the number of generated poses and the D
is the DoF of the gripper.
To generate the pose with other grippers, you could use the following command:
python main.py gripper=shadow
where the shadow
could be repleced by svh
or barrett
.
To get the subtle and stable pose where the gripper contacts with the object surface, we use the RFUniverse as the simulator to refine the generated poses. You can use the following command to get the refined poses:
python main.py datafile=assets/object/class/drink/drink9/drink9.obj simulator=True visualize_setting.visualize=False visualize_setting.visualize_after_simulator=True
You may notice that we change the target object file, because the simulator needs a mesh file rather than pointcloud.
To generate a large number of poses on different objects, we provide a script file, you can run the following command to generate the poses:
python scripts/generate_for_batch_obj.py
The poses saved have passed through the simulator by default.
You could also alter the gripper type by adding gripper
parameter.
The number of generated poses will be logged into results.log
.
You could generate grasp poses on your own objects by modifying the script. The simulator only supports object with .obj format.
If you're interested in applying our algorithm to your custom hand model, you can easily do so by following these steps:
Generate the Point Cloud XML File:
assets/xml_generator
directory. For detailed instructions, check out this document.Organize Your Files:
assets/gripper
directory. Ensure they follow the same format as the hand models we currently support.Update Configuration Files:
conf/gripper
directory, similar to the existing gripper configuration files.Modify the Main Script:
Adjust Initial Position Settings:
init_sample_config
function in config.py and look at the correct_coordinate
function in samplePosition.py for guidance.By following these steps, you'll be able to integrate your custom hand model into our system.
If you find our code or paper useful, please consider citing
@article{dipgrasp,
title = {DiPGrasp: Parallel Local Searching for Efficient Differentiable Grasp Planning},
author = {Xu, Wenqiang and Zhang, Jieyi and Tang, Tutian and Yu, Zhenjun and Li, Yutong and Lu, Cewu},
journal = {IEEE Robotics and Automation Letters},
year = {2024},
publisher = {IEEE},
}
}