Playing with scripts

Hi all,

I am playing with rtt scripts and I am hurt by 2 things.

1/ I have a "Clock Component" with a periodic activity which is awaking
Subscribers via an EventPort. Each event port have an Activity with no
period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
components are trying to use scripts. As they don't have a real period the
scripting plugin is complaining with "Loading program configureNode in a
TaskContext with getPeriod() == 0. Use setPeriod(period) in order to setup
execution of scripts.". So I wonder :
_ Is it the rigth methodto awake a clocked component with a 0 period
Activity ? (I am not using SlaveActivity because I don't want the clock to
be stalled on each component, they have to run alltogether with a common
start point)
_ If this is the rigth method, Is the warning a problem ? Will I have
scripting problem due to this indirect periodicity ?
_ If all is good, do I have a mean to deactivate this warning ?

2/ My components automatically load scripts during the configure phase. If a
component miss its configure after having successfully loaded all the its
scripts, I can't call the configure once again since It will try to reload
the scripts and will fail because a program with the same name is already
existing. My problem is that I know which scripts I have loaded (xxx.ops)
but I don't know which programs are in it. Do I have a mean to check the
second time I do a configure if the script was successfully loaded ?

Playing with scripts

On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> Hi all,
>
> I am playing with rtt scripts and I am hurt by 2 things.
>
> 1/ I have a "Clock Component" with a periodic activity which is awaking
> Subscribers via an EventPort. Each event port have an Activity with no
> period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> components are trying to use scripts. As they don't have a real period the
> scripting plugin is complaining with "Loading program configureNode in a
> TaskContext with getPeriod() == 0. Use setPeriod(period) in order to setup
> execution of scripts.". So I wonder :
> _ Is it the rigth methodto awake a clocked component with a 0 period
> Activity ? (I am not using SlaveActivity because I don't want the clock to
> be stalled on each component, they have to run alltogether with a common
> start point)

This is certainly allowed.

> _ If this is the rigth method, Is the warning a problem ? Will I have
> scripting problem due to this indirect periodicity ?

Well, it's just hard to predict where your script will end up (ie how far it
gets in one trigger()) in a non periodic component. Each time the script
logic does not find an immediate continuation branch (even maybe due to a bug),
the script will stall and wait for the next execution.

> _ If all is good, do I have a mean to deactivate this warning ?

We can add a property to that scripting service to disable it (nice exercise
in RTT programming :-D ) You should still be careful not to assume too much on
when your script will 'pause'.

>
> 2/ My components automatically load scripts during the configure phase. If
> a component miss its configure after having successfully loaded all the
> its scripts, I can't call the configure once again since It will try to
> reload the scripts and will fail because a program with the same name is
> already existing. My problem is that I know which scripts I have loaded
> (xxx.ops) but I don't know which programs are in it. Do I have a mean to
> check the second time I do a configure if the script was successfully
> loaded ?

You can check for program names, but not for files. In case you use scripted
deployment, you could load the scripts from there too, and then call
configure() on the component.

Peter

Playing with scripts

2011/5/3 Peter Soetens <peter [..] ...>

> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> > Hi all,
> >
> > I am playing with rtt scripts and I am hurt by 2 things.
> >
> > 1/ I have a "Clock Component" with a periodic activity which is awaking
> > Subscribers via an EventPort. Each event port have an Activity with no
> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> > components are trying to use scripts. As they don't have a real period
> the
> > scripting plugin is complaining with "Loading program configureNode in a
> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
> setup
> > execution of scripts.". So I wonder :
> > _ Is it the rigth methodto awake a clocked component with a 0 period
> > Activity ? (I am not using SlaveActivity because I don't want the clock
> to
> > be stalled on each component, they have to run alltogether with a common
> > start point)
>
> This is certainly allowed.
>
> > _ If this is the rigth method, Is the warning a problem ? Will I have
> > scripting problem due to this indirect periodicity ?
>
> Well, it's just hard to predict where your script will end up (ie how far
> it
> gets in one trigger()) in a non periodic component. Each time the script
> logic does not find an immediate continuation branch (even maybe due to a
> bug),
> the script will stall and wait for the next execution.
>
> > _ If all is good, do I have a mean to deactivate this warning ?
>
> We can add a property to that scripting service to disable it (nice
> exercise
> in RTT programming :-D ) You should still be careful not to assume too much
> on
> when your script will 'pause'.
>
>
Here is a try, it is not very nice, but anyway it a base you can critizise,
especially on naming. I "stupidly" addProperty to the scripting interface
but this doesn't seems to work (or I don't know how to check it with the
taskbrowser).
I there other pieces of RTT code doing similar job I could copy ?

> >
> > 2/ My components automatically load scripts during the configure phase.
> If
> > a component miss its configure after having successfully loaded all the
> > its scripts, I can't call the configure once again since It will try to
> > reload the scripts and will fail because a program with the same name is
> > already existing. My problem is that I know which scripts I have loaded
> > (xxx.ops) but I don't know which programs are in it. Do I have a mean to
> > check the second time I do a configure if the script was successfully
> > loaded ?
>
> You can check for program names, but not for files. In case you use
> scripted
> deployment, you could load the scripts from there too, and then call
> configure() on the component.
>
> Peter
>

Playing with scripts

On Mon, May 16, 2011 at 12:26 AM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
>
>
> 2011/5/3 Peter Soetens <peter [..] ...>
>>
>> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
>> > Hi all,
>> >
>> > I am playing with rtt scripts and I am hurt by 2 things.
>> >
>> > 1/ I have a "Clock Component" with a periodic activity which is awaking
>> > Subscribers via an EventPort. Each event port have an Activity with no
>> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER);  ) and some of these
>> > components are trying to use scripts. As they don't have a real period
>> > the
>> > scripting plugin is complaining with "Loading program configureNode in a
>> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
>> > setup
>> > execution of scripts.". So I wonder :
>> > _ Is it the rigth methodto awake a clocked component with a 0 period
>> > Activity ? (I am not using SlaveActivity because I don't want the clock
>> > to
>> > be stalled on each component, they have to run alltogether with a common
>> > start point)
>>
>> This is certainly allowed.
>>
>> > _ If this is the rigth method, Is the warning a problem ? Will I have
>> > scripting problem due to this indirect periodicity ?
>>
>> Well, it's just hard to predict where your script will end up (ie how far
>> it
>> gets in one trigger()) in a non periodic component.  Each time the script
>> logic does not find an immediate continuation branch (even maybe due to a
>> bug),
>> the script will stall and wait for the next execution.
>>
>> > _ If all is good, do I have a mean to deactivate this warning ?
>>
>> We can add a property to that scripting service to disable it (nice
>> exercise
>> in RTT programming :-D ) You should still be careful not to assume too
>> much on
>> when your script will 'pause'.
>>
>
> Here is a try, it is not very nice, but anyway it a base you can critizise,
> especially on naming. I "stupidly" addProperty to the scripting interface
> but this doesn't seems to work (or I don't know how to check it with the
> taskbrowser).

