omniORBpy - python binding for omniORB

This page describes a working example of using omniORBpy to interact with an Orocos component. The example is very simple, and is intended for people who do not know where to start developing a CORBA client.

Your first stop is: http://omniorb.sourceforge.net/omnipy3/omniORBpy/ The omniORBpy version 3 User’s Guide. Read chapters 1 and 2. Optionally read chapter 6. The example works with and without naming services.

Once you are comfortable with omniORBpy, do the following (I assume you are kind enough to be a Linux user working on a console):

  1. download the rtt examples, and compile the smallnet orocos component (you might need first to fix the Makefile paths):
    • wget http://www.orocos.org/stable/examples/rtt/rtt-examples-1.10.0.tar.gz
      tar xf rtt-examples-1.10.0.tar.gz 
      cd rtt-examples-1.10.0/corba-example/
      make smallnet
  2. download the corba idls and, for simplicity's sake, copy the IDLs to a new empty directory:
    • svn co http://svn.mech.kuleuven.be/repos/orocos/trunk/rtt/src/corba/ 
      mkdir omniclt 
      cp corba/*idl omnictl/
      cd omniclt
  3. generate the Python stubs, two new directories should appear (namely RTT and RTT__POA)
    • omniidl -bpython *idl 
  4. download the attached python file (orocosclient.py) to your home directory and copy it where your IDLs are (current directory)
    • cp ~/orocosclient.py .
  5. open a new console and run your smallnet application
    • sudo ../smallnet

If you get something like

0.011 [ Warning][SmallNetwork] ControlTask 'ComponentA' could not find CORBA Naming Service.
0.011 [ Warning][SmallNetwork] Writing IOR to 'std::cerr' and file 'ComponentA.ior'
IOR:0...10100
it means your omniNames is either not configured or not running. Try:
sudo ../smallnet -ORBInitRef NameService=corbaname::127.0.0.1
if this work (you see a line like: 0.011 [ Info ][SmallNetwork] ControlTask 'ComponentA' found CORBA Naming Service.) then you need to modify the paremeter InitRef in your omniORB4.cfg (or similar, which is usually in /etc/) and make it read like:
InitRef=NameService=corbaname::127.0.0.1
  • finally run the python application
    • python orocosclient.py 

If you are not able to make your naming service work, try using the component's IOR. After running you smallnet server, copy the complete IOR printed on screen and paste it as argument to the python program (including the word "IOR:")

python orocosclient.py IOR:0...10100

Look at the IDLs and the code to understand how things work. I am no python expert, so if the coding style looks weird to you, my apologies. Good luck!

AttachmentSize
orocosclient.py_.txt1.99 KB