Using Slave Activities

Hi,

I need a small component to serve as a simple master for triggering a
number of peers components configured with the SlaveActivities (such a
component doesn't exist yet, does it?). From the docs[1] it's not entirely
clear to me how such a master should work. Are the following steps
correct:

- get a handle to to the peer task context
- get it's activity (and check it is in fact a SlaveActivity)
- run the activities execute function

?

Thanks!
Markus

[1] http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...

Using Slave Activities

On Thu, Mar 29, 2012 at 9:22 PM, Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> Hi,
>
> I need a small component to serve as a simple master for triggering a
> number of peers components configured with the SlaveActivities (such a
> component doesn't exist yet, does it?). From the docs[1] it's not entirely
> clear to me how such a master should work. Are the following steps
> correct:
>
>  - get a handle to to the peer task context

yes.

>  - get it's activity (and check it is in fact a SlaveActivity)

there's no way to really check, except by testing the return value of
execute() You don't need to query the activity, the TC interface
offers the necessary functions as well (which map directly to the
activity functions)

>  - run the activities execute function

run update() on the component (maps to activity's execute function)

Peter

Using Slave Activities

On Thu, Mar 29, 2012 at 10:00:07PM +0100, Peter Soetens wrote:
> On Thu, Mar 29, 2012 at 9:22 PM, Markus Klotzbuecher
> <markus [dot] klotzbuecher [..] ...> wrote:
> > Hi,
> >
> > I need a small component to serve as a simple master for triggering a
> > number of peers components configured with the SlaveActivities (such a
> > component doesn't exist yet, does it?). From the docs[1] it's not entirely
> > clear to me how such a master should work. Are the following steps
> > correct:
> >
> >  - get a handle to to the peer task context
>
> yes.
>
> >  - get it's activity (and check it is in fact a SlaveActivity)
>
> there's no way to really check, except by testing the return value of

dynamic_cast ?

> execute() You don't need to query the activity, the TC interface
> offers the necessary functions as well (which map directly to the
> activity functions)

Ok, but what would happen if the peer was not configured with a
SlaveActivity? Would that be detected somehow?

> >  - run the activities execute function
>
> run update() on the component (maps to activity's execute function)

Ok! Thanks!

Markus

Using Slave Activities

On Fri, Mar 30, 2012 at 8:22 AM, Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> On Thu, Mar 29, 2012 at 10:00:07PM +0100, Peter Soetens wrote:
>> On Thu, Mar 29, 2012 at 9:22 PM, Markus Klotzbuecher
>> <markus [dot] klotzbuecher [..] ...> wrote:
>> > Hi,
>> >
>> > I need a small component to serve as a simple master for triggering a
>> > number of peers components configured with the SlaveActivities (such a
>> > component doesn't exist yet, does it?). From the docs[1] it's not entirely
>> > clear to me how such a master should work. Are the following steps
>> > correct:
>> >
>> >  - get a handle to to the peer task context
>>
>> yes.
>>
>> >  - get it's activity (and check it is in fact a SlaveActivity)
>>
>> there's no way to really check, except by testing the return value of
>
> dynamic_cast ?

We're in a component world :-) Your component might be remote still,
in which case casting won't give you anything meaningfull.

>
>> execute() You don't need to query the activity, the TC interface
>> offers the necessary functions as well (which map directly to the
>> activity functions)
>
> Ok, but what would happen if the peer was not configured with a
> SlaveActivity? Would that be detected somehow?

It will ignore your execute() call and return false.

>
>> >  - run the activities execute function
>>
>> run update() on the component (maps to activity's execute function)
>
> Ok! Thanks!
>
> Markus

Using Slave Activities

On Fri, Mar 30, 2012 at 08:38:25AM +0100, Peter Soetens wrote:
> On Fri, Mar 30, 2012 at 8:22 AM, Markus Klotzbuecher
> <markus [dot] klotzbuecher [..] ...> wrote:
> > On Thu, Mar 29, 2012 at 10:00:07PM +0100, Peter Soetens wrote:
> >> On Thu, Mar 29, 2012 at 9:22 PM, Markus Klotzbuecher
> >> <markus [dot] klotzbuecher [..] ...> wrote:
> >> > Hi,
> >> >
> >> > I need a small component to serve as a simple master for triggering a
> >> > number of peers components configured with the SlaveActivities (such a
> >> > component doesn't exist yet, does it?). From the docs[1] it's not entirely
> >> > clear to me how such a master should work. Are the following steps
> >> > correct:
> >> >
> >> >  - get a handle to to the peer task context
> >>
> >> yes.
> >>
> >> >  - get it's activity (and check it is in fact a SlaveActivity)
> >>
> >> there's no way to really check, except by testing the return value of
> >
> > dynamic_cast ?
>
> We're in a component world :-) Your component might be remote still,
> in which case casting won't give you anything meaningfull.

This is to serialize computations in-thread! (But you are right, of
course :-))

> >> execute() You don't need to query the activity, the TC interface
> >> offers the necessary functions as well (which map directly to the
> >> activity functions)
> >
> > Ok, but what would happen if the peer was not configured with a
> > SlaveActivity? Would that be detected somehow?
>
> It will ignore your execute() call and return false.

Ok.

Thanks!
Markus