using marshalling service in orogen

Dear sirs,

I am trying to create a component using orogen.
I followed the SimpleNonPeriodicClient example provided for RTT

The orogen file I wrote for the project is the following
ame 'tcpconnection'
version '0.1'

#using_library "qtnetwork"

# import of user defined types
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

#
task_context "interpolator" do
input_port("inDesiredP", "/posizione/pos").
doc("set point da microinterpolare")
output_port("outDesiredP", "/posizione/pos").
doc("set point filtrati da inviare al robot")

port_driven "inDesiredP"
end

# deployment

deployment "TCPMonitor" do
hmi = task("clientTCP", "TCPClient").
start

interp = task("interpolatore", "interpolator").
realtime.
periodic(0.5).
start

connect(hmi.desiredP, interp.inDesiredP)
end

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

Marshalling *m;

after that I put in the constructor of my component 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 socket I modified the CMakeList.txt generated by orogen as you can see belowPROJECT(tcpconnection)
cmake_minimum_required(VERSION 2.6)

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

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

#adding QTNetwort library
target_link_libraries(TCPMonitor QtNetwork)
target_link_libraries(rviewer QtNetwork)

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

undefined reference for Marshalling(RTT:TaskContext *)

as yo can see belowroot@UBU1004:~/EsempiOrocos/OrogenTCPViever3/build# make
[ 9%] Built target tcpconnection-typekit-gnulinux
[ 40%] Built target tcpconnection-tasks-gnulinux
[ 45%] Built target check-uptodate
[ 59%] Built target tcpconnection-transport-typelib-gnulinux
[ 86%] Built target tcpconnection-transport-corba-gnulinux
Linking CXX executable TCPMonitor
tasks/libtcpconnection-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

Then I tried to modify CMakeList file adding a reference to librtt-marshalling-gnulinux
as you can see below

PROJECT(tcpconnection)
cmake_minimum_required(VERSION 2.6)

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

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

#adding QTNetwort library
target_link_libraries(TCPMonitor QtNetwork rtt-marshalling-gnulinux)
target_link_libraries(rviewer QtNetwork rtt-marshalling-gnulinux)

Running make with this new configuration I get an error from lìnker stating that rtt-marshalling-gnulinux can not be found, as you can se in the following output.

root@UBU1004:~/EsempiOrocos/OrogenTCPViever3/build# make
[ 9%] Built target tcpconnection-typekit-gnulinux
[ 36%] Built target tcpconnection-transport-corba-gnulinux
[ 40%] Built target check-uptodate
[ 72%] Built target tcpconnection-tasks-gnulinux
[ 86%] Built target tcpconnection-transport-typelib-gnulinux
Linking CXX executable TCPMonitor
/usr/bin/ld: cannot find -lrtt-marshalling-gnulinux
collect2: ld returned 1 exit status
make[2]: *** [TCPMonitor] Error 1
make[1]: *** [CMakeFiles/TCPMonitor.dir/all] Error 2
make: *** [all] Error 2

I cant figure out why mashalling service cant be used.
Have I missed some library configuration variable?

Please can you help me in understanding my error?

Tank you in advance for you kind support.

Gianpaolo Rizzi

using marshalling service in orogen

