Difference between revisions of "Custom IKFast for your Baxter"

From sdk-wiki
Jump to: navigation, search
(CreateDAEs for Each Arm)
(CreateDAEs for Each Arm)
Line 18: Line 18:
 
== Modify Simplified URDFs with your robot's joints ==
 
== Modify Simplified URDFs with your robot's joints ==
  
== CreateDAEs for Each Arm ==
+
== Create DAEs for Each Arm ==
 
Create our DAEs for each arm:<br/>
 
Create our DAEs for each arm:<br/>
 
<code>sudo aptitude install ros-indigo-robot-model</code><br/>
 
<code>sudo aptitude install ros-indigo-robot-model</code><br/>

Revision as of 20:41, 17 June 2015

Overview

Every Baxter's URDF is slightly different. This tutorial will show you how to generate IKFast for use with MoveIt specific to your Baxter. This is a fairly involved process, requiring many steps. For additional background information on the algorithm behind IKFast, please see Rosen Diankov's Doctoral thesis.

What is IKFast?

#ikfast IKFast provides analytical closed-form solutions for manipulator inverse kinematics. Part of the OpenRAVE robot architecture/software framework, IKFast has been used to provide closed-form solutions for Baxter's inverse kinematics. Advantages include order of magnitude faster IK solutions and the ability explore the manipulator's null space!

Using Baxter's MoveIt! IKFast plugins

Please see MoveIt_Tutorial#IKFast for the exact commands required to enable IKFast in your baxter_moveit_config package.

Generating Custom IKFast for Baxter

Install OpenRAVE

As of this writing, the instructions for adding the openrave PPA and installing openrave debians does not work on Ubuntu Trusty since the latest release was created in 2012 for Precise. That leaves building from source as the only option. Please clone the OpenRAVE repo and follow this tutorial for building from source:

 git clone --branch latest_stable https://github.com/rdiankov/openrave.git

If you encounter any issues in building this repo, please let the developers know in the issues tab of their repo.


Modify Simplified URDFs with your robot's joints

Create DAEs for Each Arm

Create our DAEs for each arm:
sudo aptitude install ros-indigo-robot-model

  • Note: Please use the a striped down version of the urdf to only contain each manipulators links/joints modified with your robot's arm mount joint extracted above

rosrun collada_urdf urdf_to_collada baxter_arm.accurate.left.urdf baxter_arm.left.dae

  • The resulting DAE also needs some hand tuning - specifically the rotational portions of the description. Round values logically (ie. 119.9999999999999 to 120.0)

Please take note of the link indices using the following command:
$ openrave0.9-robot.py baxter_arm.left.dae --info links

name index parents


base 0 right_arm_mount 1 base right_upper_shoulder 2 right_arm_mount right_lower_shoulder 3 right_upper_shoulder right_upper_elbow 4 right_lower_shoulder right_lower_elbow 5 right_upper_elbow right_upper_forearm 6 right_lower_elbow right_lower_forearm 7 right_upper_forearm right_wrist 8 right_lower_forearm right_hand 9 right_wrist right_gripper 10 right_hand


name index parents


Likewise with the joints:
$ openrave0.9-robot.py baxter_arm.left.dae --info joints name joint_index dof_index parent_link child_link mimic


right_s0 0 0 right_arm_mount right_upper_shoulder right_s1 1 1 right_upper_shoulder right_lower_shoulder right_e0 2 2 right_lower_shoulder right_upper_elbow right_e1 3 3 right_upper_elbow right_lower_elbow right_w0 4 4 right_lower_elbow right_upper_forearm right_w1 5 5 right_upper_forearm right_lower_forearm right_w2 6 6 right_lower_forearm right_wrist right_torso_arm_mount -1 -1 base right_arm_mount right_hand -1 -1 right_wrist right_hand right_endpoint -1 -1 right_hand right_gripper


name joint_index dof_index parent_link child_link mimic

Choose IK Type

Choose our IK Type (ex: Transform6D, Rotation3d, Translation3D, etc.) http://openrave.org/docs/latest_stable/openravepy/ikfast/#ik-types We will use transform6D - Baxter's end effector reaches desired 6D transformation

Extracting the Mount Joint Transform

The left and right arm mount joint's in Baxter's torso are hand-welded at manufacture time. These joints are carefully measured and the transforms are stored in your Baxter's torso joint board. Fortunately, we can see the transforms in your robot's URDF located in the /robot_description parameter on the param server. After a fresh boot (to ensure the custom URDF has not been overwritten), from a properly initialized Baxter environment, export the URDF from the /robot_description parameter on the ROS parameter server where it is stored, to a file of your choice (ex: baxter_urdf.xml):

$ rosparam get -p /robot_description | tail -n +2 > baxter_urdf.xml

The -p outputs the parameter using pretty print. The output urdf is piped through the tail command first to remove a dummy first line - an artifact of the pretty print.


Open baxter_urdf.xml in your favorite text editor, and search for torso_arm_mount to find the only joints that differ from Baxter to Baxter. This is an example of what you should expect if the robot description contains Baxter's custom joints:

<joint name="left_torso_arm_mount" type="fixed">
    <origin xyz="0.0229088 0.220982 0.106714" rpy="-0.0179406 0.0117677 0.786034" />
    <axis xyz="0 0 0" />
    <parent link="torso" />
    <child link="left_arm_mount" />
</joint>

and

<joint name="right_torso_arm_mount" type="fixed">
    <origin xyz="0.0245182 -0.218624 0.10866" rpy="-0.00321838 -0.00564277 -0.78571" />
    <axis xyz="0 0 0" />
    <parent link="torso" />
    <child link="right_arm_mount" />
</joint>

Save these snippits of URDF for the next steps.


  • Note: If you see the following joint values, then you are using the generic URDF provided in baxter_description of the SDK. This can happen if the generic URDF is loaded to the param server via a roslaunch script (such as the one with MoveIt). Reboot your robot to clear the robot_description and try again:
    <joint name="left_torso_arm_mount" type="fixed">
        <origin rpy="0 0 0.7854" xyz="0.024645 0.219645 0.118588"/>
        <parent link="torso"/>
        <child link="left_arm_mount"/>
    </joint>
    <joint name="right_torso_arm_mount" type="fixed">
        <origin rpy="0 0 -0.7854" xyz="0.024645 -0.219645 0.118588"/>
        <parent link="torso"/>
        <child link="right_arm_mount"/>
    </joint>