scripting.propWarnZeroPeriodScripts = false

can be called from the taskbrowser (after you .provide scripting), or
from a script you're loading.

> I there other pieces of RTT code doing similar job I could copy ?

It should work. Could you rename it to 'ZeroPeriodWarning' and default
to true in the constructor ?

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

Playing with scripts

2011/5/16 Peter Soetens <peter [..] ...>

> On Mon, May 16, 2011 at 12:26 AM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
> >
> >
> > 2011/5/3 Peter Soetens <peter [..] ...>
> >>
> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> >> > Hi all,
> >> >
> >> > I am playing with rtt scripts and I am hurt by 2 things.
> >> >
> >> > 1/ I have a "Clock Component" with a periodic activity which is
> awaking
> >> > Subscribers via an EventPort. Each event port have an Activity with no
> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> >> > components are trying to use scripts. As they don't have a real period
> >> > the
> >> > scripting plugin is complaining with "Loading program configureNode in
> a
> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
> >> > setup
> >> > execution of scripts.". So I wonder :
> >> > _ Is it the rigth methodto awake a clocked component with a 0 period
> >> > Activity ? (I am not using SlaveActivity because I don't want the
> clock
> >> > to
> >> > be stalled on each component, they have to run alltogether with a
> common
> >> > start point)
> >>
> >> This is certainly allowed.
> >>
> >> > _ If this is the rigth method, Is the warning a problem ? Will I have
> >> > scripting problem due to this indirect periodicity ?
> >>
> >> Well, it's just hard to predict where your script will end up (ie how
> far
> >> it
> >> gets in one trigger()) in a non periodic component. Each time the
> script
> >> logic does not find an immediate continuation branch (even maybe due to
> a
> >> bug),
> >> the script will stall and wait for the next execution.
> >>
> >> > _ If all is good, do I have a mean to deactivate this warning ?
> >>
> >> We can add a property to that scripting service to disable it (nice
> >> exercise
> >> in RTT programming :-D ) You should still be careful not to assume too
> >> much on
> >> when your script will 'pause'.
> >>
> >
> > Here is a try, it is not very nice, but anyway it a base you can
> critizise,
> > especially on naming. I "stupidly" addProperty to the scripting interface
> > but this doesn't seems to work (or I don't know how to check it with the
> > taskbrowser).
>
> scripting.propWarnZeroPeriodScripts = false
>

Yes it does, I didn't tryied it directly. In fact what I did was to hit tab
after writing "scripting.p". It doesn't show this property is existing. Did
I do something wrong ? Is a an expected behavior ?
How a user could find this property ?

BTW should I write any documentation ?

>
> can be called from the taskbrowser (after you .provide scripting), or
> from a script you're loading.
>

>
> > I there other pieces of RTT code doing similar job I could copy ?
>
> It should work. Could you rename it to 'ZeroPeriodWarning'

with a Maj "Z" ?

> and default
> to true in the constructor ?
>

I meant to do this, it is was testing code I did not switched back. I'll do
a patch after you answered for the "Z".
Would you like a trac ticket ?

>
> Peter
>

Playing with scripts

On Mon, May 16, 2011 at 5:04 PM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
>
>
> 2011/5/16 Peter Soetens <peter [..] ...>
>>
>> On Mon, May 16, 2011 at 12:26 AM, Willy Lambert <lambert [dot] willy [..] ...>
>> wrote:
>> >
>> >
>> > 2011/5/3 Peter Soetens <peter [..] ...>
>> >>
>> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
>> >> > Hi all,
>> >> >
>> >> > I am playing with rtt scripts and I am hurt by 2 things.
>> >> >
>> >> > 1/ I have a "Clock Component" with a periodic activity which is
>> >> > awaking
>> >> > Subscribers via an EventPort. Each event port have an Activity with
>> >> > no
>> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER);  ) and some of
>> >> > these
>> >> > components are trying to use scripts. As they don't have a real
>> >> > period
>> >> > the
>> >> > scripting plugin is complaining with "Loading program configureNode
>> >> > in a
>> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
>> >> > setup
>> >> > execution of scripts.". So I wonder :
>> >> > _ Is it the rigth methodto awake a clocked component with a 0 period
>> >> > Activity ? (I am not using SlaveActivity because I don't want the
>> >> > clock
>> >> > to
>> >> > be stalled on each component, they have to run alltogether with a
>> >> > common
>> >> > start point)
>> >>
>> >> This is certainly allowed.
>> >>
>> >> > _ If this is the rigth method, Is the warning a problem ? Will I have
>> >> > scripting problem due to this indirect periodicity ?
>> >>
>> >> Well, it's just hard to predict where your script will end up (ie how
>> >> far
>> >> it
>> >> gets in one trigger()) in a non periodic component.  Each time the
>> >> script
>> >> logic does not find an immediate continuation branch (even maybe due to
>> >> a
>> >> bug),
>> >> the script will stall and wait for the next execution.
>> >>
>> >> > _ If all is good, do I have a mean to deactivate this warning ?
>> >>
>> >> We can add a property to that scripting service to disable it (nice
>> >> exercise
>> >> in RTT programming :-D ) You should still be careful not to assume too
>> >> much on
>> >> when your script will 'pause'.
>> >>
>> >
>> > Here is a try, it is not very nice, but anyway it a base you can
>> > critizise,
>> > especially on naming. I "stupidly" addProperty to the scripting
>> > interface
>> > but this doesn't seems to work (or I don't know how to check it with the
>> > taskbrowser).
>>
>> scripting.propWarnZeroPeriodScripts = false
>
> Yes it does, I didn't tryied it directly. In fact what I did was to hit tab
> after writing "scripting.p". It doesn't show this property is existing. Did
> I do something wrong ? Is a an expected behavior ?

It was a bug in the taskbrowser. I pushed a fix to toolchain-2.3.
Could you test that ?

> How a user could find this property ?

You need to document it as well with the .doc("...") function of addProperty.

>
> BTW should I write any documentation ?

You should update the warning message with a reference to
'scripting.ZeroPeriodWarning' that should do it I guess, in
combination with the .doc().

>
>
>>
>> can be called from the taskbrowser (after you .provide scripting), or
>> from a script you're loading.
>
>
>
>>
>> > I there other pieces of RTT code doing similar job I could copy ?
>>
>> It should work. Could you rename it to 'ZeroPeriodWarning'
>
> with a Maj "Z" ?

Yes, I would prefer that :-)

>
>>
>> and default
>> to true in the constructor ?
>
> I meant to do this, it is was testing code I did not switched back. I'll do
> a patch after you answered for the "Z".
> Would you like a trac ticket ?

Patch on mailinglist is fine. we're having already the discussion here :-)

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

