How to create CORBA typekit for c++ basic types

Hi,

I'm having some trouble connecting the ctaskbrowser with a remote component.

When I launch the ctaskbrowser I get the following errors:

0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'int' with
'int32'.
0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'uint'
with 'uint32'.
0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'float'
with 'float32'.
0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'double'
with 'float64'.
0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'array'
with 'float64[]'.
0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'string'
with 'string'.
0.080 [ Warning][TypekitRepository::Import] Registering Type name 'string'
twice to the Orocos Type System: replacing.
0.085 [ ERROR ][TaskContextProxy] Looking up Attribute int32: type not known.
Check your RTT_COMPONENT_PATH.

When I try to call an operation with the following (c++)signature:

bool SoemEL2xxx::switchOn(unsigned int n)

I get the following errors:

ctaskbrowser side:

Master.Slave_1002.switchOn(0)

56.727 [ ERROR ][CorbaFallBackProtocol] Could not send data of type 'int32' :
data type not known to CORBA Transport.
Wrong number of arguments in call of function "this.switchOn": expected 1,
received 0.

remote side:
60.989 [ ERROR ][Master] Registered transport for type uint32 could not
create data source from Any (argument 1): calling operation 'switchOn' will
fail.

I guess this is due to the fact that there are no CORBA transports defined for
these basic types, but how could I create these?

-- Ruben

Ruben Smits's picture

How to create CORBA typekit for c++ basic types

On Thursday 17 February 2011 14:34:46 Ruben Smits wrote:
> Hi,
>
> I'm having some trouble connecting the ctaskbrowser with a remote component.
>
> When I launch the ctaskbrowser I get the following errors:
>
> 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'int'
> with 'int32'.
> 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'uint'
> with 'uint32'.
> 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'float'
> with 'float32'.
> 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'double'
> with 'float64'.
> 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'array'
> with 'float64[]'.
> 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'string'
> with 'string'.
> 0.080 [ Warning][TypekitRepository::Import] Registering Type name 'string'
> twice to the Orocos Type System: replacing.
> 0.085 [ ERROR ][TaskContextProxy] Looking up Attribute int32: type not
> known. Check your RTT_COMPONENT_PATH.
>
> When I try to call an operation with the following (c++)signature:
>
> bool SoemEL2xxx::switchOn(unsigned int n)
>
> I get the following errors:
>
> ctaskbrowser side:
>
> Master.Slave_1002.switchOn(0)
>
> 56.727 [ ERROR ][CorbaFallBackProtocol] Could not send data of type 'int32'
> : data type not known to CORBA Transport.
> Wrong number of arguments in call of function "this.switchOn": expected 1,
> received 0.
>
> remote side:
> 60.989 [ ERROR ][Master] Registered transport for type uint32 could not
> create data source from Any (argument 1): calling operation 'switchOn' will
> fail.
>
> I guess this is due to the fact that there are no CORBA transports defined
> for these basic types, but how could I create these?

I created a tranportkit using the CorbaTemplateProtocol:
[...]
bool registerTransport(std::string name, types::TypeInfo* ti)
{
assert( name == ti->getTypeName() );
if ( name == "int32")
return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new
corba::CorbaTemplateProtocol<int32_t>());
if ( name == "uint32")
return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new
corba::CorbaTemplateProtocol<uint32_t>());
[...]

The transport is loaded:

0.148 [ Info ][TypekitRepository::Import] Registered new 'CORBA' transport
for int32
0.148 [ Info ][TypekitRepository::Import] Registered new 'CORBA' transport
for uint32

And the error about the transport dissapears but the ctaskbrowser is still
complaining about the arguments;

ctaskbrowser side:
Master [R]> Slave_1002.switchOn(0)
Wrong number of arguments in call of function "this.switchOn": expected 1,
received 0.

remote side:
168.893 [ ERROR ][Logger] Registered transport for type uint32 could not
create data source from Any (argument 1): calling operation 'switchOn' will
fail.

