Note: This tutorial is just one step of the larger Create_a_Fast_IK_Solution tutorial.
(!) Please ask about problems and questions regarding this tutorial on Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

IKFast Plugin for moveIt!

Description: Create a plugin that wraps the IKFast solver for use in moveIt!

Tutorial Level: BEGINNER

A new version of the IKFast Generator streamlined for Catkin and MoveIt! is documented here. It is recommended to use that version. This page is kept for archival purposes.

You should have already created a moveIt! package for your robot, by using the Setup Assistant and following this Tutorial. The package should have a name like 'myrobot_moveit_config'.


Plugin Package Location

First, you'll need to decide where to put the IKFast solver and plugin files. In the arm_navigation plugin Tutorial, these files went in the myrobot_arm_navigation package. Here are a few things to consider:

  • the myrobot_arm_navigation package should ideally remain independent of moveit

  • the myrobot_moveit_config package is generated as a catkin package

    • this package can be mixed in a rosbuild stack, since it doesn't need compiling
    • adding plugin files complicates the build infrastructure, since they do need compiling

  • the pr2 kinematics plugins are provided in a standalone pr2_moveit_plugins package

The examples in this Tutorial assume the model used for the pr2 robot, with a standalone package for the moveit plugins. However, the plugin generator should be flexible enough to allow the plugins to be hosted in one of the other packages, if desired. You also should be able to host multiple plugins in the same package, if you'd like to use a single plugin-package for multiple different kinematic variants/models (e.g. from the same manufacturer). NOTE: the plugin generator currently is only capable of generating rosbuild configuration files, so will not produce valid results for catkin-based packages (e.g. myrobot_moveit_config).

If necessary, you should also create the package (and its associated template configuration files) at this time:

$ roscreate-pkg [package_name]

Create Plugin

We will create the plugin inside the plugin package (<plugin_package>) you created earlier.

  1. Create new directories:
    $ roscd <plugin_package>
    $ mkdir include src
  2. Copy the IKFast-generated source file to the newly-created src directory:

    $ cp /path/to/ikfast61-output.cpp src/my_robot_manipulator_ikfast_solver.cpp

    NOTE: The resulting filename must be of the form: <robot_name>_<group_name>_ikfast_solver.cpp, where group_name is the name of the kinematic chain you defined while using the Wizard. For single-arm robots, this should have been named manipulator as per ROS standards.

  3. Copy the IKFast header file (if available) to the new include directory:

    $ cp <openravepy>/ikfast.h include/ikfast.h
  4. Create the plugin source code:
    $ rosrun arm_kinematics_tools <robot_name> <plugin_package>
      - OR -
    $ python /path/to/ <robot_name> <plugin_package>   (works without ROS)

    This will generate a new source file <robot_name>_<group_name>_ikfast_moveit_plugin.cpp in the src/ directory, and modify various configuration files.

  5. Build the plugin library:
    $ rosmake <plugin_package>

This will build the new plugin library lib/lib<robot_name>


The IKFast plugin should function identically to the default KDL IK Solver, but with greatly increased performance. You can switch between the KDL and IKFast solvers using the kinematics_solver parameter in the robot's kinematics.yaml file:

$ roscd my_robot_moveit_config
$ <edit> config/kinematics.yaml

  kinematics_solver: my_robot_manipulator_kinematics/IKFastKinematicsPlugin
  kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin

Test the Plugin

Repeat these tests from the moveIt! package tutorial to verify that the robot responds as expected in both interactive and planning modes.

Wiki: Industrial/Tutorials/Create_a_Fast_IK_Solution/moveit_plugin (last edited 2015-11-03 19:08:44 by ShaunEdwards)