calling operations in deployment scripts that need non-peer components as parameter

Dear fellow developers,

Newbie for orocos needs some help. I am wiring a component based software that has two components, "supervisor"and "handler". The supervisorcomponent introspects the handlerand if it satisfies a certain configuration then adds it as a peer in an operation defined as addCheckedPeer(TaskContext *).
 
I want to use a deployment script to implement this, so after loading components t_supervisorand t_handlerI cant call the t_supervisor.addCheckedPeerwith the t_handler as a parameter.Is there any way around this or should I hard code any possible solution? I havent looked into lua, so is it an option in this case?

Carmi 

calling operations in deployment scripts that need non-peer comp

Hi Carminm

On Wed, Apr 11, 2012 at 10:03:44AM -0700, Carmin Astrona wrote:

> Newbie for orocos needs some help. I am wiring a component based software that
> has two components, "supervisor" and "handler". The supervisor component
> introspects the handler and if it satisfies a certain configuration then adds
> it as a peer in an operation defined as addCheckedPeer(TaskContext *).
>
> I want to use a deployment script to implement this, so after loading
> components t_supervisor and t_handler I cant call the t_supervisor.
> addCheckedPeer with the t_handler as a parameter. Is there any way around this
> or should I hard code any possible solution? I havent looked into lua, so is it
> an option in this case?

I don't quite understand what the problem is. Why can't you add the
t_handler? Can you give some more details?

Markus

calling operations in deployment scripts that need non-peer comp

On Thu, Apr 12, 2012 at 01:20:47AM -0700, Carmin Astrona wrote:
> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> On Wed, Apr 11, 2012 at 10:03:44AM -0700, Carmin Astrona wrote:
>
> > Newbie for orocos needs some help. I am wiring a component based software
> that
> > has two components, "supervisor" and "handler". The supervisor component
> > introspects the handler and if it satisfies a certain configuration then adds
> > it as a peer in an operation defined as addCheckedPeer(TaskContext *).
> >
> > I want to use a deployment script to implement this, so after loading
> > components t_supervisor and t_handler I cant call the t_supervisor.
> > addCheckedPeer with the t_handler as a parameter. Is there any way around
> this
> > or should I hard code any possible solution? I havent looked into lua, so is
> it
> > an option in this case?
>
> I don't quite understand what the problem is. Why can't you add the
> t_handler? Can you give some more details?
>
> Markus
>
> I have a program.ops file as follows
>
> import("oro_minok_handler")
> import("rtt_std_msgs")
>
> loadComponent("t_handler1",CCL::MinokHandler)
> loadComponent("t_supervisor",CCL::MinokSupervisor)

You didn't run this, did you? It should be "CCL::MinokHandler"

> loadService("t_handler1","marshalling")
> t_handler1.marshalling.readProperties("confFile1.cpf")
> setActivity("t_handler1",0.001)
>
> loadService("t_handler2","marshalling")
> t_handler2.marshalling.readProperties("confFile2.cpf")
> setActivity("t_handler2",0.001)
>
> t_supervisor.addCheckedPeer("t_handler1")
>
> And it gives me an error saying wrong type of argument provided in
> "this.addCheckedPeer" expected type MinokHandler *, got type string.
> If I had to hard code the same functionality in a main.cpp, I would do it as
>
> MinokSupervisor t_supervisor("Supervisor");
> MinokHandler t_handler1("t_handler1");
> MinokHandler t_handler2("t_handler2");
>
> ....
>
> t_supervisor.addCheckedPeer(&t_handler1);
> t_supervisor.addCheckedPeer(&t_handler2);
>
>
> So My question is how can I do the same thing in scripts.

It doesn't work because scripting is not aware of the type
"MinokHandler". So for you script to work you need to write a typekit
for this type and define a method to retrieve such a type. A quicker
(and dirtier) solution would be to modify addCheckedPeer accept a
string peer name. In the implementation you would then run
this->getPeer to get the actual TaskContext handle. For that to work
you would need to add the peer first, too.

Markus

calling operations in deployment scripts that need non-peer comp

Hi Markus

________________________________
From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

Hi Carminm

On Wed, Apr 11, 2012 at 10:03:44AM -0700, Carmin Astrona wrote:

> Newbie for orocos needs some help. I am wiring a component based software that
> has two components, "supervisor" and "handler". The supervisor component
> introspects the handler and if it satisfies a certain configuration then adds
> it as a peer in an operation defined as addCheckedPeer(TaskContext *).

> I want to use a deployment script to implement this, so after loading
> components t_supervisor and t_handler I cant call the t_supervisor.
> addCheckedPeer with the t_handler as a parameter. Is there any way around this
> or should I hard code any possible solution? I havent looked into lua, so is it
> an option in this case?

I don't quite understand what the problem is. Why can't you add the
t_handler? Can you give some more details?

Markus

I have a program.ops file as follows 

import("oro_minok_handler")
import("rtt_std_msgs")

loadComponent("t_handler1",CCL::MinokHandler)
loadComponent("t_supervisor",CCL::MinokSupervisor)

loadService("t_handler1","marshalling")
t_handler1.marshalling.readProperties("confFile1.cpf")

setActivity("t_handler1",0.001)

loadService("t_handler2","marshalling")
t_handler2.marshalling.readProperties("confFile2.cpf")

setActivity("t_handler2",0.001)

t_supervisor.addCheckedPeer("t_handler1")

And it gives me an error saying wrong type of argument provided in "this.addCheckedPeer" expected type MinokHandler *, got type string. 
If I had to hard code the same functionality in a main.cpp, I would do it as

MinokSupervisor t_supervisor("Supervisor");

MinokHandler  t_handler1("t_handler1");

MinokHandler  t_handler2("t_handler2");

....

t_supervisor.addCheckedPeer(&t_handler1);
t_supervisor.addCheckedPeer(&t_handler2);
 

So My question is how can I do the same thing in scripts. 
Thanks Markus

Carmina