logo
Published on The Orocos Project (http://www.orocos.org)

[CORBA] - Retrieving remote methods with getMethod()

By Viktor Stark
Created 2008-02-26 17:10

[Accidentally first sent to orocos at lists [dot] mech [dot] kuleuven [dot] be by mistake.]

Hi,

First of all, let me say that Orocos is an amazing framework.
Actually, I was looking for a framework with the following capabilities.

Needless to say that Orocos was the perfect match.

Right now, I have a bunch of TaskContexti's deployed with the DeploymentComponent. This all works as expected.

I then tried to export my DeployementComponent object on the network. That worked fine too and I could see my object on the TAO NameService using /usr/bin/nslist (tao-utils).
Then, I created a separated (CORBA) client which retrieves a proxy to that object using the ControlTaskProxy object. The proxy seemed to work OK since I could retrieve the list of peers (which matched the list of TaskContexts that I deployed server-side with my DeploymentComponent).

My problem is that I can't do the following:

Methodi<void(long)> m = proxy->getPeer("Processor")->methods()->getMethod<void(long)>("doSomeStuff");
m(1);

I get a "No such method" error.

It is my understanding that methods of the peers of a ControlTaskProxy are dynamically created on the client side meaning that my code should probably work. Then again, I suppose I missed something obvious.

I also did some tests on orocos-apps/examples/corba-example/SingleProcess.cxx. I modified the file as follows:

connectPorts( &local, mtask );
// Modifications - begin

        std::cout << "ExecutionPeer present: " << local.hasPeer("ExecutionPeer") << std::endl;
        std::cout << "Number of methods on Execution peers (getNames): " << local.getPeer("ExecutionPeer")->methods()->getNames().size() << endl;
        std::cout << "Number of methods on Execution peers (getMethods): " << local.getPeer("ExecutionPeer")->methods()->getMethods().size() << endl;

// Modifications - end

        TaskBrowser browser( &peer );

When I run the newly compiled eprocess, I get the following output:
ExecutionPeer present: 1
Number of methods on Execution peers (getNames): 20
Number of methods on Execution peers (getMethods): 0

What puzzles is me that the last two calls do not give the same number. Why is the second call giving me 0 methods (that would explain why I can't do a getMethod())?

Note: If I use the bin/ctaskbrowser with my NameService reference as parameter, I can access all the peers and their methods so my "base setup" seems to be working OK. My only problem is that I want to retrieve remote method references inside my code (i.e. not using TaskBrowser).

Thanks in advance for any pointers and keep up the great work with Orocos.

Viktor STARK

‹ calling reporter trigger from peer FindOCL.cmake ›

Source URL:
http://www.orocos.org/node/602