Playing with scripts

2011/5/3 Peter Soetens <peter [..] ...>

> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> > Hi all,
> >
> > I am playing with rtt scripts and I am hurt by 2 things.
> >
> > 1/ I have a "Clock Component" with a periodic activity which is awaking
> > Subscribers via an EventPort. Each event port have an Activity with no
> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> > components are trying to use scripts. As they don't have a real period
> the
> > scripting plugin is complaining with "Loading program configureNode in a
> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
> setup
> > execution of scripts.". So I wonder :
> > _ Is it the rigth methodto awake a clocked component with a 0 period
> > Activity ? (I am not using SlaveActivity because I don't want the clock
> to
> > be stalled on each component, they have to run alltogether with a common
> > start point)
>
> This is certainly allowed.
>
> > _ If this is the rigth method, Is the warning a problem ? Will I have
> > scripting problem due to this indirect periodicity ?
>
> Well, it's just hard to predict where your script will end up (ie how far
> it
> gets in one trigger()) in a non periodic component. Each time the script
> logic does not find an immediate continuation branch (even maybe due to a
> bug),
> the script will stall and wait for the next execution.
>
> > _ If all is good, do I have a mean to deactivate this warning ?
>
> We can add a property to that scripting service to disable it (nice
> exercise
> in RTT programming :-D ) You should still be careful not to assume too much
> on
> when your script will 'pause'.
>

I am just interested in knowning if the Program is finished without errors.
Is that yourt point, I'll never know if it is blocked on an Operation or if
the script end ? Maybe I should use a variable that I set to true at the end
of the program.

>
> >
> > 2/ My components automatically load scripts during the configure phase.
> If
> > a component miss its configure after having successfully loaded all the
> > its scripts, I can't call the configure once again since It will try to
> > reload the scripts and will fail because a program with the same name is
> > already existing. My problem is that I know which scripts I have loaded
> > (xxx.ops) but I don't know which programs are in it. Do I have a mean to
> > check the second time I do a configure if the script was successfully
> > loaded ?
>
> You can check for program names, but not for files. In case you use
> scripted
> deployment, you could load the scripts from there too, and then call
> configure() on the component.
>
> Peter
>

Playing with scripts

On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
>
>
> 2011/5/3 Peter Soetens <peter [..] ...>
>>
>> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
>> > Hi all,
>> >
>> > I am playing with rtt scripts and I am hurt by 2 things.
>> >
>> > 1/ I have a "Clock Component" with a periodic activity which is awaking
>> > Subscribers via an EventPort. Each event port have an Activity with no
>> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER);  ) and some of these
>> > components are trying to use scripts. As they don't have a real period
>> > the
>> > scripting plugin is complaining with "Loading program configureNode in a
>> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
>> > setup
>> > execution of scripts.". So I wonder :
>> > _ Is it the rigth methodto awake a clocked component with a 0 period
>> > Activity ? (I am not using SlaveActivity because I don't want the clock
>> > to
>> > be stalled on each component, they have to run alltogether with a common
>> > start point)
>>
>> This is certainly allowed.
>>
>> > _ If this is the rigth method, Is the warning a problem ? Will I have
>> > scripting problem due to this indirect periodicity ?
>>
>> Well, it's just hard to predict where your script will end up (ie how far
>> it
>> gets in one trigger()) in a non periodic component.  Each time the script
>> logic does not find an immediate continuation branch (even maybe due to a
>> bug),
>> the script will stall and wait for the next execution.
>>
>> > _ If all is good, do I have a mean to deactivate this warning ?
>>
>> We can add a property to that scripting service to disable it (nice
>> exercise
>> in RTT programming :-D ) You should still be careful not to assume too
>> much on
>> when your script will 'pause'.
>
> I am just interested in knowning if the Program is finished without errors.
> Is that yourt point, I'll never know if it is blocked on an Operation or if
> the script end ? Maybe I should use a variable that I set to true at the end
> of the program.

Each program Foo { } is available as a service. So you can query if it
is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
success/error flag as easily.

>
>
>>
>> >
>> > 2/ My components automatically load scripts during the configure phase.
>> > If
>> > a component miss its configure after having successfully loaded all the
>> > its scripts, I can't call the configure once again since It will try to
>> > reload the scripts and will fail because a program with the same name is
>> > already existing. My problem is that I know which scripts I have loaded
>> > (xxx.ops) but I don't know which programs are in it. Do I have a mean to
>> > check the second time I do a configure if the script was successfully
>> > loaded ?
>>
>> You can check for program names, but not for files. In case you use
>> scripted
>> deployment, you could load the scripts from there too, and then call
>> configure() on the component.
>>
>> Peter
>
>

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

Playing with scripts

2011/5/4 Peter Soetens <peter [..] ...>

> On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
> >
> >
> > 2011/5/3 Peter Soetens <peter [..] ...>
> >>
> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> >> > Hi all,
> >> >
> >> > I am playing with rtt scripts and I am hurt by 2 things.
> >> >
> >> > 1/ I have a "Clock Component" with a periodic activity which is
> awaking
> >> > Subscribers via an EventPort. Each event port have an Activity with no
> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> >> > components are trying to use scripts. As they don't have a real period
> >> > the
> >> > scripting plugin is complaining with "Loading program configureNode in
> a
> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
> >> > setup
> >> > execution of scripts.". So I wonder :
> >> > _ Is it the rigth methodto awake a clocked component with a 0 period
> >> > Activity ? (I am not using SlaveActivity because I don't want the
> clock
> >> > to
> >> > be stalled on each component, they have to run alltogether with a
> common
> >> > start point)
> >>
> >> This is certainly allowed.
> >>
> >> > _ If this is the rigth method, Is the warning a problem ? Will I have
> >> > scripting problem due to this indirect periodicity ?
> >>
> >> Well, it's just hard to predict where your script will end up (ie how
> far
> >> it
> >> gets in one trigger()) in a non periodic component. Each time the
> script
> >> logic does not find an immediate continuation branch (even maybe due to
> a
> >> bug),
> >> the script will stall and wait for the next execution.
> >>
> >> > _ If all is good, do I have a mean to deactivate this warning ?
> >>
> >> We can add a property to that scripting service to disable it (nice
> >> exercise
> >> in RTT programming :-D ) You should still be careful not to assume too
> >> much on
> >> when your script will 'pause'.
> >
> > I am just interested in knowning if the Program is finished without
> errors.
> > Is that yourt point, I'll never know if it is blocked on an Operation or
> if
> > the script end ? Maybe I should use a variable that I set to true at the
> end
> > of the program.
>
> Each program Foo { } is available as a service. So you can query if it
> is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
> success/error flag as easily.
>

This use is for my configureHook. Isn't it simpler to use runScript in C++
and waits this to finish properly ?

