Skip to content

Eigengrasp planner example

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

This introductory tutorial will run the GraspIt! Eigengrasp planner on the example Kinova Jaco hand. The aims are to show:

  • how the planning works and which results are obtained for the example Jaco hand.
  • how to inspect the results.

Planning prerequisites

In order to plan grasps for your robot, you will need to have a description of the robot in the GraspIt format. The urdf2graspit package can be used to convert your robot from urdf.

For this tutorial you are going to be using the example graspit files for the Kinova Jaco hand. You can find them in the directory jaco_graspit_sample.

Important: Make sure that you have set the $GRASPIT environment variable to the jaco_graspit_sample directory, or added softlinks to the jaco graspit files as descibed in the instruction on this wiki page.

Run the planner

An example program grasp_planning is avaialble which you may use to run the GraspIt! Eigengrasp planner. The more advanced C++ API Tutorial will produce a similar program and get you started on how to access the full functionality from C++.

The executable grasp_planning will save the results as files to disk. Result files provide a great way to inspect the results after the planning has finished, although the C++ API itself does not require to save the results on disk.

This tutorial will cover running the planner (1) with, or (2) without ROS.

(1) With ROS

There is an example launch file readily available for the Jaco example. You may inspect the graspit_planner_jaco_example.launch to see the options provided.

roslaunch grasp_planning_graspit_ros graspit_planner_jaco_example.launch \
    results_output_directory:=<your-results-directory>

Watch the program output and observe that the energy values are going down. For the Jaco example, it should converge to a value of 40-50. The energy is a measure of the grasp quality.

When the planner is finished, you can find the graspit world files and the inventor files in <your-results-directory>.

Note that the references to the robot files are absolute paths in the current version, so to view them in the simulator you will have to set the GRASPIT environment variable to empty so you can view the files. A future update will handle this issue.

(2) Without ROS

The executable grasp_planning has been installed with the grasp_planning_graspit package. The following assumes that the bin directory of the installation is in your $PATH (the lib directory of the installation has to be in LD_LIBRARY_PATH), and you have set the GRASPIT environment variable to point at the directory jaco_graspit_sample:

grasp_planning --help

Specify the world file to be planned on after the argument --wld, and the results directory after --dir:

grasp_planning --wld <path-to-jaco_graspit_sample>/worlds/jaco_robot_world.xml \
    --dir <your-results-directory>

Watch the program output and observe that the energy values are going down. For the Jaco example, it should converge to a value of 40-50. The energy is a measure of the grasp quality.

When the planner is finished, you can find the graspit world files and the inventor files in <your-results-directory>.

Inspect the results

You can open the graspit world files with the graspit simulator which is the executable graspit_simulator which was installed with the graspit package.

graspit_simulator

Open the world file you would like to inspect with File -> Open. You can learn more about the GraspIt! simulator in the GraspIt! simulator tutorial.

Alternatively, you may open the .iv inventor files with any inventor file viewer of your choice. If you are using ROS, an example simple inventor viewer is available in the package [urdf_viewer][urdf_viewer], you just need to pass the lag --iv to enable viewing an inventor file instead of a URDF:

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

Where to next?

You now have used the simple graspit planner executable to start the planning directly. You may alternatively also use ROS services to access the planner and manage your robots and objects in a database. This is going to be described in the GraspIt! ROS services tutorial.

If you are not using ROS, you may want to look at the C++ API tutorial.