NVlabs / DefGraspSim

This package provides a framework to automatically perform grasp tests on an arbitrary object model of choice.
MIT License
120 stars 24 forks source link

Deformable Object Grasping

This module provides a framework to automatically perform grasp tests on an arbitrary object model of choice. The details of these grasp tests can be found in our paper "What Makes a Good Grasp on a Deformable Object?". (link to pre-print to be added). For a full example walkthrough, see examples/example.md.

There are four different grasp evaluations to choose from (see Grasp Evaluations section). The user should prepare a mesh of their object of choice as well as an h5 file of all candidate grasps (see User Inputs section). Results of the grasp evaluation are saved in a particular format depending on the evaluation run (see File Structure section)

Example execution of a reorient test on a banana starting from when the desired squeezing force is achieved (x10 speedup).

Requirements

Installation

Clone Repo

Clone the repository with

git clone git@github.com:NVlabs/DefGraspSim.git

Download necessary files from drive

Note that this repository uses files that are stored on Google Drive and get stored in the drive_files folder. Running the get_drive_files.sh script from the root of the repository will download and extact the files to the correct location.

cd .../deformable_object_grasping
./get_drive_files.sh

Install Requirements

Installing Isaac Gym

Summary of commands to install Isaac Gym into a Python environment

Here is a summary of the commands to set up a virtual Python environment and install Isaac Gym into that environment.

Installing Python packages

The necessary Python packages are automatically installed when installing this package (see the Installing section below).

Installing

In the root directory of this repository, run:

pip3 install .

Summary of commands to install this package into a Python environment

Usage

Each grasp test is run for one object and one grasp candidate with the run_grasp_evaluation executable script.

For usage summary, run:

run_graps_evaluation -h

Example usage:

run_grasp_evaluation --object=rectangle --grasp_ind=3 --youngs=2e5 --density=1000 --ori_start=10 --ori_end=10 --mode=reorient --write

Notes for those who are trying out the code:

ori_start and ori_end flags

The reorient, linear acceleration (shake), and angular acceleration (twist) tests involve the choice of vector directions. These are 16 regularly spaced vectors in a unit sphere as depicted below. --ori_start and --ori_end denote the range of vectors to simulate in parallel (inclusive)

Types of grasp evaluations

There are four different grasp evaluations that can be performed:

  1. Pickup. The gripper grasps the object and squeezes. Once sufficient force is achieved, the support plane lowers. The evaluation ends once the object is no longer in contact with the plane.
  2. Reorient. After pickup, the gripper rotates about the associated vector. The evaluation ends once the gripper has rotated by pi radians.
  3. Linear acceleration. After pickup, the gripper linearly accelerates with a constant jerk in the direction of the associated vector. The test ends once the gripper loses contact with the object.
  4. Angular acceleration. After pickup, the gripper angularly accelerates with a constant jerk about the associated vector. The test ends once the gripper loses contact with the object.

Storage of results

When the --write flag is set, then the results of each instance of the script are stored in the corresponding object subfolder, ie. in `results/.

Creating master result files

Each time run_grasp_evaluation.py is run with the --write flag, one file is generated in the RESULTS_DIR folder under a subfolder with the object name and an additional (optional) RESULTS_STORAGE_TAG. Within the <RESULTS_DIR>/<object_name> folder, the results files are automatically sorted into subfolders according to their elastic modulus. Run make_master_h5s.py in the root directory. Note that you will have to first change the OBJ_RESULTS_DIR in the script to be equal to the <RESULTS_DIR>/<object_name> directory of interest. This script will create master files for each type of grasp evaluation within each elastic modulus subfolder. These master files will be named: pickup_master.h5, reorient_master.h5, shake_master.h5, twist_master.h5.

Results file structure of H5 Datasets

All datasets in the h5 files have the first dimension as equal to the number of tested grasps. For each entry (corresponding to each grasp), the following data is stored:

Pre-contact

Pre-pickup (once desired squeezing force is achieved)

Post-pickup

Reorientation

Linear acceleration

Angular acceleration

Misc.

User inputs

The user must provide the object mesh in the .tet format, as well as a set of Panda hand candidate grasp poses saved in a .h5 file.

_grasps.h5

The h5 file containing the grasp poses must have the following structure:

assets folder

A subfolder for new object should be added under the assets folder and named <object_name>. This folder should store the input files <object_name>.tet, <object_name>_grasps.h5.