Using Methods in Corba with user defined types

I used successfully in my components a couple of Methods that return user
defined types. Recently, I moved some components to different processes and
I followed the documentation located here (
http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-too...).
The trace of the deployer shows that the types have been added in the
TypeSystem of the two processes but the following code is throwing an
unknown exception not documented in the documentation:

getPeer("myPeer")->methods()->getMethod<MyType(int)>("myFunction");

Moreover, we have modified the method to use a std::vector<double> because
it's supposed to be supported in the Orocos type system by default. Again,
with local components, the code does work but with different process the
same problem is reproduced.

In the other hand, Peter said in the following mail
http://lists.mech.kuleuven.be/pipermail/orocos-users/2008-February/00010...
there are some problems when returning results by reference... but I
suppose that's another story because we're returning results by value.

So... is it possible to use complex types in Methods with Corba? What's the
exception thrown by getMethod() ?

Thanks in advance,

Using Methods in Corba with user defined types

On Tuesday 02 March 2010 17:31:56 Carles Lopez wrote:
> I used successfully in my components a couple of Methods that return user
> defined types. Recently, I moved some components to different processes and
> I followed the documentation located here (
> http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-toolki
> t-plugin.html). The trace of the deployer shows that the types have been
> added in the TypeSystem of the two processes but the following code is
> throwing an unknown exception not documented in the documentation:
>
> getPeer("myPeer")->methods()->getMethod<MyType(int)>("myFunction");

Probably an factory exception (see rtt/FactoryExceptions.hpp). Normally, they
shouldn't be leaked to user code. getMethod should return null and log(Error)
the cause. to diagnose, you can write:

&#10;bool configureHook() {&#10;  try {&#10;    getPeer(&quot;myPeer&quot;)-&gt;methods()-&gt;getMethod&lt;MyType(int)&gt;(&quot;myFunction&quot;);&#10;  } catch (std::exception&amp; e) {&#10;    cerr &lt;&lt; &quot;Exception in getMethod: &quot;&lt;&lt; e.what() &lt;&lt; endl;&#10;    return false;&#10;  }&#10;}&#10;

>
> Moreover, we have modified the method to use a std::vector<double> because
> it's supposed to be supported in the Orocos type system by default. Again,
> with local components, the code does work but with different process the
> same problem is reproduced.

I'm assuming you have setup the CORBA transport and the Logger trace says that
it can transport 'array' over CORBA ? Also check that ORO_REMOTING is turned
on. What does the orocos.log file say ?

>
> In the other hand, Peter said in the following mail
> http://lists.mech.kuleuven.be/pipermail/orocos-users/2008-February/000107.h
> tmlthat there are some problems when returning results by reference... but
> I suppose that's another story because we're returning results by value.

Indeed.

>
> So... is it possible to use complex types in Methods with Corba? What's the
> exception thrown by getMethod() ?

This must work. Did you also read
http://www.orocos.org/wiki/rtt/simple-examples/developing-plugins-and-to...
? To have an example on how to write a toolkit + CORBA transport ?

Peter

Using Methods in Corba with user defined types

On Tue, Mar 9, 2010 at 14:12, Peter Soetens <peter [..] ...> wrote:
> On Tuesday 02 March 2010 17:31:56 Carles Lopez wrote:
>> I used successfully in my components a couple of Methods that return user
>> defined types. Recently, I moved some components to different processes and
>> I followed the documentation located here (
>> http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-toolki
>> t-plugin.html). The trace of the deployer shows that the types have been
>>  added in the TypeSystem of the two processes but the following code is
>>  throwing an unknown exception not documented in the documentation:
>>
>> getPeer("myPeer")->methods()->getMethod<MyType(int)>("myFunction");
>
> Probably an factory exception (see  rtt/FactoryExceptions.hpp). Normally, they
> shouldn't be leaked to user code. getMethod should return null and log(Error)
> the cause. to diagnose, you can write:
>
> &#10;&gt; bool configureHook() {&#10;&gt;  try {&#10;&gt;    getPeer(&quot;myPeer&quot;)-&gt;methods()-&gt;getMethod&lt;MyType(int)&gt;(&quot;myFunction&quot;);&#10;&gt;  } catch (std::exception&amp; e) {&#10;&gt;    cerr &lt;&lt; &quot;Exception in getMethod: &quot;&lt;&lt; e.what() &lt;&lt; endl;&#10;&gt;    return false;&#10;&gt;  }&#10;&gt; }&#10;&gt;
>

Good to know

>>
>> Moreover, we have modified the method to use a std::vector<double> because
>> it's supposed to be supported in the Orocos type system by default. Again,
>> with local components, the code does work but with different process the
>> same problem is reproduced.
>
> I'm assuming you have setup the CORBA transport and the Logger trace says that
> it can transport 'array' over CORBA ? Also check that ORO_REMOTING is turned
> on. What does the orocos.log file say ?
>

Let me see

