Non Periodic Activity Semantics "term of use"

Hi orocos users.

In orocos-components-manual.html, chapter 5, paragraph 2.2.(Non Periodic Activity Semantics), it's said "the Activity implementation can be used with a period of zero (0)".

I wonder how can i use this feature ?

My Component should always have an activity with a period of zero. So i guess i could set the activity in the constructor ?

But if someone use my component and mistake and set a new activity, my non-periodic activity is loss and the behaviour of my component is not garanteed. The same apply if, with the deployer, someone put an activity to my component.

Does my component can have a kind of read only activity ?

I don't understand how to use this feature.

Please give me more detail on the "term of use" of Non Periodic Activity Semantics.

Thanks.

Paul.

Non Periodic Activity Semantics "term of use"

On Wednesday 13 January 2010 09:35:44 paul [dot] chavent [..] ... wrote:
> Hi orocos users.
>
> In orocos-components-manual.html, chapter 5, paragraph 2.2.(Non Periodic
> Activity Semantics), it's said "the Activity implementation can be used
> with a period of zero (0)".
>
> I wonder how can i use this feature ?
>
> My Component should always have an activity with a period of zero. So i
> guess i could set the activity in the constructor ?

That's allowed in the constructor with

this->setActivity( new Activity(ORO_SCHED_RT, priority, 0));


Since it's always non-periodic, you can even write:

this->setActivity( new NonPeriodicActivity(ORO_SCHED_RT, priority));


>
> But if someone use my component and mistake and set a new activity, my
> non-periodic activity is loss and the behaviour of my component is not
> garanteed. The same apply if, with the deployer, someone put an activity
> to my component.
>
> Does my component can have a kind of read only activity ?
>
> I don't understand how to use this feature.
>
> Please give me more detail on the "term of use" of Non Periodic Activity
> Semantics.

There is currently no way to forbid the changing of an activity by a third
party like the deployer.
However, you can detect a wrong setting in your startHook() and/or
configureHook() (by querying this->getActivity()->isPeriodic() and others) and
return false if so. This refuses to configure() and start() when the activity
is of the wrong type. Once the component is running (after start()), the
activity can no longer be changed (the TaskContext implementation will reject
it), so no more checks are necessary.

Peter

Non Periodic Activity

Thank you for your suggestions.

Can i even do

 
this->setActivity( new NonPeriodicActivity(ORO_SCHED_RT, priority));


in the startHook ? So i needn't any checks ?

Non Periodic Activity Semantics "term of use"

Thank you for your suggestions.

Can i even do

 
this->setActivity( new NonPeriodicActivity(ORO_SCHED_RT, priority));

in the startHook ? So i needn't any checks ?

Non Periodic Activity

On Wednesday 13 January 2010 12:43:36 paul [dot] chavent [..] ... wrote:
> Thank you for your suggestions.
>
> Can i even do
>
> 
> this->setActivity( new NonPeriodicActivity(ORO_SCHED_RT, priority));
>
>
> in the startHook ? So i needn't any checks ?

The separation between configureHook() and startHook() is for allowing non-
real-time safe code in the first, and only real-time code in the second...

Changing the activity from within startHook() is forbidden anyway. We don't
check for it, so you'll get undefined behaviour if you try to do so.

Peter

Non Periodic Activity

On Wed, Jan 13, 2010 at 1:53 PM, Peter Soetens <peter [dot] soetens [..] ...> wrote:
> On Wednesday 13 January 2010 12:43:36 paul [dot] chavent [..] ... wrote:
>> Thank you for your suggestions.
>>
>> Can i even do
>>
>> &#10;&gt;&gt; this-&gt;setActivity( new NonPeriodicActivity(ORO_SCHED_RT, priority));&#10;&gt;&gt;
>>
>> in the startHook ? So i needn't any checks ?
>
> The separation between configureHook() and startHook() is for allowing non-
> real-time safe code in the first, and only real-time code in the second...

Hmm, I (too :-) vaguely remember only updateHook() was executed by the
Activity (connected to the EE) of the component?

Klaas

Non Periodic Activity