Am I still missing something or cann't I use the CorbaTemplateProtocol for
these basic types?

-- Ruben

> -- Ruben

How to create CORBA typekit for c++ basic types

On Thursday 17 February 2011 15:51:56 Ruben Smits wrote:
> On Thursday 17 February 2011 14:34:46 Ruben Smits wrote:
> > Hi,
> >
> > I'm having some trouble connecting the ctaskbrowser with a remote
> > component.
> >
> > When I launch the ctaskbrowser I get the following errors:
> >
> > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for 'int'
> > with 'int32'.
> > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > 'uint' with 'uint32'.
> > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > 'float' with 'float32'.
> > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > 'double' with 'float64'.
> > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > 'array' with 'float64[]'.
> > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > 'string' with 'string'.
> > 0.080 [ Warning][TypekitRepository::Import] Registering Type name
> > 'string' twice to the Orocos Type System: replacing.
> > 0.085 [ ERROR ][TaskContextProxy] Looking up Attribute int32: type not
> > known. Check your RTT_COMPONENT_PATH.
> >
> > When I try to call an operation with the following (c++)signature:
> >
> > bool SoemEL2xxx::switchOn(unsigned int n)
> >
> > I get the following errors:
> >
> > ctaskbrowser side:
> >
> > Master.Slave_1002.switchOn(0)
> >
> > 56.727 [ ERROR ][CorbaFallBackProtocol] Could not send data of type
> > 'int32'
> >
> > : data type not known to CORBA Transport.
> >
> > Wrong number of arguments in call of function "this.switchOn": expected
> > 1, received 0.
> >
> > remote side:
> > 60.989 [ ERROR ][Master] Registered transport for type uint32 could not
> > create data source from Any (argument 1): calling operation 'switchOn'
> > will fail.
> >
> > I guess this is due to the fact that there are no CORBA transports
> > defined for these basic types, but how could I create these?
>
> I created a tranportkit using the CorbaTemplateProtocol:
> [...]
> bool registerTransport(std::string name, types::TypeInfo* ti)
> {
> assert( name == ti->getTypeName() );
> if ( name == "int32")
> return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new
> corba::CorbaTemplateProtocol<int32_t>());
> if ( name == "uint32")
> return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new
> corba::CorbaTemplateProtocol<uint32_t>());
> [...]

This won't work always. The big problem with 2.2 code is that it doesn't know
how to alias. For example, the assert has to go certainly. Cfr Charles' mail.
The rest is ok.

>
> The transport is loaded:
>
> 0.148 [ Info ][TypekitRepository::Import] Registered new 'CORBA'
> transport for int32
> 0.148 [ Info ][TypekitRepository::Import] Registered new 'CORBA'
> transport for uint32
>
> And the error about the transport dissapears but the ctaskbrowser is still
> complaining about the arguments;
>
> ctaskbrowser side:
> Master [R]> Slave_1002.switchOn(0)
> Wrong number of arguments in call of function "this.switchOn": expected 1,
> received 0.
>
> remote side:
> 168.893 [ ERROR ][Logger] Registered transport for type uint32 could not
> create data source from Any (argument 1): calling operation 'switchOn' will
> fail.

This probably means that the received arguments (which are any objects)
contain a wrong type, or at least a type it doesn't expect.

>
> Am I still missing something or cann't I use the CorbaTemplateProtocol for
> these basic types?

The CorbaTemplateProtocol class should be fine. The main thing to avoid is to
mix RTT types and ROS types in 2.2. I think your approach of making a new
Corba transport typekit for 'ros-style' primitive C types is the best thing to
do.

Peter

Ruben Smits's picture

How to create CORBA typekit for c++ basic types