>>
>> In the other hand, Peter said in the following mail
>> http://lists.mech.kuleuven.be/pipermail/orocos-users/2008-February/000107.h
>> tmlthat there are some problems when returning results by reference... but
>>  I suppose that's another story because we're returning results by value.
>
> Indeed.
>
>>
>> So... is it possible to use complex types in Methods with Corba? What's the
>> exception thrown by getMethod() ?
>
> This must work. Did you also read
> http://www.orocos.org/wiki/rtt/simple-examples/developing-plugins-and-to...
> ? To have an example on how to write a toolkit + CORBA transport ?
>
> Peter
>

Interesting reading

Using Methods in Corba with user defined types

On Mar 9, 2010, at 08:12 , Peter Soetens wrote:

> On Tuesday 02 March 2010 17:31:56 Carles Lopez wrote:
>> I used successfully in my components a couple of Methods that return user
>> defined types. Recently, I moved some components to different processes and
>> I followed the documentation located here (
>> http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-toolki
>> t-plugin.html). The trace of the deployer shows that the types have been
>> added in the TypeSystem of the two processes but the following code is
>> throwing an unknown exception not documented in the documentation:
>>
>> getPeer("myPeer")->methods()->getMethod<MyType(int)>("myFunction");
>
> Probably an factory exception (see rtt/FactoryExceptions.hpp). Normally, they
> shouldn't be leaked to user code. getMethod should return null and log(Error)
> the cause. to diagnose, you can write:
>
> &#10;&gt; bool configureHook() {&#10;&gt;  try {&#10;&gt;    getPeer(&quot;myPeer&quot;)-&gt;methods()-&gt;getMethod&lt;MyType(int)&gt;(&quot;myFunction&quot;);&#10;&gt;  } catch (std::exception&amp; e) {&#10;&gt;    cerr &lt;&lt; &quot;Exception in getMethod: &quot;&lt;&lt; e.what() &lt;&lt; endl;&#10;&gt;    return false;&#10;&gt;  }&#10;&gt; }&#10;&gt;
>
>>
>> Moreover, we have modified the method to use a std::vector<double> because
>> it's supposed to be supported in the Orocos type system by default. Again,
>> with local components, the code does work but with different process the
>> same problem is reproduced.
>
> I'm assuming you have setup the CORBA transport and the Logger trace says that
> it can transport 'array' over CORBA ? Also check that ORO_REMOTING is turned
> on. What does the orocos.log file say ?

Are you sure you are loading the necessary _transport_ plugins? See the wiki page Peter mentioned below for the diffrerence between toolkit and transport plugins. You need to create both plugins for your custom type.

>> In the other hand, Peter said in the following mail
>> http://lists.mech.kuleuven.be/pipermail/orocos-users/2008-February/000107.h
>> tmlthat there are some problems when returning results by reference... but
>> I suppose that's another story because we're returning results by value.
>
> Indeed.
>
>>
>> So... is it possible to use complex types in Methods with Corba? What's the
>> exception thrown by getMethod() ?
>
> This must work. Did you also read
> http://www.orocos.org/wiki/rtt/simple-examples/developing-plugins-and-to...
> ? To have an example on how to write a toolkit + CORBA transport ?
>
> Peter

When the transport plugin is loaded (not the toolkit plugin!), do you see RTT specify that it has a transport for "MyType"? Turn on debug logging to see this.
Stephen

Using Methods in Corba with user defined types

On Tue, Mar 9, 2010 at 14:16, S Roderick <kiwi [dot] net [..] ...> wrote:
> On Mar 9, 2010, at 08:12 , Peter Soetens wrote:
>
>> On Tuesday 02 March 2010 17:31:56 Carles Lopez wrote:
>>> I used successfully in my components a couple of Methods that return user
>>> defined types. Recently, I moved some components to different processes and
>>> I followed the documentation located here (
>>> http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-toolki
>>> t-plugin.html). The trace of the deployer shows that the types have been
>>> added in the TypeSystem of the two processes but the following code is
>>> throwing an unknown exception not documented in the documentation:
>>>
>>> getPeer("myPeer")->methods()->getMethod<MyType(int)>("myFunction");
>>
>> Probably an factory exception (see  rtt/FactoryExceptions.hpp). Normally, they
>> shouldn't be leaked to user code. getMethod should return null and log(Error)
>> the cause. to diagnose, you can write:
>>
>> &#10;&gt;&gt; bool configureHook() {&#10;&gt;&gt;  try {&#10;&gt;&gt;    getPeer(&quot;myPeer&quot;)-&gt;methods()-&gt;getMethod&lt;MyType(int)&gt;(&quot;myFunction&quot;);&#10;&gt;&gt;  } catch (std::exception&amp; e) {&#10;&gt;&gt;    cerr &lt;&lt; &quot;Exception in getMethod: &quot;&lt;&lt; e.what() &lt;&lt; endl;&#10;&gt;&gt;    return false;&#10;&gt;&gt;  }&#10;&gt;&gt; }&#10;&gt;&gt;
>>
>>>
>>> Moreover, we have modified the method to use a std::vector<double> because
>>> it's supposed to be supported in the Orocos type system by default. Again,
>>> with local components, the code does work but with different process the
>>> same problem is reproduced.
>>
>> I'm assuming you have setup the CORBA transport and the Logger trace says that
>> it can transport 'array' over CORBA ? Also check that ORO_REMOTING is turned
>> on. What does the orocos.log file say ?
>
> Are you sure you are loading the necessary _transport_ plugins? See the wiki page Peter mentioned below for the diffrerence between toolkit and transport plugins. You need to create both plugins for your custom type.
>
>>> In the other hand, Peter said in the following mail
>>> http://lists.mech.kuleuven.be/pipermail/orocos-users/2008-February/000107.h
>>> tmlthat there are some problems when returning results by reference... but
>>> I suppose that's another story because we're returning results by value.
>>
>> Indeed.
>>
>>>
>>> So... is it possible to use complex types in Methods with Corba? What's the
>>> exception thrown by getMethod() ?
>>
>> This must work. Did you also read
>> http://www.orocos.org/wiki/rtt/simple-examples/developing-plugins-and-to...
>> ? To have an example on how to write a toolkit + CORBA transport ?
>>
>> Peter
>
> When the transport plugin is loaded (not the toolkit plugin!), do you see RTT specify that it has a transport for "MyType"? Turn on debug logging to see this.

