Fwd: orocos kdl python binding

Forwarding this to the orocos-users list: anyone succeeded on
importing PyKDL in MacOSX?

Ruben

---------- Forwarded message ----------
From: Mirko Bordignon <mirko [dot] bordignon [..] ...>
Date: Wed, Mar 10, 2010 at 7:40 PM
Subject: orocos kdl python binding
To: Ruben Smits <Ruben [dot] Smits [..] ...>

Hi Ruben,
great job with orocos and kdl in particular.
One quick question: I'm able to compile kdl 1.0.2 with python bindings
on my mac, and a PyKDL.dylib is created inside the usual site-packages
folder.
However, when I do an import PyKDL, it cannot find the library. Any
idea? I though that to import a python module you'd need some py or
pyc file, but then I found your answer to somebody asking the same
thing and said that just the library file inside site-packages would
be enough ...
thank you very much, bye
Mirko Bordignon
______________________
M.Sc. ECE, Ph.D. student
Modular Robotics Lab,
University of Southern Denmark
http://www.mmmi.sdu.dk/~mirko
+45 6550 3521

PyKDL in OS X

Removed double post

PyKDL in OS X

Hi,

I also had the problem that PyKDL.dylib could not be imported. Then i figured out a way compiling a PyKDL.so which could be imported without problems. It may not be the most elegant way, but it works for me:

In short:

 * Install the Eigen library as well as py26-sip (using macports for example)
 * Install Orocos KDL from the svn-source without the Python bindings
 * Create a new folder and copy the Orocos src folder to it
 * Copy src/bindings/python/PyKDL/* to the new src folder
 * Create a file makekdl.py in the new src folder with the following content:
import os
import sipconfig
build_file = "PyKDL.sbf"
config = sipconfig.Configuration()
os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "PyKDL.sip"]))
makefile = sipconfig.SIPModuleMakefile(config, build_file)
makefile.extra_libs = ["orocos-kdl"]
makefile.extra_include_dirs = ["/opt/local/include/eigen2"]
makefile.generate()

 * Run python makekdl.py
 * Run make
 * Now there is a PyKDL.so file in the directory which can be copied to the site-packages folder.
You can find a more detailed howto in my blog: http://www.itk.ntnu.no/ansatte/Schrimpf_Johannes/blog/?p=45

Johannes