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).
Clone the repository with
git clone git@github.com:NVlabs/DefGraspSim.git
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
cd ~/Downloads
tar -xvzf IsaacGym_Preview_1_Package.tar.gz
cd isaacgym
xdg-open isaacgym/docs/index.html
Here is a summary of the commands to set up a virtual Python environment and install Isaac Gym into that environment.
Change to the root directory of this repository.
cd .../deformable_object_grasping
Install the virtual Python environment tool, virtualenv
.
pip3 install --user virtualenv
Create a new virtual environment called venv
.
virtualenv venv
Activate the venv
virtual environment.
. venv/bin/activate
Install Isaac Gym into the virtual environment.
cd .../isaacgym/python
pip3 install -e .
Confirm the Isaac Gym is installed.
python3 -c "import isaacgym"
The necessary Python packages are automatically installed when installing this package (see the Installing section below).
In the root directory of this repository, run:
pip3 install .
Activate the virtual environment (if it is not already active).
cd .../deformable_object_grasping
. venv/bin/activate
Install this package
pip3 install -e .
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_end - ori_start + 1)
environments, so keep this range small for faster runtime on your local machinerectangle
, sphere_flat_base
, ellipsoid
.pickup
is the grasp evaluation mode with the shortest runtime, and reorient
is the longestori_start
and ori_end
flagsThe 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)
There are four different grasp evaluations that can be performed:
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/
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
.
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.
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.
The h5 file containing the grasp poses must have the following structure:
'poses'
containing a numpy array of shape (num_grasp_poses, 7)[px, py, pz, w, x, y, z]
where px, py, pz
is the gripper position and w, x, y, z
are the quaternion components.assets
folderA 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
.