wiki:PythonWrappers
Last modified 9 years ago Last modified on 02/25/2009 09:22:58 AM

Python wrappers for various components

via: Mick's email to the WP9 list

I have been testing various standard libraries to be used for our LIREC software modules, mostly related to programming Robots using Python on Ubuntu 8.10. So for all you non-C++ gurus(!) here are my findings:

I would reccomend using Python V2.4 until Activrobots release a new version of ARIA which provides support for Python 2.6. The ARIA wrappers for Python (and JAVA etc.) are supplied as Windows binaries or debian packages and are self installing for PYTHON 2.4. Installation is problem free on both platforms, so this is a big argument for using Python2.4 for now.

Note, ARIA is used for controlling the Pioneer and PeopleBot? mobile robots. The ARIA library also provides support for a number of devices used by the robots including the various PTU options (Canon VCC4, V50 etc.) and SICK laser rangfinders from the on-board computer (or main control laptop if used). It may then be useful to consider moving to Python V2.6 at that point.

I have succesfuly compiled/installed YARP wrappers for both Python versions 2.4 and 2.6 under LINUX. Just download the latest source from http://opencv.willowgarage.com/wiki/InstallGuide and follow the instructions for installing from the cvs.

This is pretty strighforward and suport for python is automatically installed if you have only V2.4 on your system. If, like me you also have V2.6 or (V3 even) just use the following to:

To generate the Python 2.4 wrapper and make the yarp library available. After the main install has checked out (yarp server then: yarp check) just cd to yarp/examples/swig/python and then cmake . to set up the swig interface. Run ccmake . and select PYTHON to ON and change the PYTHON_INCLUDE_PATH to usr/include/python 2.4, and the PYTHON_LIBRARY to /usr/lib/python2.4/config/libpython2.4.so.

Just run make, then sudo cp the following files:

sudo cp yarp.py /usr/lib/python2.4/site-packages
sudo cp _libpyyarp.so /usr/local/lib/python2.4/site-packages/_yarp.so

For opencv, the installation is straightforward. Just download the latest source and extract to a local directory. run

./configure PYTHONPATH=/usr/bin/python2.4

and it should build/install the opencv libraries and python 2.4 wrapper.

In the python IDE interpreter (I use IDLE) just use:

import AriaPy
import opencv
import yarp

If no errors, all should be installed ok! Refer to the manuals etc for usage. They mostly follow the C++ definitions, but just use normal python expressions. I have not tested the later two for windows, but Kyron has already installed yarp for windows, so generating the python wrapper should be relatively srtaightforward. If there is a demand, I may look at this next?