Using ikfast to generate IK solution without openrave

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Using ikfast to generate IK solution without openrave

Hey guys
I want to use ikfast to generate  the .cpp and .h solution for my robot - but without having to use the main openrave.package or binaries. Is this possible? Does someone have an example?

I have had a lot of trouble to get openrave to install  - either from the official install guide, or several other guides I have tried for Ubuntu 14.04
and https://scaron.info/teaching/installing-openrave-on-ubuntu-14.04.html

I see in the ikfast.py file this note: <snip>

Through Python

IKFast can also be used as a library in python. Generating 6D IK for the Barrett WAM while setting the 3rd joint free can be achieved with:

.. code-block:: python
  env = Environment()
  kinbody = env.ReadRobotXMLFile('robots/barrettwam.robot.xml')
  solver = ikfast.IKFastSolver(kinbody=kinbody)
  chaintree = solver.generateIkSolver(baselink=0,eelink=7,freeindices=[2],solvefn=ikfast.IKFastSolver.solveFullIK_6D)
  code = solver.writeIkSolver(chaintree)

.. _ikfast_generatedcpp:

but obviously it's an incomplete snip of code - I have no idea what Environment() is supposed to be.

Does anyone have a working example of using ikfast without dependence on the rest of openrave?

I understand that I will have to provide the kinematic model of my robot - which is no problem - I will happily write whatever is needed  if I can just get some pointers on whatever objects or structures I need to provide. I assume it would be some python structures with various quaternions and vectors for the links and joint angles,  or a bunch of matricies and link / joint names.

regarding my build failure:

when I try to build openrave, I get this:

In file included from /usr/local/include/ode/ode.h:30:0,
                 from /..... /openrave/plugins/oderave/plugindefs.h:101,
                 from /..... /openrave/plugins/oderave/oderave.cpp:15:
/usr/local/include/ode/common.h:59:2: error: #error You can only #define dSINGLE or dDOUBLE, not both.
 #error You can only #define dSINGLE or dDOUBLE, not both.

some parts must have worked because I can run the openrave stand alone binary,
and get a 3d window but opening files is horrendously slow - takes 30 sec or so just to show the file list. and seems really buggy.

 but if I try to run openrave.py I get:
Traceback (most recent call last):
  File "/usr/local/bin/openrave.py", line 49, in <module>
    import openravepy
  File "/usr/local/lib/python2.7/dist-packages/openravepy/__init__.py", line 33, in <module>
    openravepy_currentversion = loadstable(__openravepy_version__)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/__init__.py", line 14, in loadstable
    return _loadversion('_openravepy_'+ver.replace('.', '_'))
  File "/usr/local/lib/python2.7/dist-packages/openravepy/__init__.py", line 19, in _loadversion
    mainpackage = __import__("openravepy", globals(), locals(), [targetname])
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_0_9/__init__.py", line 29, in <module>
    from .openravepy_int import *
ImportError: No module named openravepy_int

which I assume is because of the build failure not compiling something that's needed.
Im hoping by using ikfast.py as a library to build my kinematics without openrave I can sidestep this problem.
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: Using ikfast to generate IK solution without openrave

This post was updated on .
Hi Vivian,

I do not know about generating IKFast without using OpenRAVE. But I was able to install OpenRAVE through scaron's website instructions. The one thing which I missed out the first time was to change the commit. scaron doesn't explicitly mention this. His instructions work for that particular commit though (Commit ID 5cfc744410adfee464a35d19964f525efb819552).

Follow his instructions from scratch and
Once you reach this command and clone the repo, ...
git clone --branch latest_stable https://github.com/rdiankov/openrave.git

... enter this command to checkout the particular commit mentioned in scaron's instructions.
git checkout 5cfc744410adfee464a35d19964f525efb819552
and then continue following his instructions.

Also, make sure that you're using either sympy version 0.7.0 or 0.7.1. You can check your version using
pip list | grep sympy

If your version is newer or older, use the following command to install the correct sympy version
sudo pip install sympy==0.7.1

Obviously, the commit ID 5cfc744410adfee464a35d19964f525efb819552 is quite old and we will be installing an older version of OpenRAVE. However, I needed OpenRAVE only for generating IKFast and so, I did not bother too much with installing the latest version.

Hope this helps.