Problems in running the deployer as a daemon

Dear all,

my test application has 2 components (A, periodic with
period 1 and B, periodic with period 3) and one connection
from A to B. I configured the deployment with an XML file
and it works without any problem when I let the deployer
application open the task browser (i.e., when I run the
app with the following command: rosrun ocl
deployer-gnulinux --start deployment.cpf).

Problems arise when I try to launch the deployer as a
service in background with the option --daemon. The whole
app starts and ends in few seconds and I see the following
in the command prompt:
ComponentA constructed !
ComponentB constructed !
ComponentA configured !
ComponentA started !
ComponentA executes updateHook !
ComponentB started !
ComponentA executes stopping !
ComponentB executes stopping !
ComponentA cleaning up !
ComponentB cleaning up !

As you can see, B does not execute its updateHook(), and
both the components stop almost immediately... Can you
figure out why? I read this thread:
http://www.orocos.org/forum/orocos/orocos-users/running-deployer-service

and especially this comment:
http://www.orocos.org/forum/orocos/orocos-users/running-deployer-service...

and I understand that the right way to do this I by using
the rttscript deployer. However,I do not understand how to
delay the exit of the application, which seems to be the
key step for making the things work. I tried to simply
rosrun ocl rttscript-gnulinux -d -s deployment.cpf, but I
got the same results as above...

I run the
OROCOS Toolchain version '2.5.0' ( GCC 4.6.1 ) --
GNU/Linux.

in ROS electric. Can you devs/users provide me with a
simple example to run the deployer as a daemon?

Thanks in advance and best regards!

--
Matteo

Problems in running the deployer as a daemon

Hi Matteo,

On Thu, Sep 20, 2012 at 3:22 PM, Matteo Morelli <matteo [dot] morelli [..] ...> wrote:
> Dear all,
>
> my test application has 2 components (A, periodic with
> period 1 and B, periodic with period 3) and one connection
> from A to B. I configured the deployment with an XML file
> and it works without any problem when I let the deployer
> application open the task browser (i.e., when I run the
> app with the following command: rosrun ocl
> deployer-gnulinux --start deployment.cpf).
>
> Problems arise when I try to launch the deployer as a
> service in background with the option --daemon. The whole
> app starts and ends in few seconds and I see the following
> in the command prompt:
> ComponentA constructed !
> ComponentB constructed !
> ComponentA configured !
> ComponentA started !
> ComponentA executes updateHook !
> ComponentB started !
> ComponentA executes stopping !
> ComponentB executes stopping !
> ComponentA cleaning up !
> ComponentB cleaning up !

This is 'expected' behavior...

>
> As you can see, B does not execute its updateHook(), and
> both the components stop almost immediately... Can you
> figure out why? I read this thread:
> http://www.orocos.org/forum/orocos/orocos-users/running-deployer-service
>
> and especially this comment:
> http://www.orocos.org/forum/orocos/orocos-users/running-deployer-service...
>
> and I understand that the right way to do this I by using
> the rttscript deployer. However,I do not understand how to
> delay the exit of the application, which seems to be the
> key step for making the things work.

You need to call the Deployer's waitForSignal() or waitForInterrupt()
operations in one of your scripts and the deploy like this:
deployer-gnulinux --start deployment.cpf -s waitscript.ops

where waitscript contains the call to these operations.

These functions will only return when a Ctrl-C (waitForInterrupt) or
any other specified signal arrives (waitForSignal)

> I tried to simply
> rosrun ocl rttscript-gnulinux -d -s deployment.cpf, but I
> got the same results as above...

Indeed, it needs the same script

>
> I run the
> OROCOS Toolchain version '2.5.0' ( GCC 4.6.1 ) --
> GNU/Linux.
>
> in ROS electric. Can you devs/users provide me with a
> simple example to run the deployer as a daemon?
>
> Thanks in advance and best regards!

Peter