Periodic/aperiodic activation of a TaskContext

Dear all,

let's say that I have a periodic component, A. A is
periodically triggered for the execution and runs its
updateHook() method. The periodic activation may be due to
a periodic activity running the execution engine of A, or
induced by another component B having A as its peer and
executing trigger() on it.

Let's say that A has also an input event port which is
bound to a callback function. According to the semantics
of RTT, when A receives a signal on that port, both the
callback function and updateHook() are called, with the
callback function first.

Now, what happens if A receives an event signal while it
does already run updateHook() because of the periodic
activation? Does the event get lost? Is it queued and the
sequence callback()-updateHook() called right after the
running updateHook() ends? Does the running instance of A
get interrupted and another instance started?

Thank you!

--
Matteo

Periodic/aperiodic activation of a TaskContext

On Thu, Mar 14, 2013 at 12:58:59PM +0100, Matteo Morelli wrote:

> let's say that I have a periodic component, A. A is
> periodically triggered for the execution and runs its
> updateHook() method. The periodic activation may be due to
> a periodic activity running the execution engine of A, or
> induced by another component B having A as its peer and
> executing trigger() on it.
>
> Let's say that A has also an input event port which is
> bound to a callback function. According to the semantics
> of RTT, when A receives a signal on that port, both the
> callback function and updateHook() are called, with the
> callback function first.
>
> Now, what happens if A receives an event signal while it
> does already run updateHook() because of the periodic
> activation? Does the event get lost? Is it queued and the
> sequence callback()-updateHook() called right after the
> running updateHook() ends? Does the running instance of A
> get interrupted and another instance started?

IIRC, combining both triggering via PeriodicActivitiy and EventPorts
bound to callback functions is not supported.

Markus

Periodic/aperiodic activation of a TaskContext

On Thu, 14 Mar 2013 14:21:03 +0100
Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> On Thu, Mar 14, 2013 at 12:58:59PM +0100, Matteo Morelli
>wrote:
>
>> let's say that I have a periodic component, A. A is
>> periodically triggered for the execution and runs its
>> updateHook() method. The periodic activation may be due
>> to a periodic activity running the execution engine of
>> A, or induced by another component B having A as its
>> peer and executing trigger() on it.
>>
>> Let's say that A has also an input event port which is
>> bound to a callback function. According to the semantics
>> of RTT, when A receives a signal on that port, both the
>> callback function and updateHook() are called, with the
>> callback function first.
>>
>> Now, what happens if A receives an event signal while it
>> does already run updateHook() because of the periodic
>> activation? Does the event get lost? Is it queued and
>> the sequence callback()-updateHook() called right after
>> the running updateHook() ends? Does the running instance
>> of A get interrupted and another instance started?
>
> IIRC, combining both triggering via PeriodicActivitiy
>and EventPorts
> bound to callback functions is not supported.

Ok, maybe PeriodicActivities are not supported. See here:
http://comments.gmane.org/gmane.science.robotics.orocos.devel/8457.
It seems, however, that periodicity + aperiodicity in one
component is supported if event ports are used for both
modes (periodic & aperiodic). I assume that

(i) attaching a *non*-periodic activity to A,
(ii) make A a peer of B, and
(iii) induce a periodic behaviour of A by periodically
calling A->trigger() in B's updateHook()

is supported. Is this correct? And if this is the case:

>> what happens if A receives an event signal while it
>> does already run updateHook() because of the periodic
>> activation?

Matteo

Periodic/aperiodic activation of a TaskContext

On Thu, Mar 14, 2013 at 3:01 PM, Matteo Morelli <matteo [dot] morelli [..] ...> wrote:
> On Thu, 14 Mar 2013 14:21:03 +0100
> Markus Klotzbuecher
> <markus [dot] klotzbuecher [..] ...> wrote:
>> On Thu, Mar 14, 2013 at 12:58:59PM +0100, Matteo Morelli
>>wrote:
>>
>>> let's say that I have a periodic component, A. A is
>>> periodically triggered for the execution and runs its
>>> updateHook() method. The periodic activation may be due
>>> to a periodic activity running the execution engine of
>>> A, or induced by another component B having A as its
>>> peer and executing trigger() on it.
>>>
>>> Let's say that A has also an input event port which is
>>> bound to a callback function. According to the semantics
>>> of RTT, when A receives a signal on that port, both the
>>> callback function and updateHook() are called, with the
>>> callback function first.
>>>
>>> Now, what happens if A receives an event signal while it
>>> does already run updateHook() because of the periodic
>>> activation? Does the event get lost? Is it queued and
>>> the sequence callback()-updateHook() called right after
>>> the running updateHook() ends? Does the running instance
>>> of A get interrupted and another instance started?
>>
>> IIRC, combining both triggering via PeriodicActivitiy
>>and EventPorts
>> bound to callback functions is not supported.
>
> Ok, maybe PeriodicActivities are not supported. See here:
> http://comments.gmane.org/gmane.science.robotics.orocos.devel/8457.
> It seems, however, that periodicity + aperiodicity in one
> component is supported if event ports are used for both
> modes (periodic & aperiodic). I assume that
>
> (i) attaching a *non*-periodic activity to A,
> (ii) make A a peer of B, and
> (iii) induce a periodic behaviour of A by periodically
> calling A->trigger() in B's updateHook()
>
> is supported. Is this correct? And if this is the case:

Yes this is supported.

>
>>> what happens if A receives an event signal while it
>>> does already run updateHook() because of the periodic
>>> activation?

