Skip to content

GraspIt CPP API

Jennifer Buehler edited this page Jul 19, 2018 · 6 revisions

The package grasp_planning_graspit provides a C++ interface to GraspIt!. It offers an API to manage access to the GraspIt world and scene, and to the graspit planning algorithms. At the moment, support for the Eigengrasp planner is provided. Access to other GraspIt! features will be added over time.

There is no need to use the graphical interface with this C++ API. Though unfortunately, Qt libraries are still required, because removing Qt dependencies completely from the GraspIt! source is not trivial. It heavily depends on Qt classes and on signals and slots. However, this package allows the GraspIt! algorithms to be used without the need to display a graphical interface. Only the Qt signals and slots, and some Qt classes (e.g. QString) are used.

The grasp_planning_graspit package is a C++ library independent of ROS. The only "dependency" is that CMakeLists.txt contains catkin commands, so the library can be built with catkin for convenience.

Installation

You can find installation instructions on this wiki page. It is recommended that you also generate the doxygen documentation as described in the instructions.

Getting started

A good starting point is this tutorial for using the API. It explains how to run the planner with the GraspIt! API.

You can find documentation to the API in the doxygen HTML files which you generated during installation.

Start by reading the documentation of the following classes:

  • GraspIt::GraspItSceneManager
  • GraspIt::GraspItAccessor
  • GraspIt::EigenGraspPlanner

You can find another example on how to use the EigenGraspPlanner in grasp_planning.cpp.

Inspecting results

You may inspect the inventor files:

rosrun urdf_viewer urdf_viewer_node <path-to-iv-file> --iv

or open the graspit simulator which you can use to open the world file:

graspit_simulator

For more instructions on how to use the original GraspIt! simulator, also refer to this tutorial.

Importing your own robot

Before you can use the planner on your robot, you need to convert it from URDF to the GraspIt! format. You can do this with the urdf2graspit package.

It is also important that you adjust your robot Eigengrasps, as the current source uses the GraspIt! Eigengrasp planner to plan for grasps. See also the urdf2graspit package for comments on this. The Eigengrasps must load from within your GraspIt! robot XML file.

Simple example files can also be found for the Kinova Jaco hand in here.

The contact points in the jaco example files (and others generated with urdf2graspit) may still not be optimal, so the grasp planning may not work perfectly. This is an issue which I will look into.

ROS Wrapper

You may also be interested in the ROS wrapper for this API which you can find in grasp_planning_graspit_ros. It contains sample code to access the interface and also offers ROS services and some launch files which will make it easier for you to get started.