>
>
> >
> >
> >>
> >> >
> >> > 2/ My components automatically load scripts during the configure
> phase.
> >> > If
> >> > a component miss its configure after having successfully loaded all
> the
> >> > its scripts, I can't call the configure once again since It will try
> to
> >> > reload the scripts and will fail because a program with the same name
> is
> >> > already existing. My problem is that I know which scripts I have
> loaded
> >> > (xxx.ops) but I don't know which programs are in it. Do I have a mean
> to
> >> > check the second time I do a configure if the script was successfully
> >> > loaded ?
> >>
> >> You can check for program names, but not for files. In case you use
> >> scripted
> >> deployment, you could load the scripts from there too, and then call
> >> configure() on the component.
> >>
> >> Peter
> >
> >
>
> Peter
>

Playing with scripts

2011/5/4 Peter Soetens <peter [..] ...>

> On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
> >
> >
> > 2011/5/3 Peter Soetens <peter [..] ...>
> >>
> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> >> > Hi all,
> >> >
> >> > I am playing with rtt scripts and I am hurt by 2 things.
> >> >
> >> > 1/ I have a "Clock Component" with a periodic activity which is
> awaking
> >> > Subscribers via an EventPort. Each event port have an Activity with no
> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> >> > components are trying to use scripts. As they don't have a real period
> >> > the
> >> > scripting plugin is complaining with "Loading program configureNode in
> a
> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
> >> > setup
> >> > execution of scripts.". So I wonder :
> >> > _ Is it the rigth methodto awake a clocked component with a 0 period
> >> > Activity ? (I am not using SlaveActivity because I don't want the
> clock
> >> > to
> >> > be stalled on each component, they have to run alltogether with a
> common
> >> > start point)
> >>
> >> This is certainly allowed.
> >>
> >> > _ If this is the rigth method, Is the warning a problem ? Will I have
> >> > scripting problem due to this indirect periodicity ?
> >>
> >> Well, it's just hard to predict where your script will end up (ie how
> far
> >> it
> >> gets in one trigger()) in a non periodic component. Each time the
> script
> >> logic does not find an immediate continuation branch (even maybe due to
> a
> >> bug),
> >> the script will stall and wait for the next execution.
> >>
> >> > _ If all is good, do I have a mean to deactivate this warning ?
> >>
> >> We can add a property to that scripting service to disable it (nice
> >> exercise
> >> in RTT programming :-D ) You should still be careful not to assume too
> >> much on
> >> when your script will 'pause'.
> >
> > I am just interested in knowning if the Program is finished without
> errors.
> > Is that yourt point, I'll never know if it is blocked on an Operation or
> if
> > the script end ? Maybe I should use a variable that I set to true at the
> end
> > of the program.
>
> Each program Foo { } is available as a service. So you can query if it
> is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
> success/error flag as easily.
>

Is it a mean in the Foo program to force him to go in Error ?

>
>
> >
> >
> >>
> >> >
> >> > 2/ My components automatically load scripts during the configure
> phase.
> >> > If
> >> > a component miss its configure after having successfully loaded all
> the
> >> > its scripts, I can't call the configure once again since It will try
> to
> >> > reload the scripts and will fail because a program with the same name
> is
> >> > already existing. My problem is that I know which scripts I have
> loaded
> >> > (xxx.ops) but I don't know which programs are in it. Do I have a mean
> to
> >> > check the second time I do a configure if the script was successfully
> >> > loaded ?
> >>
> >> You can check for program names, but not for files. In case you use
> >> scripted
> >> deployment, you could load the scripts from there too, and then call
> >> configure() on the component.
> >>
> >> Peter
> >
> >
>
> Peter
>

Playing with scripts

On Sun, May 15, 2011 at 1:48 PM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
>
>
> 2011/5/4 Peter Soetens <peter [..] ...>
>>
>> On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...>
>> wrote:
>> >
>> >
>> > 2011/5/3 Peter Soetens <peter [..] ...>
>> >>
>> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
>> >> > Hi all,
>> >> >
>> >> > I am playing with rtt scripts and I am hurt by 2 things.
>> >> >
>> >> > 1/ I have a "Clock Component" with a periodic activity which is
>> >> > awaking
>> >> > Subscribers via an EventPort. Each event port have an Activity with
>> >> > no
>> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER);  ) and some of
>> >> > these
>> >> > components are trying to use scripts. As they don't have a real
>> >> > period
>> >> > the
>> >> > scripting plugin is complaining with "Loading program configureNode
>> >> > in a
>> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
>> >> > setup
>> >> > execution of scripts.". So I wonder :
>> >> > _ Is it the rigth methodto awake a clocked component with a 0 period
>> >> > Activity ? (I am not using SlaveActivity because I don't want the
>> >> > clock
>> >> > to
>> >> > be stalled on each component, they have to run alltogether with a
>> >> > common
>> >> > start point)
>> >>
>> >> This is certainly allowed.
>> >>
>> >> > _ If this is the rigth method, Is the warning a problem ? Will I have
>> >> > scripting problem due to this indirect periodicity ?
>> >>
>> >> Well, it's just hard to predict where your script will end up (ie how
>> >> far
>> >> it
>> >> gets in one trigger()) in a non periodic component.  Each time the
>> >> script
>> >> logic does not find an immediate continuation branch (even maybe due to
>> >> a
>> >> bug),
>> >> the script will stall and wait for the next execution.
>> >>
>> >> > _ If all is good, do I have a mean to deactivate this warning ?
>> >>
>> >> We can add a property to that scripting service to disable it (nice
>> >> exercise
>> >> in RTT programming :-D ) You should still be careful not to assume too
>> >> much on
>> >> when your script will 'pause'.
>> >
>> > I am just interested in knowning if the Program is finished without
>> > errors.
>> > Is that yourt point, I'll never know if it is blocked on an Operation or
>> > if
>> > the script end ? Maybe I should use a variable that I set to true at the
>> > end
>> > of the program.
>>
>> Each program Foo { } is available as a service. So you can query if it
>> is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
>> success/error flag as easily.
>
> Is it a mean in the Foo program to force him to go in Error ?

The only way is to throw a C++ exception from C++ code. You can throw
anything, like 'throw -1', this will trigger the Error state.

runScript() will stop and return false if such an exception is caught.

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

Playing with scripts

2011/5/16 Peter Soetens <peter [..] ...>

