Simple Python utility to convert hand model from GraspIt! to a ROS-compatible URDF. An example of the conversion of HumanHand20DOF.xml
from GraspIt! is included.
- Install GraspIt!
- Install the urdf_tutorial ROS package
- Run
python graspit2urdf.py --input_filename ${GRASPIT}/models/robots/HumanHand/HumanHand20DOF.xml
from thescripts
directory. This will produce a URDF file for the 20-dof Human Hand from GraspIt! in theurdf
directory. - Run
roslaunch urdf_tutorial display.launch model:=urdf/HumanHand20DOF.urdf
from the root of this repository. You should see GraspIt!'s 20-dof human hand model in Rviz, with sliders to manipulate the joints:
- Create a directory in
data
, named with the GraspIt! robot name (e.g.HumanHand20DOF
). It will hold the meshes and data files for your URDF model. - Convert all
.wrl
files from~/.graspit/models/robots/<ROBOT_NAME>/iv
into.stl
files of the same name (using Meshlab) and save them todata/<ROBOT_NAME>
. - Next, you need to find the inertia tensors and centers of mass of all the links.
- I have included a Meshlab script that computes these for you. In short, it first closes holes in the link mesh, ensures watertightness by doing a simple Poisson reconstruction, and then computes the required quantities.
- You can run it like so, from inside
data/<ROBOT_NAME>
:meshlab.meshlabserver -s info_script.mlx -i thumb2.wrl
. - It should print out the required physical quantities towards the end. You need to make a text file of the same name (e.g.
thumb2.txt
) containing the inertia tensor on the first line and the center of mass on the second line. See the included example files indata/HumanHand20DOF
. - For info about which values to include, see this article. The
1/s^5
scaling mentioned in that article is already implemented in the code.
- Next step is to convert! Run e.g. for the human hand:
python graspit2urdf.py --input_filename ~/.graspit/models/robots/HumanHand/HumanHand20DOF.xml
, and it should createHumanHand20DOF.urdf
in theurdf
directory for you. - You can test this URDF in Rviz by first installing the urdf_tutorial package and running
roslaunch urdf_tutorial display.launch model:=urdf/<your-urdf-file>.urdf
, as mentioned in this ROS Wiki article.