On Wednesday 13 January 2010 16:28:08 Klaas Gadeyne wrote:
> On Wed, Jan 13, 2010 at 1:53 PM, Peter Soetens <peter [dot] soetens [..] ...>
wrote:
> > On Wednesday 13 January 2010 12:43:36 paul [dot] chavent [..] ... wrote:
> >> Thank you for your suggestions.
> >>
> >> Can i even do
> >>
> >> &#10;&gt; &gt;&gt; this-&gt;setActivity( new NonPeriodicActivity(ORO_SCHED_RT, priority));&#10;&gt; &gt;&gt;
> >>
> >> in the startHook ? So i needn't any checks ?
> >
> > The separation between configureHook() and startHook() is for allowing
> > non- real-time safe code in the first, and only real-time code in the
> > second...
>
> Hmm, I (too :-) vaguely remember only updateHook() was executed by the
> Activity (connected to the EE) of the component?

A real-time startHook() allows tc.start() to be real-time, and allows starting
and stopping tc's from a real-time (coordinating) context.

Peter

Non Periodic Activity

[...]
>> > The separation between configureHook() and startHook() is for allowing
>> > non- real-time safe code in the first, and only real-time code in the
>> > second...
>>
>> Hmm, I (too :-) vaguely remember only updateHook() was executed by the
>> Activity (connected to the EE) of the component?
>
> A real-time startHook() allows tc.start() to be real-time, and allows starting
> and stopping tc's from a real-time (coordinating) context.

Maybe, it would be nice to allow the "send and forget kind of thing"
[*] for start and stopHook in 2.x, so we can cover all of the use
cases below. [**]

UC1: Non-realtime component, started from deployer. startHook needn't
be real-time, but if startHook() uses a variable that is also used by
updateHook(), need to provide explicit synchronization as they are
executed in different threads.
UC2: The case you describe above
UC3: Start needs to be real-time, but the real-time context you are
referring doesn't need to synchronize, so it can "start 'n' forget"
UC4: Real-time component, started from deployer -> same as UC1.

This is just from the top of my head, so there might be others.

Klaas

[*] http://www.orocos.org/forum/rtt/rtt-dev/rtt-20-requiring-condition-varia...
[**] I know I've should have used the use cases diagram for RTT 2.0
documenting these :-P

Non Periodic Activity

On Thursday 14 January 2010 17:36:52 Klaas Gadeyne wrote:
> [...]
>
> >> > The separation between configureHook() and startHook() is for allowing
> >> > non- real-time safe code in the first, and only real-time code in the
> >> > second...
> >>
> >> Hmm, I (too :-) vaguely remember only updateHook() was executed by the
> >> Activity (connected to the EE) of the component?
> >
> > A real-time startHook() allows tc.start() to be real-time, and allows
> > starting and stopping tc's from a real-time (coordinating) context.
>
> Maybe, it would be nice to allow the "send and forget kind of thing"
> [*] for start and stopHook in 2.x, so we can cover all of the use
> cases below. [**]
>
> UC1: Non-realtime component, started from deployer. startHook needn't
> be real-time, but if startHook() uses a variable that is also used by
> updateHook(), need to provide explicit synchronization as they are
> executed in different threads.
> UC2: The case you describe above
> UC3: Start needs to be real-time, but the real-time context you are
> referring doesn't need to synchronize, so it can "start 'n' forget"
> UC4: Real-time component, started from deployer -> same as UC1.

start() and stop() (in turn calling startHook/stopHook) will be equally
configurable like any TC operation. So all use cases are covered. A default
will be chosen by the RTT, but it will be a single-line override to choose
another policy.

Peter

Non Periodic Activity Semantics "term of use"

Hi orocos users.

In orocos-components-manual.html, chapter 5, paragraph 2.2.(Non Periodic Activity Semantics), it's said "the Activity implementation can be used with a period of zero (0)".

I wonder how can i use this feature ?

My Component should always have an activity with a period of zero. So i guess i could set the activity in the constructor ?

But if someone use my component and mistake and set a new activity, my non-periodic activity is loss and the behaviour of my component is not garanteed.
The same apply if, with the deployer, someone put an activity to my component.

Does my component can have a kind of read only activity ?

I don't understand how to use this feature.

Please give me more detail on the "term of use" of Non Periodic Activity Semantics.

Thanks.

Paul.