> On Sun, May 15, 2011 at 1:48 PM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
> >
> >
> > 2011/5/4 Peter Soetens <peter [..] ...>
> >>
> >> On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...>
> >> wrote:
> >> >
> >> >
> >> > 2011/5/3 Peter Soetens <peter [..] ...>
> >> >>
> >> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> >> >> > Hi all,
> >> >> >
> >> >> > I am playing with rtt scripts and I am hurt by 2 things.
> >> >> >
> >> >> > 1/ I have a "Clock Component" with a periodic activity which is
> >> >> > awaking
> >> >> > Subscribers via an EventPort. Each event port have an Activity with
> >> >> > no
> >> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of
> >> >> > these
> >> >> > components are trying to use scripts. As they don't have a real
> >> >> > period
> >> >> > the
> >> >> > scripting plugin is complaining with "Loading program configureNode
> >> >> > in a
> >> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order
> to
> >> >> > setup
> >> >> > execution of scripts.". So I wonder :
> >> >> > _ Is it the rigth methodto awake a clocked component with a 0
> period
> >> >> > Activity ? (I am not using SlaveActivity because I don't want the
> >> >> > clock
> >> >> > to
> >> >> > be stalled on each component, they have to run alltogether with a
> >> >> > common
> >> >> > start point)
> >> >>
> >> >> This is certainly allowed.
> >> >>
> >> >> > _ If this is the rigth method, Is the warning a problem ? Will I
> have
> >> >> > scripting problem due to this indirect periodicity ?
> >> >>
> >> >> Well, it's just hard to predict where your script will end up (ie how
> >> >> far
> >> >> it
> >> >> gets in one trigger()) in a non periodic component. Each time the
> >> >> script
> >> >> logic does not find an immediate continuation branch (even maybe due
> to
> >> >> a
> >> >> bug),
> >> >> the script will stall and wait for the next execution.
> >> >>
> >> >> > _ If all is good, do I have a mean to deactivate this warning ?
> >> >>
> >> >> We can add a property to that scripting service to disable it (nice
> >> >> exercise
> >> >> in RTT programming :-D ) You should still be careful not to assume
> too
> >> >> much on
> >> >> when your script will 'pause'.
> >> >
> >> > I am just interested in knowning if the Program is finished without
> >> > errors.
> >> > Is that yourt point, I'll never know if it is blocked on an Operation
> or
> >> > if
> >> > the script end ? Maybe I should use a variable that I set to true at
> the
> >> > end
> >> > of the program.
> >>
> >> Each program Foo { } is available as a service. So you can query if it
> >> is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
> >> success/error flag as easily.
> >
> > Is it a mean in the Foo program to force him to go in Error ?
>
> The only way is to throw a C++ exception from C++ code. You can throw
> anything, like 'throw -1', this will trigger the Error state.
>

Could we add a throwError Operation in the scripting plugin so that script
could set them in fault ?

>
> runScript() will stop and return false if such an exception is caught.
>
> Peter
>

Playing with scripts

On Mon, May 16, 2011 at 5:05 PM, Willy Lambert <lambert [dot] willy [..] ...> wrote:
>
>
> 2011/5/16 Peter Soetens <peter [..] ...>
>>
>> On Sun, May 15, 2011 at 1:48 PM, Willy Lambert <lambert [dot] willy [..] ...>
>> wrote:
>> >
>> >
>> > 2011/5/4 Peter Soetens <peter [..] ...>
>> >>
>> >> On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...>
>> >> wrote:
>> >> >
>> >> >
>> >> > 2011/5/3 Peter Soetens <peter [..] ...>
>> >> >>
>> >> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
>> >> >> > Hi all,
>> >> >> >
>> >> >> > I am playing with rtt scripts and I am hurt by 2 things.
>> >> >> >
>> >> >> > 1/ I have a "Clock Component" with a periodic activity which is
>> >> >> > awaking
>> >> >> > Subscribers via an EventPort. Each event port have an Activity
>> >> >> > with
>> >> >> > no
>> >> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER);  ) and some of
>> >> >> > these
>> >> >> > components are trying to use scripts. As they don't have a real
>> >> >> > period
>> >> >> > the
>> >> >> > scripting plugin is complaining with "Loading program
>> >> >> > configureNode
>> >> >> > in a
>> >> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order
>> >> >> > to
>> >> >> > setup
>> >> >> > execution of scripts.". So I wonder :
>> >> >> > _ Is it the rigth methodto awake a clocked component with a 0
>> >> >> > period
>> >> >> > Activity ? (I am not using SlaveActivity because I don't want the
>> >> >> > clock
>> >> >> > to
>> >> >> > be stalled on each component, they have to run alltogether with a
>> >> >> > common
>> >> >> > start point)
>> >> >>
>> >> >> This is certainly allowed.
>> >> >>
>> >> >> > _ If this is the rigth method, Is the warning a problem ? Will I
>> >> >> > have
>> >> >> > scripting problem due to this indirect periodicity ?
>> >> >>
>> >> >> Well, it's just hard to predict where your script will end up (ie
>> >> >> how
>> >> >> far
>> >> >> it
>> >> >> gets in one trigger()) in a non periodic component.  Each time the
>> >> >> script
>> >> >> logic does not find an immediate continuation branch (even maybe due
>> >> >> to
>> >> >> a
>> >> >> bug),
>> >> >> the script will stall and wait for the next execution.
>> >> >>
>> >> >> > _ If all is good, do I have a mean to deactivate this warning ?
>> >> >>
>> >> >> We can add a property to that scripting service to disable it (nice
>> >> >> exercise
>> >> >> in RTT programming :-D ) You should still be careful not to assume
>> >> >> too
>> >> >> much on
>> >> >> when your script will 'pause'.
>> >> >
>> >> > I am just interested in knowning if the Program is finished without
>> >> > errors.
>> >> > Is that yourt point, I'll never know if it is blocked on an Operation
>> >> > or
>> >> > if
>> >> > the script end ? Maybe I should use a variable that I set to true at
>> >> > the
>> >> > end
>> >> > of the program.
>> >>
>> >> Each program Foo { } is available as a service. So you can query if it
>> >> is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
>> >> success/error flag as easily.
>> >
>> > Is it a mean in the Foo program to force him to go in Error ?
>>
>> The only way is to throw a C++ exception from C++ code. You can throw
>> anything, like 'throw -1', this will trigger the Error state.
>
> Could we add a throwError Operation in the scripting plugin so that script
> could set them in fault ?

Yes. I do prefer a 'service' function above an extension to the
language/parsers.

I would just abbreviate it to 'throw' (ie scripting.throw("foo reason") )

For this function, we could create an exception class that takes a
string argument, giving some information about the reason why we're
throwing.

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

Playing with scripts

2011/5/17 Willy Lambert <lambert [dot] willy [..] ...>