On Thursday 17 February 2011 16:31:51 Peter Soetens wrote:
> On Thursday 17 February 2011 15:51:56 Ruben Smits wrote:
> > On Thursday 17 February 2011 14:34:46 Ruben Smits wrote:
> > > Hi,
> > >
> > > I'm having some trouble connecting the ctaskbrowser with a remote
> > > component.
> > >
> > > When I launch the ctaskbrowser I get the following errors:
> > >
> > > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > > 'int' with 'int32'.
> > > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > > 'uint' with 'uint32'.
> > > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > > 'float' with 'float32'.
> > > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > > 'double' with 'float64'.
> > > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > > 'array' with 'float64[]'.
> > > 0.080 [ Warning][TypekitRepository::Import] Overriding TypeInfo for
> > > 'string' with 'string'.
> > > 0.080 [ Warning][TypekitRepository::Import] Registering Type name
> > > 'string' twice to the Orocos Type System: replacing.
> > > 0.085 [ ERROR ][TaskContextProxy] Looking up Attribute int32: type
> > > not
> > > known. Check your RTT_COMPONENT_PATH.
> > >
> > > When I try to call an operation with the following (c++)signature:
> > >
> > > bool SoemEL2xxx::switchOn(unsigned int n)
> > >
> > > I get the following errors:
> > >
> > > ctaskbrowser side:
> > >
> > > Master.Slave_1002.switchOn(0)
> > >
> > > 56.727 [ ERROR ][CorbaFallBackProtocol] Could not send data of type
> > > 'int32'
> > >
> > > : data type not known to CORBA Transport.
> > >
> > > Wrong number of arguments in call of function "this.switchOn":
> > > expected
> > > 1, received 0.
> > >
> > > remote side:
> > > 60.989 [ ERROR ][Master] Registered transport for type uint32 could
> > > not create data source from Any (argument 1): calling operation
> > > 'switchOn' will fail.
> > >
> > > I guess this is due to the fact that there are no CORBA transports
> > > defined for these basic types, but how could I create these?
> >
> > I created a tranportkit using the CorbaTemplateProtocol:
> > [...]
> >
> > bool registerTransport(std::string name, types::TypeInfo*
> > ti)
> > {
> >
> > assert( name == ti->getTypeName() );
> > if ( name == "int32")
> >
> > return
> > ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new
> >
> > corba::CorbaTemplateProtocol<int32_t>());
> > if ( name == "uint32")
> >
> > return
> > ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new
> >
> > corba::CorbaTemplateProtocol<uint32_t>());
> > [...]
>
> This won't work always. The big problem with 2.2 code is that it doesn't
> know how to alias. For example, the assert has to go certainly. Cfr
> Charles' mail. The rest is ok.
>
> > The transport is loaded:
> >
> > 0.148 [ Info ][TypekitRepository::Import] Registered new 'CORBA'
> > transport for int32
> > 0.148 [ Info ][TypekitRepository::Import] Registered new 'CORBA'
> > transport for uint32
> >
> > And the error about the transport dissapears but the ctaskbrowser is
> > still complaining about the arguments;
> >
> > ctaskbrowser side:
> > Master [R]> Slave_1002.switchOn(0)
> > Wrong number of arguments in call of function "this.switchOn": expected
> > 1, received 0.
> >
> > remote side:
> > 168.893 [ ERROR ][Logger] Registered transport for type uint32 could
> > not
> > create data source from Any (argument 1): calling operation 'switchOn'
> > will fail.
>
> This probably means that the received arguments (which are any objects)
> contain a wrong type, or at least a type it doesn't expect.
>
> > Am I still missing something or cann't I use the CorbaTemplateProtocol
> > for these basic types?
>
> The CorbaTemplateProtocol class should be fine. The main thing to avoid is
> to mix RTT types and ROS types in 2.2. I think your approach of making a
> new Corba transport typekit for 'ros-style' primitive C types is the best
> thing to do.

Well, apparently this approach of making a Corba transport typekit deos not
work, as I already created this typekit but it is still not working as shown
in my previous email :(

--Ruben

> Peter