LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Showing revision 4
This page describes how to use the ikfast inverse kinematics module from openrave system.

From the openrave web site, "OpenRAVE? provides an environment for testing, developing, and deploying motion planning algorithms in real-world robotics applications." For linuxcnc, we are using the ikfast module to create the IK component, and the qtcoin display application to show the robot model.


A modified version of the openrave source is available here, https://github.com/ftkalcevic/openrave, in the "linuxcnc_gen_c" branch. See the openrave web site for details of the build dependencies, and how to build and install the package. (http://www.openrave.org/docs/latest_stable/coreapihtml/installation_linux.html)

The modified version adds a c code generator that works with linuxcnc. Use the --outputlang=c to create the c code.

The ikfast updates to linuxcnc can be found here, https://github.com/ftkalcevic/LinuxCNC, in the "ikfast" branch. There is a new src/emc/kinematics/ikfastkins.c module that uses the ikfast generated code. There is also some example configurations in configs/ikfast-demo directory.

Building a robot model

openrave supports multiple file formats to describe the robot, http://www.openrave.org/docs/latest_stable/robots_overview/. The openrave xml is a simple format that allows models to be generated quickly. The COLLADA format allows you to generate more realistic looking robots.

Simple robot defined using openrave xml
same simple robot, but defined using collada file

The robot model is used in all openrave computations, including the generation of the ikfast source. Therefore it is important that it is created accurately.

The creator of openrave recommends opening an interactive openrave session and continually reloading the model...

$> openrave.py -i
In [1]: env.Reset(); env.Load('simple.robot.detailed.xml')

Generating and testing the Inverse Kinematics

The recommended way of generating the ik code is to use the openrave.py program, but advanced users can use ikfast.py directly. It is best to generate the cpp component first and use that for automatic testing. Automatic testing doesn't work with .c output.

For example, to generate the 3d translation ik...

$> openrave.py --database inversekinematics --robot=../simple.robot.xml --iktype=Translation
3D --freejoint=Wrist --freejoint=WristR --numiktests=1000

getIndicesFromJointNames [3, 4] ['Wrist', 'WristR']
openravepy.databases.inversekinematics: generate, Generating inverse kinematics 
for manip arm: Translation3D [0, 1, 2] (this might take up to 10 min)
openravepy.databases.inversekinematics: generate, creating ik file /home/frankt/

... Lots more output ....

openravepy.databases.inversekinematics: save, inversekinematics generation is do
ne, compiled shared object: /home/frankt/.openrave/kinematics.587828202130adcfd9
openravepy.databases.inversekinematics: RunFromParser, testing the success rate 
of robot ../simple.robot.xml 
[ikfastmodule.cpp:946] FindIKSolution: No ik solution found, i = 0
Joint Val: 0 0 0 0 0 
Transform: 855638019 0 0 0.4799 
raw ik command: 0 0 0 0 0 0 0 0 0 0 0 0.4799 0.2606354555368424 0.40057338399291

[ikfastmodule.cpp:1001] FindIKSolutions: No ik solution found for, i = 0
Joint Val: 0 0 0 0 0 
Transform: 855638019 0 0 0.4799 

openravepy.databases.inversekinematics: testik, success rate: 0.999000, wrong so
lutions: 0.000000, no solutions: 0.001000, missing solution: 0.000000

Specifying --numiktests runs a series of tests with the ik module to confirm it works correctly. I suspect the output shown above is a bug, as the first test coordinate looks dodgey. This is important because may ik solutions don't provide a very high success rate.

$> openrave.py --database inversekinematics --robot=../simple.robot.xml --iktype=Translation3D --freejoint=Wrist --freejoint=WristR? --outputlang=c

Barret Wam 7DoF? robot

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions | View current revision
Edited December 12, 2013 8:16 pm by Ftkalcevic (diff)
Published under a Creative Commons License