>
>
> 2011/5/16 Peter Soetens <peter [..] ...>
>
>> On Mon, May 16, 2011 at 5:04 PM, Willy Lambert <lambert [dot] willy [..] ...>
>> wrote:
>> >
>> >
>> > 2011/5/16 Peter Soetens <peter [..] ...>
>> >>
>> >> On Mon, May 16, 2011 at 12:26 AM, Willy Lambert <
>> lambert [dot] willy [..] ...>
>> >> wrote:
>> >> >
>> >> >
>> >> > 2011/5/3 Peter Soetens <peter [..] ...>
>> >> >>
>> >> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
>> >> >> > Hi all,
>> >> >> >
>> >> >> > I am playing with rtt scripts and I am hurt by 2 things.
>> >> >> >
>> >> >> > 1/ I have a "Clock Component" with a periodic activity which is
>> >> >> > awaking
>> >> >> > Subscribers via an EventPort. Each event port have an Activity
>> with
>> >> >> > no
>> >> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of
>> >> >> > these
>> >> >> > components are trying to use scripts. As they don't have a real
>> >> >> > period
>> >> >> > the
>> >> >> > scripting plugin is complaining with "Loading program
>> configureNode
>> >> >> > in a
>> >> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order
>> to
>> >> >> > setup
>> >> >> > execution of scripts.". So I wonder :
>> >> >> > _ Is it the rigth methodto awake a clocked component with a 0
>> period
>> >> >> > Activity ? (I am not using SlaveActivity because I don't want the
>> >> >> > clock
>> >> >> > to
>> >> >> > be stalled on each component, they have to run alltogether with a
>> >> >> > common
>> >> >> > start point)
>> >> >>
>> >> >> This is certainly allowed.
>> >> >>
>> >> >> > _ If this is the rigth method, Is the warning a problem ? Will I
>> have
>> >> >> > scripting problem due to this indirect periodicity ?
>> >> >>
>> >> >> Well, it's just hard to predict where your script will end up (ie
>> how
>> >> >> far
>> >> >> it
>> >> >> gets in one trigger()) in a non periodic component. Each time the
>> >> >> script
>> >> >> logic does not find an immediate continuation branch (even maybe due
>> to
>> >> >> a
>> >> >> bug),
>> >> >> the script will stall and wait for the next execution.
>> >> >>
>> >> >> > _ If all is good, do I have a mean to deactivate this warning ?
>> >> >>
>> >> >> We can add a property to that scripting service to disable it (nice
>> >> >> exercise
>> >> >> in RTT programming :-D ) You should still be careful not to assume
>> too
>> >> >> much on
>> >> >> when your script will 'pause'.
>> >> >>
>> >> >
>> >> > Here is a try, it is not very nice, but anyway it a base you can
>> >> > critizise,
>> >> > especially on naming. I "stupidly" addProperty to the scripting
>> >> > interface
>> >> > but this doesn't seems to work (or I don't know how to check it with
>> the
>> >> > taskbrowser).
>> >>
>> >> scripting.propWarnZeroPeriodScripts = false
>> >
>> > Yes it does, I didn't tryied it directly. In fact what I did was to hit
>> tab
>> > after writing "scripting.p". It doesn't show this property is existing.
>> Did
>> > I do something wrong ? Is a an expected behavior ?
>>
>> It was a bug in the taskbrowser. I pushed a fix to toolchain-2.3.
>> Could you test that ?
>>
>>
> Yes, it doesn't seem to work. I did not rebuild everything, I'll do it this
> nigth. I'll tell you if it is working.
>

It doesn't work

>
>
>
>> > How a user could find this property ?
>>
>> You need to document it as well with the .doc("...") function of
>> addProperty.
>>
>
> done
>
>>
>> >
>> > BTW should I write any documentation ?
>>
>> You should update the warning message with a reference to
>> 'scripting.ZeroPeriodWarning' that should do it I guess, in
>> combination with the .doc().
>>
>
> done
>
>>
>> >
>> >
>> >>
>> >> can be called from the taskbrowser (after you .provide scripting), or
>> >> from a script you're loading.
>> >
>> >
>> >
>> >>
>> >> > I there other pieces of RTT code doing similar job I could copy ?
>> >>
>> >> It should work. Could you rename it to 'ZeroPeriodWarning'
>> >
>> > with a Maj "Z" ?
>>
>> Yes, I would prefer that :-)
>>
>
> ok
>
>>
>> >
>> >>
>> >> and default
>> >> to true in the constructor ?
>>
> corrected
>
>
>> >
>> > I meant to do this, it is was testing code I did not switched back. I'll
>> do
>> > a patch after you answered for the "Z".
>> > Would you like a trac ticket ?
>>
>> Patch on mailinglist is fine. we're having already the discussion here :-)
>>
>
> Here is it. I can't create a patch, I am not good enougth at git. Since I
> git pull git format-patch don't help. Anyway
>
>
>
>>
>> Peter
>>
>
>

Playing with scripts

On Tuesday 17 May 2011 08:14:21 Willy Lambert wrote:
> 2011/5/17 Willy Lambert <lambert [dot] willy [..] ...>
>
> > 2011/5/16 Peter Soetens <peter [..] ...>
> >
> >> On Mon, May 16, 2011 at 5:04 PM, Willy Lambert <lambert [dot] willy [..] ...>
> >>
> >> wrote:
> >> > 2011/5/16 Peter Soetens <peter [..] ...>
> >> >
> >> >> On Mon, May 16, 2011 at 12:26 AM, Willy Lambert <
> >>
> >> lambert [dot] willy [..] ...>
> >>
> >> >> wrote:
> >> >> > 2011/5/3 Peter Soetens <peter [..] ...>
> >> >> >
> >> >> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> >> >> >> > Hi all,
> >> >> >> >
> >> >> >> > I am playing with rtt scripts and I am hurt by 2 things.
> >> >> >> >
> >> >> >> > 1/ I have a "Clock Component" with a periodic activity which is
> >> >> >> > awaking
> >> >> >> > Subscribers via an EventPort. Each event port have an Activity
> >>
> >> with
> >>
> >> >> >> > no
> >> >> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of
> >> >> >> > these
> >> >> >> > components are trying to use scripts. As they don't have a real
> >> >> >> > period
> >> >> >> > the
> >> >> >> > scripting plugin is complaining with "Loading program
> >>
> >> configureNode
> >>
> >> >> >> > in a
> >> >> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in
> >> >> >> > order
> >>
> >> to
> >>
> >> >> >> > setup
> >> >> >> > execution of scripts.". So I wonder :
> >> >> >> > _ Is it the rigth methodto awake a clocked component with a 0
> >>
> >> period
> >>
> >> >> >> > Activity ? (I am not using SlaveActivity because I don't want
> >> >> >> > the clock
> >> >> >> > to
> >> >> >> > be stalled on each component, they have to run alltogether with
> >> >> >> > a common
> >> >> >> > start point)
> >> >> >>
> >> >> >> This is certainly allowed.
> >> >> >>
> >> >> >> > _ If this is the rigth method, Is the warning a problem ? Will I
> >>
> >> have
> >>
> >> >> >> > scripting problem due to this indirect periodicity ?
> >> >> >>
> >> >> >> Well, it's just hard to predict where your script will end up (ie
> >>
> >> how
> >>
> >> >> >> far
> >> >> >> it
> >> >> >> gets in one trigger()) in a non periodic component. Each time the
> >> >> >> script
> >> >> >> logic does not find an immediate continuation branch (even maybe
> >> >> >> due
> >>
> >> to
> >>
> >> >> >> a
> >> >> >> bug),
> >> >> >> the script will stall and wait for the next execution.
> >> >> >>
> >> >> >> > _ If all is good, do I have a mean to deactivate this warning ?
> >> >> >>
> >> >> >> We can add a property to that scripting service to disable it
> >> >> >> (nice exercise
> >> >> >> in RTT programming :-D ) You should still be careful not to assume
> >>
> >> too
> >>
> >> >> >> much on
> >> >> >> when your script will 'pause'.
> >> >> >
> >> >> > Here is a try, it is not very nice, but anyway it a base you can
> >> >> > critizise,
> >> >> > especially on naming. I "stupidly" addProperty to the scripting
> >> >> > interface
> >> >> > but this doesn't seems to work (or I don't know how to check it
> >> >> > with
> >>
> >> the
> >>
> >> >> > taskbrowser).
> >> >>
> >> >> scripting.propWarnZeroPeriodScripts = false
> >> >
> >> > Yes it does, I didn't tryied it directly. In fact what I did was to
> >> > hit
> >>
> >> tab
> >>
> >> > after writing "scripting.p". It doesn't show this property is
> >> > existing.
> >>
> >> Did
> >>
> >> > I do something wrong ? Is a an expected behavior ?
> >>
> >> It was a bug in the taskbrowser. I pushed a fix to toolchain-2.3.
> >> Could you test that ?
> >
> > Yes, it doesn't seem to work. I did not rebuild everything, I'll do it
> > this nigth. I'll tell you if it is working.
>
> It doesn't work

