NonPeriodic task, and operation with OwnThread option.

Hello.

I know it's a bad conception to try to add an OwnThread operation to a nonperiodic task, but i ran in this case by error.

So in the deployer :

 - while the task is running, the call of the operation never returns.
 - while the task is stopped, the call of the operation returns the good result.
 - while the task is in an fatal error case, it give me an unexpected exception.
I join a test case.

Would you tell me if it is what you expected ?

Thanks.

Paul.

AttachmentSize
own_thread_operation.tar_.bz21.34 KB

NonPeriodic task, and operation with OwnThread option.

On Wednesday 17 November 2010 13:16:55 paul [dot] chavent [..] ... wrote:
> Hello.
>
> I know it's a bad conception to try to add an OwnThread operation to a
> nonperiodic task, but i ran in this case by error.
>
> So in the deployer :
> - while the task is running, the call of the operation never returns.

You must return from updateHook 'from time to time' to process OwnThread
operations. In case your operations are ClientThread, there's no issue.

> - while the task is stopped, the call of the operation returns the good
> result.

Because the thread of the EE is ready to execute the operation.

> - while the task is in an fatal error case, it give me an
> unexpected exception.

That's because the thread is stopped in fatal error. The operation can't be
executed. We still need to formalize the exceptions. Today, you need to use a
catch(...).

>
> I join a test case.
>
> Would you tell me if it is what you expected ?

It all is.

Peter

NonPeriodic task, and operation with OwnThread option.

Hello Peter.

You say "You must return from updateHook 'from time to time' to process OwnThread ". For a non periodic task, it's not very intuitive... I prefer not using OwnThread operation for nonperiodic.

Thank you for your help.

Paul.

========================================
Message du 17/11/10 13:33
De : "Peter Soetens"

A : orocos-users [..] ...
Copie à : paul [dot] chavent [..] ...
Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread option.

On Wednesday 17 November 2010 13:16:55 paul [dot] chavent [..] ... wrote:
> Hello.
>
> I know it's a bad conception to try to add an OwnThread operation to a
> nonperiodic task, but i ran in this case by error.
>
> So in the deployer :
>  - while the task is running, the call of the operation never returns.

You must return from updateHook 'from time to time' to process OwnThread
operations. In case your operations are ClientThread, there's no issue.

>  - while the task is stopped, the call of the operation returns the good
> result.

Because the thread of the EE is ready to execute the operation.

> - while the task is in an fatal error case, it give me an
> unexpected exception.

That's because the thread is stopped in fatal error. The operation can't be
executed. We still need to formalize the exceptions. Today, you need to use a
catch(...).

>
> I join a test case.
>
> Would you tell me if it is what you expected ?

It all is.

Peter

