orogen and marhalling service

Dear sirs,

I am trying to create a component using orogen following the SimpleNonPeriodicClient example provided for RTT
The orogen file I wrote is the following

name 'tcpconnection'
version '0.1'

#using_library "qtnetwork"

# impor dei tipi definiti dall'utente
import_types_from "posizione.h"

# non periodic client reading from TCP connection
task_context "TCPClient" do
# richiedo la lettura dei parametri di configurazione
needs_configuration
output_port("desiredP", "/posizione/pos").
doc("set point di posizione")
property("hostName","string").
doc('name of the host')
property("hostPort","int").
doc('port of the host - integer (1024-65535 inclusive)')
property("conTimeOut","int").
doc('Timeout in seconds, when waiting for connection - integer ')
property("readTimeOut","int").
doc('Timeout in seconds, when waiting for read - integer')
end

I want to read componet properties from a cpf file, so I declared in my component the following service

Marshalling *m;

after that I put in the constructor of my componet the instruction

m = new Marshalling( this );

and then I use the marhalling service in configureHook

bool TCPClient::configureHook()
{
m->writeProperties( "TCPClient.cpf" );
return true;
}

Since I use QT sockey I modified the CMakeList.txt generated by orogen as you can see below

PROJECT(robtipo)
cmake_minimum_required(VERSION 2.6)

SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/.orogen/config")
INCLUDE(robtipoBase)

# find and use QT4
SET(QT_USE_QTNETWORK 1)
FIND_PACKAGE(Qt4)
INCLUDE(${QT_USE_FILE})

#adding QTNetwort library
target_link_libraries(TCPMonitor QtNetwork)
# FIND_PACKAGE(KDL)
#FIND_PACKAGE(OCL)

when I run make the component is successfully compiled but the linker ends with the following error