$ rosrun ocl deployer-gnulinux
Switched to : Deployer

This console reader allows you to browse and manipulate TaskContexts.
You can type in an operation, expression, create or change variables.
(type 'help' for instructions and 'ls' for context info)

TAB completion and HISTORY is available ('bash' like)

Deployer [S]> .provide scripting
Trying to locate service 'scripting'...
Service 'scripting' loaded in Deployer
Deployer [S]> scripting.
scripting.activateStateMachine scripting.getProgramStatus scripting.getStateMachineStatus scripting.inStateMachineError scripting.isStateMachineRunning scripting.pauseStateMachine scripting.stepProgram
scripting.deactivateStateMachine scripting.getProgramStatusStr scripting.getStateMachineStatusStr scripting.inStateMachineState scripting.loadProgramText scripting.requestStateMachineState scripting.stopProgram
scripting.eval scripting.getProgramText scripting.getStateMachineText scripting.isProgramPaused scripting.loadPrograms scripting.resetStateMachine scripting.stopStateMachine
scripting.execute scripting.getStateMachineLine scripting.hasProgram scripting.isProgramRunning scripting.loadStateMachineText scripting.runScript scripting.unloadProgram
scripting.getProgramLine scripting.getStateMachineList scripting.hasStateMachine scripting.isStateMachineActive scripting.loadStateMachines scripting.startProgram scripting.unloadStateMachine
scripting.getProgramList scripting.getStateMachineState scripting.inProgramError scripting.isStateMachinePaused scripting.pauseProgram scripting.startStateMachine
Deployer [S]> scripting.ZeroPeriodWarning
= true

Deployer [S]> scripting.ZeroPeriodWarning =false
= false

Deployer [S]>

Here it does... It did not occur in the TAB completion (have a fix for that) but from the moment you type the capital 'Z', it completes it further.

Peter

Playing with scripts

2011/5/19 Peter Soetens <peter [..] ...>