updateHook (and any callback added to that port) will be run once more
after that.

What happens behind the scenes is that an eventport calls
trigger() always on your component,scheduling an execution cycle.

Similar behavior can be obtained by using the OCL::TimerComponent
and to connect its timeout port to a port of your A component.
Calling trigger() periodically on a peer is actually a more efficient
way of doing this, and could be an extension of the TimerComponent.

Peter

Periodic/aperiodic activation of a TaskContext

Dear Peter,

On Sun, Mar 17, 2013 at 4:04 PM, Peter Soetens <peter [..] ...> wrote:
> On Thu, Mar 14, 2013 at 3:01 PM, Matteo Morelli <matteo [dot] morelli [..] ...> wrote:
>> On Thu, 14 Mar 2013 14:21:03 +0100
>> Markus Klotzbuecher
>> <markus [dot] klotzbuecher [..] ...> wrote:
>>> On Thu, Mar 14, 2013 at 12:58:59PM +0100, Matteo Morelli
>>>wrote:
>>>
>>>> let's say that I have a periodic component, A. A is
>>>> periodically triggered for the execution and runs its
>>>> updateHook() method. The periodic activation may be due
>>>> to a periodic activity running the execution engine of
>>>> A, or induced by another component B having A as its
>>>> peer and executing trigger() on it.
>>>>
>>>> Let's say that A has also an input event port which is
>>>> bound to a callback function. According to the semantics
>>>> of RTT, when A receives a signal on that port, both the
>>>> callback function and updateHook() are called, with the
>>>> callback function first.
>>>>
>>>> Now, what happens if A receives an event signal while it
>>>> does already run updateHook() because of the periodic
>>>> activation? Does the event get lost? Is it queued and
>>>> the sequence callback()-updateHook() called right after
>>>> the running updateHook() ends? Does the running instance
>>>> of A get interrupted and another instance started?
>>>
>>> IIRC, combining both triggering via PeriodicActivitiy
>>>and EventPorts
>>> bound to callback functions is not supported.
>>
>> Ok, maybe PeriodicActivities are not supported. See here:
>> http://comments.gmane.org/gmane.science.robotics.orocos.devel/8457.
>> It seems, however, that periodicity + aperiodicity in one
>> component is supported if event ports are used for both
>> modes (periodic & aperiodic). I assume that
>>
>> (i) attaching a *non*-periodic activity to A,
>> (ii) make A a peer of B, and
>> (iii) induce a periodic behaviour of A by periodically
>> calling A->trigger() in B's updateHook()
>>
>> is supported. Is this correct? And if this is the case:
>
> Yes this is supported.
>
>>
>>>> what happens if A receives an event signal while it
>>>> does already run updateHook() because of the periodic
>>>> activation?
>
> updateHook (and any callback added to that port) will be run once more
> after that.
>
> What happens behind the scenes is that an eventport calls
> trigger() always on your component,scheduling an execution cycle.
>
> Similar behavior can be obtained by using the OCL::TimerComponent
> and to connect its timeout port to a port of your A component.
> Calling trigger() periodically on a peer is actually a more efficient
> way of doing this, and could be an extension of the TimerComponent.

Great. That is exactly the behavior I was expecting. Also, thank you
for the explaination of what happens "behind the scenes" in lieu of a
simple "Yes/No" answer. Very much appreciated!

>
> Peter

Matteo

Periodic/aperiodic activation of a TaskContext

On Thu, Mar 14, 2013 at 03:01:08PM +0100, Matteo Morelli wrote:
> On Thu, 14 Mar 2013 14:21:03 +0100
> Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...> wrote:
> >On Thu, Mar 14, 2013 at 12:58:59PM +0100, Matteo Morelli wrote:
> >
> >>let's say that I have a periodic component, A. A is periodically
> >>triggered for the execution and runs its updateHook() method.
> >>The periodic activation may be due to a periodic activity
> >>running the execution engine of
> >>A, or induced by another component B having A as its
> >>peer and executing trigger() on it.
> >>
> >>Let's say that A has also an input event port which is bound to
> >>a callback function. According to the semantics of RTT, when A
> >>receives a signal on that port, both the callback function and
> >>updateHook() are called, with the callback function first.
> >>
> >>Now, what happens if A receives an event signal while it does
> >>already run updateHook() because of the periodic activation?
> >>Does the event get lost? Is it queued and the sequence
> >>callback()-updateHook() called right after
> >>the running updateHook() ends? Does the running instance
> >>of A get interrupted and another instance started?
> >
> >IIRC, combining both triggering via PeriodicActivitiy and
> >EventPorts
> >bound to callback functions is not supported.
>
> Ok, maybe PeriodicActivities are not supported. See here:
> http://comments.gmane.org/gmane.science.robotics.orocos.devel/8457.
> It seems, however, that periodicity + aperiodicity in one component
> is supported if event ports are used for both modes (periodic &
> aperiodic). I assume that
>
> (i) attaching a *non*-periodic activity to A,
> (ii) make A a peer of B, and
> (iii) induce a periodic behaviour of A by periodically calling
> A->trigger() in B's updateHook()
>
> is supported. Is this correct? And if this is the case:

No, I think you must use event ports both for periodic and aperioc
triggering.

> >>what happens if A receives an event signal while it does already
> >>run updateHook() because of the periodic activation?

Not 100% sure since I never use event port-bound functions, but I
think in that case the function will execute _after_ updateHooks
completes.

Markus