|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 answers.ros.org. 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 Prerequisite InstallationDescription: Steps to install prerequisites for building an IKFast solver
Tutorial Level: BEGINNER
This page describes installation of prerequisites required to build an IKFast analytic inverse-kinematics solver. It includes instructions on both installing from Ubuntu packages as well as installing from direct source-code repositories.
Install ROS packages
The following packages may be required to prepare models for IKFast and validate the resulting performance:
e.g. for ROS Fuerte:
$ sudo aptitude install ros-fuerte-xacro ros-fuerte-robot-model ros-fuerte-arm-navigation
Note for ROS Fuerte Arm Navigation Users
ROS Fuerte users should note that there are conflicts between arm-navigation and moveit. These conflicts cause compilation of the kinematic server patch (see below) to fail and a message md5 error related to the kinematic_msgs/GetKinematicSolver message when using the plugin. The solution is to uninstall moveit if you are using arm_navigation. For more information, see this question on ROS Answers. This bug should not affect electric or groovy.
OpenRAVE uses the python symbolic math library (sympy) for many of its calculations. Different versions of OpenRAVE require different versions of sympy:
- OpenRAVE 0.8.2 (IKFast 61) : sympy 0.7.0
- OpenRAVE 0.6.? (IKFast 54) : sympy 0.6.7
You'll need to decide whether to install sympy from distribution packages or from the source repositories. Instructions for both methods are given below.
Sympy from Packages
First, check to see what version of sympy is provided by your distribution. Many Ubuntu distributions include the correct version already.
$ sudo aptitude versions python-sympy
If the version matches, you can install the default sympy package for your distribution:
$ sudo aptitude install python-sympy
Otherwise, you can manually download and install a package from a later distribution:
$ sudo dpkg -i python-sympy_0.7.1.rc1-2_all.deb
Sympy from Source
Check current version of Sympy and remove it.
$ sudo find /usr -name "sympy*" $ sudo rm -rf /usr/lib/python2.7/dist-packages/sympy $ sudo rm /usr/lib/python2.7/dist-packages/sympy-<VERSION>.egg-info
Download the appropriate version of sympy from here. Then install sympy manually:
$ tar zxvf sympy-<VERSION>.tar.gz $ cd sympy-<VERSION> $ sudo python setup.py install
Install OpenRAVE IKFast
Decide whether you'd like to install IKFast from source or repository-packages. Also, whether you'd like the full OpenRAVE package or only the IKFast component.
You don't need to install the full OpenRAVE to use IKFast. However, if you plan to use other capabilities like the model viewer or simulator, you should install the full OpenRAVE.
Finally, you'll need to choose which version of IKFast to install. This tutorial was developed using OpenRAVE 0.8.2 (IKFast 61).
OpenRAVE from Packages
Add the OpenRAVE ppa to your list of available sources, and install the desired package:
sudo apt-add-repository ppa:openrave/release (if needed) sudo aptitude install openrave0.8-dp-ikfast (for IKFast 61)
NOTE: The openrave PPA provides a newer version of assimp-dev (3.0) that breaks some of the existing ROS packages (e.g. geometric_shapes). It may be helpful to freeze your assimp-dev package version to prevent undesired upgrades: sudo apt-mark hold assimp-dev.
OpenRAVE from Source
1. Download the desired version of OpenRAVE from here.
1. Extract the tarball under your working directory. e.g.
$ tar jxvf openrave-<VERSION>-linux-src.tar.bz2
Install Plugin Generator
The IKFast plugin generator is contained within the arm_kinematics_tools package. Download and install this package inside your ROS workspace:
$ svn co http://kaist-ros-pkg.googlecode.com/svn/trunk/arm_kinematics_tools/ arm_kinematics_tools
Patch the Kinematics Server
NOTE: This step is "optional", but will prevent a known Segmentation Fault crash in some situations. It is only appropriate for users of arm_navigation, and is not required for moveit. The patch has been tested under fuerte, but not yet under groovy.
There is a bug in the forward kinematics routine of arm_kinematics_constraint_aware that can cause it to crash. This bug can be fixed by applying the patch as follows:
$ roscd arm_navigation $ sudo chown -R USERNAME:USERNAME arm_kinematics_constraint_aware/ $ cd arm_kinematics_constraint_aware/ $ sudo wget https://code.ros.org/trac/ros-pkg/raw-attachment/ticket/5586/fk_solver.patch $ sudo patch -p1 < fk_solver.patch $ rm ROS_NOBUILD $ rosmake -i arm_kinematics_constraint_aware
Also note that by default, the arm_kinematics_constraint_aware node uses ROS TF for forward kinematics. The above patch also restores the ability to use the FK routine from KDL of IKFast. To use the plugin's own FK, edit constraint_aware_kinematics.launch in <robot_name>_arm_navigation/launch. Under the kinematics_solver param, add a new line:
<param name="use_plugin_fk" type="bool" value="true" />
Test the Installation
Depending on the installation method used, the path to ikfast.py may differ. This tutorial uses <openravepy> to refer to the ikfast.py installation directory.
source install: openrave-0.8.2-src/python
package install: /usr/lib/python2.7/dist-packages/openravepy/_openravepy_0_8
Test the IKFast installation using a test run:
$ python <openravepy>/ikfast.py --help
If you get errors about missing attribute '_openravepy_', it may be due to a flaw in the openrave Ubuntu package. Generate the missing symlink as follows, and rerun the test:
cd /usr/lib/python2.7/dist-packages/openravepy ln -s _openravepy_0_8 _openravepy_
When the test succeeds, ikfast prints its command-line usage info. Continue on with the remaining steps in the Create_a_Fast_IK_Solution tutorial.