On Saturday 04 December 2010 17:24:48 gprizzi [..] ... wrote:
> Dear sirs,
>
> I am trying to create a component using orogen.
> I followed the SimpleNonPeriodicClient example provided for RTT
>
> The orogen file I wrote for the project is the following
> ame 'tcpconnection'
> version '0.1'
>
> #using_library "qtnetwork"
>
> # import of user defined types
> 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
>
> #
> task_context "interpolator" do
> input_port("inDesiredP", "/posizione/pos").
> doc("set point da microinterpolare")
> output_port("outDesiredP", "/posizione/pos").
> doc("set point filtrati da inviare al robot")
>
> port_driven "inDesiredP"
> end
>
>
> # deployment
>
> deployment "TCPMonitor" do
> hmi = task("clientTCP", "TCPClient").
> start
>
> interp = task("interpolatore", "interpolator").
> realtime.
> periodic(0.5).
> start
>
> connect(hmi.desiredP, interp.inDesiredP)
> end
>
> Since I want to read component properties from a cpf file, I declared in my
> component the following service
>
> Marshalling *m;
>
> after that I put in the constructor of my component 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 socket I modified the CMakeList.txt generated by orogen as
> you can see belowPROJECT(tcpconnection) cmake_minimum_required(VERSION
> 2.6)
>
> SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/.orogen/config")
> INCLUDE(tcpconnectionBase)
>
> # find and use QT4
> SET(QT_USE_QTNETWORK 1)
> FIND_PACKAGE(Qt4)
> INCLUDE(${QT_USE_FILE})
>
> #adding QTNetwort library
> target_link_libraries(TCPMonitor QtNetwork)
> target_link_libraries(rviewer QtNetwork)
>
> when I run make the component is successfully compiled but the linker ends
> with an
>
> undefined reference for Marshalling(RTT:TaskContext *)
>
> as yo can see belowroot@UBU1004:~/EsempiOrocos/OrogenTCPViever3/build# make
> [ 9%] Built target tcpconnection-typekit-gnulinux
> [ 40%] Built target tcpconnection-tasks-gnulinux
> [ 45%] Built target check-uptodate
> [ 59%] Built target tcpconnection-transport-typelib-gnulinux
> [ 86%] Built target tcpconnection-transport-corba-gnulinux
> Linking CXX executable TCPMonitor
> tasks/libtcpconnection-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
>
> Then I tried to modify CMakeList file adding a reference to
> librtt-marshalling-gnulinux as you can see below
>
> PROJECT(tcpconnection)
> cmake_minimum_required(VERSION 2.6)
>
> SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/.orogen/config")
> INCLUDE(tcpconnectionBase)
>
> # find and use QT4
> SET(QT_USE_QTNETWORK 1)
> FIND_PACKAGE(Qt4)
> INCLUDE(${QT_USE_FILE})
>
> #adding QTNetwort library
> target_link_libraries(TCPMonitor QtNetwork rtt-marshalling-gnulinux)
> target_link_libraries(rviewer QtNetwork rtt-marshalling-gnulinux)
>
> Running make with this new configuration I get an error from lìnker
> stating that rtt-marshalling-gnulinux can not be found, as you can se in
> the following output.
>
> root@UBU1004:~/EsempiOrocos/OrogenTCPViever3/build# make
> [ 9%] Built target tcpconnection-typekit-gnulinux
> [ 36%] Built target tcpconnection-transport-corba-gnulinux
> [ 40%] Built target check-uptodate
> [ 72%] Built target tcpconnection-tasks-gnulinux
> [ 86%] Built target tcpconnection-transport-typelib-gnulinux
> Linking CXX executable TCPMonitor
> /usr/bin/ld: cannot find -lrtt-marshalling-gnulinux
> collect2: ld returned 1 exit status
> make[2]: *** [TCPMonitor] Error 1
> make[1]: *** [CMakeFiles/TCPMonitor.dir/all] Error 2
> make: *** [all] Error 2
>
>
> I cant figure out why mashalling service cant be used.
> Have I missed some library configuration variable?
>
>
> Please can you help me in understanding my error?
>
> Tank you in advance for you kind support.

Services like marshalling are installed in the lib/orocos/plugins directory.
If you wish to link against them, you should use the FindRTTPlugin.cmake macro
in your project and use it like the OCL uses it:

# Modules path (for searching FindXXX.cmake files)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/config")
find_package(RTTPlugin REQUIRED rtt-scripting)
target_link_libraries( TCPMonitor ${RTT_PLUGIN_rtt-scripting_LIBRARIES} )

Another issue you might have then is that the RPATH must be set to this
lib/orocos/plugins directory. This is best solved by using the
orocos_component macro in hand-written cmake files. I don't know if orogen
generated cmakefiles include this RPATH setting.

Peter

using marshalling service in orogen

On 12/16/2010 03:40 PM, Peter Soetens wrote:
> Another issue you might have then is that the RPATH must be set to this
> lib/orocos/plugins directory. This is best solved by using the
> orocos_component macro in hand-written cmake files. I don't know if orogen
> generated cmakefiles include this RPATH setting.
The oroGen CMake files automatically set RPATH to the library paths.

The oroGen CMake code already includes the FindRTTPlugin.cmake file as
well, so

find_package(RTTPlugin REQUIRED rtt-scripting)
target_link_libraries( TCPMonitor ${RTT_PLUGIN_rtt-scripting_LIBRARIES})

Should be enough