--
Orocos-Users mailing list
Orocos-Users [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users

NonPeriodic task, and operation with OwnThread option.

Something that is not periodic can happens several times : the updateHook
call itself everytime it has finished. It's a kind of while(1) but it let's
orocos doing its stuff after each cycle (like looking for operation to do).
It is like an "ramdom" Period component.

You can also have an updateHook that "return" (it has finished it's
computation) and turn into a sleep mode until the next Orocos "event"
(operation call, portEvent) wake it up. It's like a callbak mode. But be
carefull updateHook is called by default at every event (you can change this
but you have to do something).

If your non periodic component never return from updateHook it's like it has
a "infinite random" period, so Orocos has never time to be processed.

2010/11/18 <paul [dot] chavent [..] ...>

> Hello Peter.
>
> You say "You must return from updateHook 'from time to time' to process
> OwnThread ". For a non periodic task, it's not very intuitive... I prefer
> not using OwnThread operation for nonperiodic.
>
> Thank you for your help.
>
> Paul.
>
> ========================================
> Message du 17/11/10 13:33
> De : "Peter Soetens"
>
> A : orocos-users [..] ...
> Copie à : paul [dot] chavent [..] ...
> Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread
> option.
>
>
> On Wednesday 17 November 2010 13:16:55 paul [dot] chavent [..] ... wrote:
> > Hello.
> >
> > I know it's a bad conception to try to add an OwnThread operation to a
> > nonperiodic task, but i ran in this case by error.
> >
> > So in the deployer :
> > - while the task is running, the call of the operation never returns.
>
> You must return from updateHook 'from time to time' to process OwnThread
> operations. In case your operations are ClientThread, there's no issue.
>
> > - while the task is stopped, the call of the operation returns the good
> > result.
>
> Because the thread of the EE is ready to execute the operation.
>
> > - while the task is in an fatal error case, it give me an
> > unexpected exception.
>
> That's because the thread is stopped in fatal error. The operation can't be
> executed. We still need to formalize the exceptions. Today, you need to use
> a
> catch(...).
>
> >
> > I join a test case.
> >
> > Would you tell me if it is what you expected ?
>
> It all is.
>
> Peter
>
>
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

NonPeriodic task, and operation with OwnThread option.

Hello Willy.

Yes, I have an UpdateHook that never return. I thought that was one possible usage of nonperiodic task.

So you seems to suggest me not doing while(1) in my updateHook, and call trigger before exiting ?

I will consider this solution.

Thanks

========================================
Message du 18/11/10 17:19
De : "Willy Lambert"
A : paul [dot] chavent [..] ...
Copie à : "Peter Soetens"
, orocos-users [..] ...
Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread option.

Something that is not periodic can happens several times : the updateHook
call itself everytime it has finished. It's a kind of while(1) but it let's
orocos doing its stuff after each cycle (like looking for operation to do).
It is like an "ramdom" Period component.

  You can also have an updateHook that "return" (it has finished it's
computation) and turn into a sleep mode until the next Orocos "event"
(operation call, portEvent) wake it up. It's like a callbak mode. But be
carefull updateHook is called by default at every event (you can change this
but you have to do something).

If your non periodic component never return from updateHook it's like it has
a "infinite random" period, so Orocos has never time to be processed.

2010/11/18

> Hello Peter.
>
> You say "You must return from updateHook 'from time to time' to process
> OwnThread ". For a non periodic task, it's not very intuitive... I prefer
> not using OwnThread operation for nonperiodic.
>
> Thank you for your help.
>
> Paul.
>
> ========================================
> Message du 17/11/10 13:33
> De : "Peter Soetens"
>
> A : orocos-users [..] ...
> Copie à : paul [dot] chavent [..] ...
> Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread
> option.
>
>
> On Wednesday 17 November 2010 13:16:55 paul [dot] chavent [..] ... wrote:
> > Hello.
> >
> > I know it's a bad conception to try to add an OwnThread operation to a
> > nonperiodic task, but i ran in this case by error.
> >
> > So in the deployer :
> >  - while the task is running, the call of the operation never returns.
>
> You must return from updateHook 'from time to time' to process OwnThread
> operations. In case your operations are ClientThread, there's no issue.
>
> >  - while the task is stopped, the call of the operation returns the good
> > result.
>
> Because the thread of the EE is ready to execute the operation.
>
> > - while the task is in an fatal error case, it give me an
> > unexpected exception.
>
> That's because the thread is stopped in fatal error. The operation can't be
> executed. We still need to formalize the exceptions. Today, you need to use
> a
> catch(...).
>
> >
> > I join a test case.
> >
> > Would you tell me if it is what you expected ?
>
> It all is.
>
> Peter
>
>
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

--
Orocos-Users mailing list
Orocos-Users [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users

NonPeriodic task, and operation with OwnThread option.

On Nov 18, 2010, at 12:02 , paul [dot] chavent [..] ... wrote:

> Hello Willy.
>
> Yes, I have an UpdateHook that never return. I thought that was one possible usage of nonperiodic task.
>
> So you seems to suggest me not doing while(1) in my updateHook, and call trigger before exiting ?

We have examples of this, updateHook's that never return. It depends on what your component is doing - our component isn't responding to any external Orocos stimulus (except breakUpdateHook). In certain error instances we call trigger() and return from updateHook(), but otherwise we stay in updateHook until told to stop/quit.

So it really depends on what works for you.
S

>
> I will consider this solution.
>
> Thanks
>
> ========================================
> Message du 18/11/10 17:19
> De : "Willy Lambert"
> A : paul [dot] chavent [..] ...
> Copie à : "Peter Soetens"
> , orocos-users [..] ...
> Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread option.
>
> Something that is not periodic can happens several times : the updateHook
> call itself everytime it has finished. It's a kind of while(1) but it let's
> orocos doing its stuff after each cycle (like looking for operation to do).
> It is like an "ramdom" Period component.
>
> You can also have an updateHook that "return" (it has finished it's
> computation) and turn into a sleep mode until the next Orocos "event"
> (operation call, portEvent) wake it up. It's like a callbak mode. But be
> carefull updateHook is called by default at every event (you can change this
> but you have to do something).
>
> If your non periodic component never return from updateHook it's like it has
> a "infinite random" period, so Orocos has never time to be processed.
>
>
> 2010/11/18
>
>> Hello Peter.
>>
>> You say "You must return from updateHook 'from time to time' to process
>> OwnThread ". For a non periodic task, it's not very intuitive... I prefer
>> not using OwnThread operation for nonperiodic.
>>
>> Thank you for your help.
>>
>> Paul.
>>
>> ========================================
>> Message du 17/11/10 13:33
>> De : "Peter Soetens"
>>
>> A : orocos-users [..] ...
>> Copie à : paul [dot] chavent [..] ...
>> Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread
>> option.
>>
>>
>> On Wednesday 17 November 2010 13:16:55 paul [dot] chavent [..] ... wrote:
>>> Hello.
>>>
>>> I know it's a bad conception to try to add an OwnThread operation to a
>>> nonperiodic task, but i ran in this case by error.
>>>
>>> So in the deployer :
>>> - while the task is running, the call of the operation never returns.
>>
>> You must return from updateHook 'from time to time' to process OwnThread
>> operations. In case your operations are ClientThread, there's no issue.
>>
>>> - while the task is stopped, the call of the operation returns the good
>>> result.
>>
>> Because the thread of the EE is ready to execute the operation.
>>
>>> - while the task is in an fatal error case, it give me an
>>> unexpected exception.
>>
>> That's because the thread is stopped in fatal error. The operation can't be
>> executed. We still need to formalize the exceptions. Today, you need to use
>> a
>> catch(...).
>>
>>>
>>> I join a test case.
>>>
>>> Would you tell me if it is what you expected ?
>>
>> It all is.
>>
>> Peter
>>
>>
>>
>> --
>> Orocos-Users mailing list
>> Orocos-Users [..] ...
>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>>
>
>

NonPeriodic task, and operation with OwnThread option.

In this case (but I am not a specialist) I would use trigger() in your case
instead of while(1). It is the same expect that each cycle you'll let orocos
doing it's work

2010/11/18 S Roderick <kiwi [dot] net [..] ...>

> On Nov 18, 2010, at 12:02 , paul [dot] chavent [..] ... wrote:
>
> > Hello Willy.
> >
> > Yes, I have an UpdateHook that never return. I thought that was one
> possible usage of nonperiodic task.
> >
> > So you seems to suggest me not doing while(1) in my updateHook, and call
> trigger before exiting ?
>
> We have examples of this, updateHook's that never return. It depends on
> what your component is doing - our component isn't responding to any
> external Orocos stimulus (except breakUpdateHook). In certain error
> instances we call trigger() and return from updateHook(), but otherwise we
> stay in updateHook until told to stop/quit.
>
> So it really depends on what works for you.
> S
>
> >
> > I will consider this solution.
> >
> > Thanks
> >
> > ========================================
> > Message du 18/11/10 17:19
> > De : "Willy Lambert"
> > A : paul [dot] chavent [..] ...
> > Copie à : "Peter Soetens"
> > , orocos-users [..] ...
> > Objet : Re: [Orocos-users] NonPeriodic task, and operation with OwnThread
> option.
> >
> > Something that is not periodic can happens several times : the updateHook
> > call itself everytime it has finished. It's a kind of while(1) but it
> let's
> > orocos doing its stuff after each cycle (like looking for operation to
> do).
> > It is like an "ramdom" Period component.
> >
> > You can also have an updateHook that "return" (it has finished it's
> > computation) and turn into a sleep mode until the next Orocos "event"
> > (operation call, portEvent) wake it up. It's like a callbak mode. But be
> > carefull updateHook is called by default at every event (you can change
> this
> > but you have to do something).
> >
> > If your non periodic component never return from updateHook it's like it
> has
> > a "infinite random" period, so Orocos has never time to be processed.
> >
> >
> > 2010/11/18
> >
> >> Hello Peter.
> >>
> >> You say "You must return from updateHook 'from time to time' to process
> >> OwnThread ". For a non periodic task, it's not very intuitive... I
> prefer
> >> not using OwnThread operation for nonperiodic.
> >>
> >> Thank you for your help.
> >>
> >> Paul.
> >>
> >> ========================================
> >> Message du 17/11/10 13:33
> >> De : "Peter Soetens"
> >>
> >> A : orocos-users [..] ...
> >> Copie à : paul [dot] chavent [..] ...
> >> Objet : Re: [Orocos-users] NonPeriodic task, and operation with
> OwnThread
> >> option.
> >>
> >>
> >> On Wednesday 17 November 2010 13:16:55 paul [dot] chavent [..] ... wrote:
> >>> Hello.
> >>>
> >>> I know it's a bad conception to try to add an OwnThread operation to a
> >>> nonperiodic task, but i ran in this case by error.
> >>>
> >>> So in the deployer :
> >>> - while the task is running, the call of the operation never returns.
> >>
> >> You must return from updateHook 'from time to time' to process OwnThread
> >> operations. In case your operations are ClientThread, there's no issue.
> >>
> >>> - while the task is stopped, the call of the operation returns the
> good
> >>> result.
> >>
> >> Because the thread of the EE is ready to execute the operation.
> >>
> >>> - while the task is in an fatal error case, it give me an
> >>> unexpected exception.
> >>
> >> That's because the thread is stopped in fatal error. The operation can't
> be
> >> executed. We still need to formalize the exceptions. Today, you need to
> use
> >> a
> >> catch(...).
> >>
> >>>
> >>> I join a test case.
> >>>
> >>> Would you tell me if it is what you expected ?
> >>
> >> It all is.
> >>
> >> Peter
> >>
> >>
> >>
> >> --
> >> Orocos-Users mailing list
> >> Orocos-Users [..] ...
> >> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
> >>
> >
> >
> > --
> > Orocos-Users mailing list
> > Orocos-Users [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>

NonPeriodic task, and operation with OwnThread option.

Hello.

I know it's a bad conception to try to add an OwnThread operation to a nonperiodic task, but i ran in this case by error.

So in the deployer :
- while the task is running, the call of the operation never returns.
- while the task is stopped, the call of the operation returns the good result.
- while the task is in an fatal error case, it give me an unexpected exception.

I join a test case.

Would you tell me if it is what you expected ?

Thanks.

Paul.