I already implented a TransportPlugin, ToolkitPlugin and the
AnyConversion templates for my types. Let me check the cmakes, the
loading of the plugins and the instantiation of the templates. Maybe I
have the pieces but not the glue....

> Stephen
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Using Methods in Corba with user defined types

On Mar 10, 2010, at 06:28 , Carles Lopez wrote:

> On Tue, Mar 9, 2010 at 14:16, S Roderick <kiwi [dot] net [..] ...> wrote:
>> On Mar 9, 2010, at 08:12 , Peter Soetens wrote:
>>
>>> On Tuesday 02 March 2010 17:31:56 Carles Lopez wrote:
>>>> I used successfully in my components a couple of Methods that return user
>>>> defined types. Recently, I moved some components to different processes and
>>>> I followed the documentation located here (
>>>> http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-toolki
>>>> t-plugin.html). The trace of the deployer shows that the types have been
>>>> added in the TypeSystem of the two processes but the following code is
>>>> throwing an unknown exception not documented in the documentation:
>>>>
>>>> getPeer("myPeer")->methods()->getMethod<MyType(int)>("myFunction");
>>>
>>> Probably an factory exception (see rtt/FactoryExceptions.hpp). Normally, they
>>> shouldn't be leaked to user code. getMethod should return null and log(Error)
>>> the cause. to diagnose, you can write:
>>>
>>> &#10;&gt;&gt;&gt; bool configureHook() {&#10;&gt;&gt;&gt;  try {&#10;&gt;&gt;&gt;    getPeer(&quot;myPeer&quot;)-&gt;methods()-&gt;getMethod&lt;MyType(int)&gt;(&quot;myFunction&quot;);&#10;&gt;&gt;&gt;  } catch (std::exception&amp; e) {&#10;&gt;&gt;&gt;    cerr &lt;&lt; &quot;Exception in getMethod: &quot;&lt;&lt; e.what() &lt;&lt; endl;&#10;&gt;&gt;&gt;    return false;&#10;&gt;&gt;&gt;  }&#10;&gt;&gt;&gt; }&#10;&gt;&gt;&gt;
>>>
>>>>
>>>> Moreover, we have modified the method to use a std::vector<double> because
>>>> it's supposed to be supported in the Orocos type system by default. Again,
>>>> with local components, the code does work but with different process the
>>>> same problem is reproduced.
>>>
>>> I'm assuming you have setup the CORBA transport and the Logger trace says that
>>> it can transport 'array' over CORBA ? Also check that ORO_REMOTING is turned
>>> on. What does the orocos.log file say ?
>>
>> Are you sure you are loading the necessary _transport_ plugins? See the wiki page Peter mentioned below for the diffrerence between toolkit and transport plugins. You need to create both plugins for your custom type.
>>
>>>> In the other hand, Peter said in the following mail
>>>> http://lists.mech.kuleuven.be/pipermail/orocos-users/2008-February/000107.h
>>>> tmlthat there are some problems when returning results by reference... but
>>>> I suppose that's another story because we're returning results by value.
>>>
>>> Indeed.
>>>
>>>>
>>>> So... is it possible to use complex types in Methods with Corba? What's the
>>>> exception thrown by getMethod() ?
>>>
>>> This must work. Did you also read
>>> http://www.orocos.org/wiki/rtt/simple-examples/developing-plugins-and-to...
>>> ? To have an example on how to write a toolkit + CORBA transport ?
>>>
>>> Peter
>>
>> When the transport plugin is loaded (not the toolkit plugin!), do you see RTT specify that it has a transport for "MyType"? Turn on debug logging to see this.
>
> I already implented a TransportPlugin, ToolkitPlugin and the
> AnyConversion templates for my types. Let me check the cmakes, the
> loading of the plugins and the instantiation of the templates. Maybe I
> have the pieces but not the glue....

You also have to be very careful about which namespace some of the pieces are in. Took me a while to work that one out ...

Can you provide us with a debug log from one of your failed runs? Might help us help you.
S