> On Tuesday 17 May 2011 08:14:21 Willy Lambert wrote:
> > 2011/5/17 Willy Lambert <lambert [dot] willy [..] ...>
> >
> > > 2011/5/16 Peter Soetens <peter [..] ...>
> > >
> > >> On Mon, May 16, 2011 at 5:04 PM, Willy Lambert <
> lambert [dot] willy [..] ...>
> > >>
> > >> wrote:
> > >> > 2011/5/16 Peter Soetens <peter [..] ...>
> > >> >
> > >> >> On Mon, May 16, 2011 at 12:26 AM, Willy Lambert <
> > >>
> > >> lambert [dot] willy [..] ...>
> > >>
> > >> >> wrote:
> > >> >> > 2011/5/3 Peter Soetens <peter [..] ...>
> > >> >> >
> > >> >> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> > >> >> >> > Hi all,
> > >> >> >> >
> > >> >> >> > I am playing with rtt scripts and I am hurt by 2 things.
> > >> >> >> >
> > >> >> >> > 1/ I have a "Clock Component" with a periodic activity which
> is
> > >> >> >> > awaking
> > >> >> >> > Subscribers via an EventPort. Each event port have an Activity
> > >>
> > >> with
> > >>
> > >> >> >> > no
> > >> >> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some
> of
> > >> >> >> > these
> > >> >> >> > components are trying to use scripts. As they don't have a
> real
> > >> >> >> > period
> > >> >> >> > the
> > >> >> >> > scripting plugin is complaining with "Loading program
> > >>
> > >> configureNode
> > >>
> > >> >> >> > in a
> > >> >> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in
> > >> >> >> > order
> > >>
> > >> to
> > >>
> > >> >> >> > setup
> > >> >> >> > execution of scripts.". So I wonder :
> > >> >> >> > _ Is it the rigth methodto awake a clocked component with a 0
> > >>
> > >> period
> > >>
> > >> >> >> > Activity ? (I am not using SlaveActivity because I don't want
> > >> >> >> > the clock
> > >> >> >> > to
> > >> >> >> > be stalled on each component, they have to run alltogether
> with
> > >> >> >> > a common
> > >> >> >> > start point)
> > >> >> >>
> > >> >> >> This is certainly allowed.
> > >> >> >>
> > >> >> >> > _ If this is the rigth method, Is the warning a problem ? Will
> I
> > >>
> > >> have
> > >>
> > >> >> >> > scripting problem due to this indirect periodicity ?
> > >> >> >>
> > >> >> >> Well, it's just hard to predict where your script will end up
> (ie
> > >>
> > >> how
> > >>
> > >> >> >> far
> > >> >> >> it
> > >> >> >> gets in one trigger()) in a non periodic component. Each time
> the
> > >> >> >> script
> > >> >> >> logic does not find an immediate continuation branch (even maybe
> > >> >> >> due
> > >>
> > >> to
> > >>
> > >> >> >> a
> > >> >> >> bug),
> > >> >> >> the script will stall and wait for the next execution.
> > >> >> >>
> > >> >> >> > _ If all is good, do I have a mean to deactivate this warning
> ?
> > >> >> >>
> > >> >> >> We can add a property to that scripting service to disable it
> > >> >> >> (nice exercise
> > >> >> >> in RTT programming :-D ) You should still be careful not to
> assume
> > >>
> > >> too
> > >>
> > >> >> >> much on
> > >> >> >> when your script will 'pause'.
> > >> >> >
> > >> >> > Here is a try, it is not very nice, but anyway it a base you can
> > >> >> > critizise,
> > >> >> > especially on naming. I "stupidly" addProperty to the scripting
> > >> >> > interface
> > >> >> > but this doesn't seems to work (or I don't know how to check it
> > >> >> > with
> > >>
> > >> the
> > >>
> > >> >> > taskbrowser).
> > >> >>
> > >> >> scripting.propWarnZeroPeriodScripts = false
> > >> >
> > >> > Yes it does, I didn't tryied it directly. In fact what I did was to
> > >> > hit
> > >>
> > >> tab
> > >>
> > >> > after writing "scripting.p". It doesn't show this property is
> > >> > existing.
> > >>
> > >> Did
> > >>
> > >> > I do something wrong ? Is a an expected behavior ?
> > >>
> > >> It was a bug in the taskbrowser. I pushed a fix to toolchain-2.3.
> > >> Could you test that ?
> > >
> > > Yes, it doesn't seem to work. I did not rebuild everything, I'll do it
> > > this nigth. I'll tell you if it is working.
> >
> > It doesn't work
>
> $ rosrun ocl deployer-gnulinux
> Switched to : Deployer
>
> This console reader allows you to browse and manipulate TaskContexts.
> You can type in an operation, expression, create or change variables.
> (type 'help' for instructions and 'ls' for context info)
>
> TAB completion and HISTORY is available ('bash' like)
>
> Deployer [S]> .provide scripting
> Trying to locate service 'scripting'...
> Service 'scripting' loaded in Deployer
> Deployer [S]> scripting.
> scripting.activateStateMachine scripting.getProgramStatus
> scripting.getStateMachineStatus scripting.inStateMachineError
> scripting.isStateMachineRunning scripting.pauseStateMachine
> scripting.stepProgram
> scripting.deactivateStateMachine scripting.getProgramStatusStr
> scripting.getStateMachineStatusStr scripting.inStateMachineState
> scripting.loadProgramText scripting.requestStateMachineState
> scripting.stopProgram
> scripting.eval scripting.getProgramText
> scripting.getStateMachineText scripting.isProgramPaused
> scripting.loadPrograms scripting.resetStateMachine
> scripting.stopStateMachine
> scripting.execute scripting.getStateMachineLine
> scripting.hasProgram scripting.isProgramRunning
> scripting.loadStateMachineText scripting.runScript
> scripting.unloadProgram
> scripting.getProgramLine scripting.getStateMachineList
> scripting.hasStateMachine scripting.isStateMachineActive
> scripting.loadStateMachines scripting.startProgram
> scripting.unloadStateMachine
> scripting.getProgramList scripting.getStateMachineState
> scripting.inProgramError scripting.isStateMachinePaused
> scripting.pauseProgram scripting.startStateMachine
> Deployer [S]> scripting.ZeroPeriodWarning
> = true
>
> Deployer [S]> scripting.ZeroPeriodWarning =false
> = false
>
> Deployer [S]>
>
> Here it does... It did not occur in the TAB completion (have a fix for
> that) but from the moment you type the capital 'Z', it completes it further.
>
>
I re tested I doesn't on my side. I must be on a wrong branch. But if
things are ok for you I'll re-test it when it'll be on official releases.

> Peter
>
>
>

Playing with scripts

Does this work already? We are working on the newest debian from orocos-toolchain-ros.

But the scripting does not have an option called ZeroPeriodWarning.

Thank,

Tim

Playing with scripts

2011/5/4 Peter Soetens <peter [..] ...>

> On Wed, May 4, 2011 at 4:38 PM, Willy Lambert <lambert [dot] willy [..] ...>
> wrote:
> >
> >
> > 2011/5/3 Peter Soetens <peter [..] ...>
> >>
> >> On Tuesday 03 May 2011 18:32:43 Willy Lambert wrote:
> >> > Hi all,
> >> >
> >> > I am playing with rtt scripts and I am hurt by 2 things.
> >> >
> >> > 1/ I have a "Clock Component" with a periodic activity which is
> awaking
> >> > Subscribers via an EventPort. Each event port have an Activity with no
> >> > period ( setActivity("Io",*0*,0,ORO_SCHED_OTHER); ) and some of these
> >> > components are trying to use scripts. As they don't have a real period
> >> > the
> >> > scripting plugin is complaining with "Loading program configureNode in
> a
> >> > TaskContext with getPeriod() == 0. Use setPeriod(period) in order to
> >> > setup
> >> > execution of scripts.". So I wonder :
> >> > _ Is it the rigth methodto awake a clocked component with a 0 period
> >> > Activity ? (I am not using SlaveActivity because I don't want the
> clock
> >> > to
> >> > be stalled on each component, they have to run alltogether with a
> common
> >> > start point)
> >>
> >> This is certainly allowed.
> >>
> >> > _ If this is the rigth method, Is the warning a problem ? Will I have
> >> > scripting problem due to this indirect periodicity ?
> >>
> >> Well, it's just hard to predict where your script will end up (ie how
> far
> >> it
> >> gets in one trigger()) in a non periodic component. Each time the
> script
> >> logic does not find an immediate continuation branch (even maybe due to
> a
> >> bug),
> >> the script will stall and wait for the next execution.
> >>
> >> > _ If all is good, do I have a mean to deactivate this warning ?
> >>
> >> We can add a property to that scripting service to disable it (nice
> >> exercise
> >> in RTT programming :-D ) You should still be careful not to assume too
> >> much on
> >> when your script will 'pause'.
> >
> > I am just interested in knowning if the Program is finished without
> errors.
> > Is that yourt point, I'll never know if it is blocked on an Operation or
> if
> > the script end ? Maybe I should use a variable that I set to true at the
> end
> > of the program.
>
> Each program Foo { } is available as a service. So you can query if it
> is 'Foo.inError()' or 'Foo.isRunning()' But you could also set a
> success/error flag as easily.
>
> Thanks for all

>
> >
> >
> >>
> >> >
> >> > 2/ My components automatically load scripts during the configure
> phase.
> >> > If
> >> > a component miss its configure after having successfully loaded all
> the
> >> > its scripts, I can't call the configure once again since It will try
> to
> >> > reload the scripts and will fail because a program with the same name
> is
> >> > already existing. My problem is that I know which scripts I have
> loaded
> >> > (xxx.ops) but I don't know which programs are in it. Do I have a mean
> to
> >> > check the second time I do a configure if the script was successfully
> >> > loaded ?
> >>
> >> You can check for program names, but not for files. In case you use
> >> scripted
> >> deployment, you could load the scripts from there too, and then call
> >> configure() on the component.
> >>
> >> Peter
> >
> >
>
> Peter
>