orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca PEOPLE Contributors Users Project Download Mailing lists
|
PureIcePyAn Orca components written in Python (plus python installation notes).
More... |
Python can be used as a rapid prototyping tool and debug tool. It has many built-in and stable third party packages for things such as 2d/3d plotting (matplotlib), linear algebra and numerical routines (scipy), etc. Note that it's not intended to replace the C++ implementation of Orca but to augment it. To install python and the dependencies used in these examples type the following
# apt-get install python python-scipy python-matplotlib python-gtk2
Make sure that the installed Ice python scripts are in your path. You may want to add a snippet to your ~/
.bashrc file similar to the one below. Replace [VERSION] with the version of IcePy you've just installed. Change the directory if you've modified the default install directory.
export ICEPY_HOME=/opt/IcePy-[VERSION] export PYTHONPATH=$ICEPY_HOME/python:$PYTHONPATH
To generate the python interfaces you need to have installed python and you must turn on the BUILD_PYTHON parameter in cmake. The easiest way to do this is type "ccmake ." in the top level directory of the Orca source. Scroll down the list until the cursor is on the line for BUILD_PYTHON. Press "Enter" to turn it on. Configure and generate the make files. Then make and install orca:
$ make # make install
Make sure that the installed Orca python scripts are in your path. You may want to add a snippet to your ~/
.bashrc file similar to the one below. Replace [VERSION] with the version of Orca you've just installed. Change the directory if you've modified the default install directory.
export PYTHONPATH=$ORCA_HOME/python/orca:$PYTHONPATH
Example code intended for component developers.
$ python pureicepython.py --Ice.Default.Locator='IceGrid/Locator:default -p 12000'
Note that pureicepython does not use any configuration files. All connection parameters are hard-wired into the code, so you have to follow the directions of the tutorial exactly, otherwise it will not work.
You can use the same command for the other examples by replacing "puricepython" with "pureicepythonsubscribe", "pureicepythonplotranges", or "pureicepythonplot3dranges".
Note that the plotting examples are very inefficient. matplotlib (the plotting tool used in these examples) provides a more complicated way of just redrawing the bits that have changed. An example will be committed in the near future.
/opt/IcePy-3.2/python/Ice.py:34: RuntimeWarning: Python C API version mismatch for module IcePy: This Python has API version 1013, module IcePy has version 1012. import IcePy python: Types.cpp:2975: PyObject* IcePy_defineException(PyObject*, PyObject*): Assertion `((type)->ob_type == &PyClass_Type)' failed. Aborted
$ python -V
# ln -s /usr/bin/python2.4 /usr/bin/python
When using matplotlib (the plotting tool) you may experience a problem with the plot not updating at all. This can be caused by matplotlib using the wrong backend. To debug this note the backend used when the script starts execution
matplotlib version 0.90.1 verbose.level helpful interactive is False units is True platform is linux2 numerix numpy 1.0.3 backend TkAgg version 8.4
/etc/matplotlibrc
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)