How to do it…

We can choose which sort of IK would be appropriate for our model by referring to the following page: http://openrave.org/docs/latest_stable/openravepy/ikfast/#ik-types. However, the most common IK type is transform6d.

We have to provide link index numbers for the base_link and end_link between which the IK will be calculated. We can count the number of links by checking them in the .dae file. Alternatively, if we have OpenRAVE installed, we can view a list of links in our model:

 $ openrave-robot.py my_robot.dae --info links

As usual, the 6-DOF manipulator should have six arm links and a dummy base_link, as required by ROS specifications. If there are no extra links present in the model, this gives baselink=0 and eelink=6. Generally, an additional tool_link will be provided to position the grasp-tool frame, setting it as eelink=7.

The following manipulator also has another dummy mounting_link, providing baselink=1 and eelink=8:

Manipulator link number

To generate the IK solution between the manipulator's base and tool frames for a 6 DOF arm, we can use the following command format:

$ python `openrave-config --python-dir`/openravepy/_openravepy_/ikfast.py --robot=<myrobot_name>.dae --iktype=transform6d --baselink=1 --eelink=8 --savefile=<ikfast_output_path>

<ikfast_output_path> is recommended to be a path that points to a file named ikfast61_<planning_group_name>.cpp.

Similarly, for a 7 DOF arm, we would have to specify a free link:

$ python `openrave-config --python-dir`/openravepy/_openravepy_/ikfast.py --robot=<myrobot_name>.dae --iktype=transform6d --baselink=1 --eelink=8 --freeindex=4 --savefile=<ikfast_output_path>

However, the speed and success of this process will depend on the complexity of our robot.

A typical 6 DOF manipulator with three intersecting axes at the base or wrist will take only a few minutes to generate the IK.

Moreover, we can consult the OpenRAVE mailing list and ROS Answers for information about 5 and 7 DOF manipulators.

Next, we will create the package that will contain the IK plugin. We will name the package <myrobot_name>_ikfast_<planning_group_name>_plugin, so that we can refer to our IKFast package simply as <moveit_ik_plugin_pkg> later:

$ cd ~/catkin_ws/src
$ catkin_create_pkg <moveit_ik_plugin_pkg>

Now, we will build our workspace so that the new package is detected:

$ cd ~/catkin_ws
$ catkin_make

Next, we will create the plugin source code:

$ rosrun moveit_ikfast create_ikfast_moveit_plugin.py <myrobot_name> <planning_group_name> <moveit_ik_plugin_pkg> <ikfast_output_path>

We use the following parameters:

  • myrobot_name: Name of the robot as in our URDF
  • planning_group_name: Name of the planning group, as referenced in our kinematics.yaml file
  • moveit_ik_plugin_pkg: Name of the new package we have just created
  • ikfast_output_path: File path to the location where we have generated the IKFast output.cpp file

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

Finally, we will build our workspace again to create the IK plugin:

$ cd ~/catkin_ws
$ catkin_make

This will build the new plugin library lib/lib<myrobot_name>_<planning_group_name>_moveit_ikfast_moveit_plugin which can be used with MoveIt!.

The IKFast plugin should function identically to the default KDL IK Solver, but with greatly increased performance. The MoveIt! configuration file is automatically edited by the moveit_ikfast script, but we can switch between the KDL and IKFast solvers using the kinematics_solver parameter in the robot's kinematics.yaml file. For example:

$ rosed <myrobot_name>_moveit_config/config/kinematics.yaml

Edit these parts:

<planning_group_name>: 
  kinematics_solver: <moveit_ik_plugin_pkg>/IKFastKinematicsPlugin 
-OR- 
  kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin 

Moreover, we can use the MoveIt! rviz Motion Planning plugin and use the interactive markers to see if the correct IK solutions are generated.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.107.90