root@UBU1004:~/EsempiOrocos/OrogenTCPViewer2/build# make
-- documentation can be built
-- Orocos reports in /usr/src/orocos-toolchain/install/include/rtt/transports/corba/rtt-corba-config.h to use the OMNIORB
-- Optional library RTT_PLUGIN_rtt-typekit NOT FOUND. If the library is already installed, use the RTT_PLUGIN_rtt-typekit_ROOT_DIR environment variable or ccmake to set the missing variables manually.
-- Optional library RTT_PLUGIN_rtt-transport-corba NOT FOUND. If the library is already installed, use the RTT_PLUGIN_rtt-transport-corba_ROOT_DIR environment variable or ccmake to set the missing variables manually.
-- Optional library RTT_PLUGIN_rtt-typekit NOT FOUND. If the library is already installed, use the RTT_PLUGIN_rtt-typekit_ROOT_DIR environment variable or ccmake to set the missing variables manually.
-- Optional library RTT_PLUGIN_rtt-transport-corba NOT FOUND. If the library is already installed, use the RTT_PLUGIN_rtt-transport-corba_ROOT_DIR environment variable or ccmake to set the missing variables manually.
-- Configuring done
-- Generating done
-- Build files have been written to: /root/EsempiOrocos/OrogenTCPViewer2/build
[ 9%] Built target robtipo-typekit-gnulinux
[ 36%] Built target robtipo-transport-corba-gnulinux
[ 40%] Built target check-uptodate
[ 54%] Built target robtipo-transport-typelib-gnulinux
[ 86%] Built target robtipo-tasks-gnulinux
Linking CXX executable TCPMonitor
tasks/librobtipo-tasks-gnulinux.so: undefined reference to `RTT::Marshalling::Marshalling(RTT::TaskContext*)'
collect2: ld returned 1 exit status
make[2]: *** [TCPMonitor] Error 1
make[1]: *** [CMakeFiles/TCPMonitor.dir/all] Error 2
make: *** [all] Error 2

Can you help me in understanding my error?

Tank you in advance.

Gianpaolo Rizzi

orogen and marhalling service

On Sunday 28 November 2010 19:11:25 gprizzi [..] ... wrote:
> Dear sirs,
>
> I am trying to create a component using orogen following the
> SimpleNonPeriodicClient example provided for RTT The orogen file I wrote
> is the following
>
> name 'tcpconnection'
> version '0.1'
>
> #using_library "qtnetwork"
>
> # impor dei tipi definiti dall'utente
> import_types_from "posizione.h"
>
> # non periodic client reading from TCP connection
> task_context "TCPClient" do
> # richiedo la lettura dei parametri di configurazione
> needs_configuration
> output_port("desiredP", "/posizione/pos").
> doc("set point di posizione")
> property("hostName","string").
> doc('name of the host')
> property("hostPort","int").
> doc('port of the host - integer (1024-65535 inclusive)')
> property("conTimeOut","int").
> doc('Timeout in seconds, when waiting for connection - integer ')
> property("readTimeOut","int").
> doc('Timeout in seconds, when waiting for read - integer')
> end
>
> I want to read componet properties from a cpf file, so I declared in my
> component the following service
>
>
> Marshalling *m;
>
> after that I put in the constructor of my componet the instruction
>
> m = new Marshalling( this );
>
> and then I use the marhalling service in configureHook

First of all, you're confusing the Marshalling Service
http://www.orocos.org/stable/documentation/rtt/v2.x/api/html/classRTT_1_...

with the marshalling service requester:

http://www.orocos.org/stable/documentation/rtt/v2.x/api/html/classRTT_1_...

What you could have written to load marshalling into your component is this:

m = this->getProvider<Marshalling>("marshalling");

Which looks up the 'marshalling' service in the loaded plugins, installs it in
your component, and then returns a pointer to a Marshalling service requester
object which you can use to call the operations.

More prefered, when talking to a service from inside your component is doing
this:

MarshallingService::shared_ptr m = new MarshallingService(this);
and then proceed by using 'm' as you do below:

>
> bool TCPClient::configureHook()
> {
> m->writeProperties( "TCPClient.cpf" );
> return true;
> }
>
> Since I use QT sockey I modified the CMakeList.txt generated by orogen as
> you can see below

Is this a CMakeLists.txt file that you're allowed to modify ?

>
> PROJECT(robtipo)
> cmake_minimum_required(VERSION 2.6)
>
> SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/.orogen/config")
> INCLUDE(robtipoBase)
>
> # find and use QT4
> SET(QT_USE_QTNETWORK 1)
> FIND_PACKAGE(Qt4)
> INCLUDE(${QT_USE_FILE})
>
> #adding QTNetwort library
> target_link_libraries(TCPMonitor QtNetwork)
> # FIND_PACKAGE(KDL)
> #FIND_PACKAGE(OCL)
>
> when I run make the component is successfully compiled but the linker ends
> with the following error
>
> root@UBU1004:~/EsempiOrocos/OrogenTCPViewer2/build# make
> -- documentation can be built
> -- Orocos reports in
> /usr/src/orocos-toolchain/install/include/rtt/transports/corba/rtt-corba-c
> onfig.h to use the OMNIORB -- Optional library RTT_PLUGIN_rtt-typekit NOT
> FOUND. If the library is already installed, use the
> RTT_PLUGIN_rtt-typekit_ROOT_DIR environment variable or ccmake to set the
> missing variables manually. -- Optional library
> RTT_PLUGIN_rtt-transport-corba NOT FOUND. If the library is already
> installed, use the RTT_PLUGIN_rtt-transport-corba_ROOT_DIR environment
> variable or ccmake to set the missing variables manually. -- Optional
> library RTT_PLUGIN_rtt-typekit NOT FOUND. If the library is already
> installed, use the RTT_PLUGIN_rtt-typekit_ROOT_DIR environment variable or
> ccmake to set the missing variables manually. -- Optional library
> RTT_PLUGIN_rtt-transport-corba NOT FOUND. If the library is already
> installed, use the RTT_PLUGIN_rtt-transport-corba_ROOT_DIR environment
> variable or ccmake to set the missing variables manually. -- Configuring
> done

This looks like the FindRTTPlugin macro was not working on your setup. There
was a fix in there some time ago.

> -- Generating done
> -- Build files have been written to:
> /root/EsempiOrocos/OrogenTCPViewer2/build [ 9%] Built target
> robtipo-typekit-gnulinux
> [ 36%] Built target robtipo-transport-corba-gnulinux
> [ 40%] Built target check-uptodate
> [ 54%] Built target robtipo-transport-typelib-gnulinux
> [ 86%] Built target robtipo-tasks-gnulinux
> Linking CXX executable TCPMonitor
> tasks/librobtipo-tasks-gnulinux.so: undefined reference to
> `RTT::Marshalling::Marshalling(RTT::TaskContext*)' collect2: ld returned 1
> exit status
> make[2]: *** [TCPMonitor] Error 1
> make[1]: *** [CMakeFiles/TCPMonitor.dir/all] Error 2
> make: *** [all] Error 2
>
> Can you help me in understanding my error?

When you include headers from the 'marshalling' plugin, you need to link to
that plugin. It's a library after-all. So do this:

find_package(RTTPlugin rtt-marshalling)
target_link_libraries(TCPMonitor ${RTT_PLUGIN_rtt-marshalling_LIBRARIES})

Peter