Hi all, In this manual there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
in an ops script, in order to wait some seconds. I need the deployer to wait some time before executing two commands in an ops script, like
Component1.start(); //Sleep here for 5 s Component2.start();
but I didn't find how to do it actually.
Does anybody have an idea on how to do that?
Thank you, Best regards,
MDC
"sleep" in ops script
On Jan 17, 2013, at 3:40 AM, mirko [dot] comparetti [..] ... wrote:
> Hi all,
> In
> [http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-components-manual.html
> this manual] there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
> in an ops script, in order to wait some seconds.
> I need the deployer to wait some time before executing two commands in an ops
> script, like
>
>
> Component1.start();
> //Sleep here for 5 s
> Component2.start();
>
>
> but I didn't find how to do it actually.
>
> Does anybody have an idea on how to do that?
>
> Thank you,
> Best regards,
>
> MDC
"sleep" in ops script
Dustin,
On Thu, Jan 17, 2013 at 09:29:19AM -0600, Gooding, Dustin R. (JSC-ER411) wrote:
>
> We use the Lua deployer and found it convenient to use
> "os.execute("sleep x")" where x is the number of seconds (float) we
> want to sleep for. Again, I'm sure this isn't the best way, but
Don't tell anyone, but in Lua there's an undocumented (for good
reasons!) function called rtt.sleep(sec, nsec).
Markus
"sleep" in ops script
Dear Dustin,
I'll investigate the use of the Lua deployment also for that purpose then!
Thank you so much for the suggestion!
Bye!!
- - -
Mirko D. Comparetti
M.Sc., Eng'r, *PhD Student*
Politecnico di Milano - ICT and Bioengineering Department (DEIB)
Neuro Engineering and medicAl Robotics Lab,
Piazza Leonardo da Vinci, 32
20133 Milan, Italy
www.nearlab.polimi.it
Email: mirko [dot] comparetti [..] ...
Phone: +39 02 2399 9013
Fax: +39 02 2399 9003
- .... . / -- .. -. -.. / .. ... / .-.. .. -.- . / .- / .--. .- .-. .- -.-.
.... ..- - .
.. - / .-- --- .-. -.- ... / --- -. .-.. -.-- / .-- .... . -. / .. - / ..
... / --- .--. . -.
2013/1/17 Gooding, Dustin R. (JSC-ER411) <dustin [dot] r [dot] gooding [..] ...>
> On Jan 17, 2013, at 3:40 AM, mirko [dot] comparetti [..] ... wrote:
>
> > Hi all,
> > In
> > [
> http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
> > this manual] there is an example of the use of Timer.sleep( 5.0 ) //
> wait 5s
> > in an ops script, in order to wait some seconds.
> > I need the deployer to wait some time before executing two commands in
> an ops
> > script, like
> >
> >
> > Component1.start();
> > //Sleep here for 5 s
> > Component2.start();
> >
> >
> > but I didn't find how to do it actually.
> >
> > Does anybody have an idea on how to do that?
> >
> > Thank you,
> > Best regards,
> >
> > MDC
> > --
> > Orocos-Users mailing list
> > Orocos-Users [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
> Mirko,
>
> We use the Lua deployer and found it convenient to use "os.execute("sleep
> x")" where x is the number of seconds (float) we want to sleep for. Again,
> I'm sure this isn't the best way, but it's quick and easy. Sorry that this
> doesn't provide help for the standard deployer… but this might be an
> opportunity in disguise to switch to Lua deployment. ;)
>
> -dustin
>
"sleep" in ops script
On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ... wrote:
> Hi all,
> In
> [http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-components-manual.html
> this manual] there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
> in an ops script, in order to wait some seconds.
> I need the deployer to wait some time before executing two commands in an ops
> script, like
>
>
> Component1.start();
> //Sleep here for 5 s
> Component2.start();
>
>
> but I didn't find how to do it actually.
>
> Does anybody have an idea on how to do that?
Adding such timeouts is often an indication of a questionable system
architecture or deployment. If possible, I would recommend getting rid
of such sleeps and instead making the necessary condition for
continuing explicit, e.g. introduce a "ready event" or ready()
operation which you can check in you script.
Markus
"sleep" in ops script
I'll revise the deployment XML.
The problem arise because the components require some input in ports from
other components and they stop because of lacking data and then the
component is not started. If I wait a bit and then I try to start the
component again, it works.
One of this 2 ports are a connectionpolicy with a ros topic
So in this case I assume that there is the need for a short time between
these two components are started.
Thank you,
- - -
Mirko D. Comparetti
M.Sc., Eng'r, *PhD Student*
Politecnico di Milano - ICT and Bioengineering Department (DEIB)
Neuro Engineering and medicAl Robotics Lab,
Piazza Leonardo da Vinci, 32
20133 Milan, Italy
www.nearlab.polimi.it
Email: mirko [dot] comparetti [..] ...
Phone: +39 02 2399 9013
Fax: +39 02 2399 9003
- .... . / -- .. -. -.. / .. ... / .-.. .. -.- . / .- / .--. .- .-. .- -.-.
.... ..- - .
.. - / .-- --- .-. -.- ... / --- -. .-.. -.-- / .-- .... . -. / .. - / ..
... / --- .--. . -.
2013/1/17 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ...e:
> > Hi all,
> > In
> > [
> http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
> > this manual] there is an example of the use of Timer.sleep( 5.0 ) //
> wait 5s
> > in an ops script, in order to wait some seconds.
> > I need the deployer to wait some time before executing two commands in
> an ops
> > script, like
> >
> >
> > Component1.start();
> > //Sleep here for 5 s
> > Component2.start();
> >
> >
> > but I didn't find how to do it actually.
> >
> > Does anybody have an idea on how to do that?
>
> Adding such timeouts is often an indication of a questionable system
> architecture or deployment. If possible, I would recommend getting rid
> of such sleeps and instead making the necessary condition for
> continuing explicit, e.g. introduce a "ready event" or ready()
> operation which you can check in you script.
>
> Markus
>
>
>
>
"sleep" in ops script
On Jan 17, 2013, at 11:03 AM, Mirko Daniele Comparetti <mirko [dot] comparetti [..] ...mirko [dot] comparetti [..] ...>> wrote:
I'll revise the deployment XML.
The problem arise because the components require some input in ports from other components and they stop because of lacking data and then the component is not started. If I wait a bit and then I try to start the component again, it works.
One of this 2 ports are a connectionpolicy with a ros topic
So in this case I assume that there is the need for a short time between these two components are started.
Thank you,
- - -
Mirko D. Comparetti
M.Sc., Eng'r, PhD Student
Politecnico di Milano - ICT and Bioengineering Department (DEIB)
Neuro Engineering and medicAl Robotics Lab,
Piazza Leonardo da Vinci, 32
20133 Milan, Italy
www.nearlab.polimi.it<http://www.nearlab.polimi.it />
Email: mirko [dot] comparetti [..] ...<mailto:mirko [dot] comparetti [..] ...>
Phone: +39 02 2399 9013
Fax: +39 02 2399 9003
- .... . / -- .. -. -.. / .. ... / .-.. .. -.- . / .- / .--. .- .-. .- -.-. .... ..- - .
.. - / .-- --- .-. -.- ... / --- -. .-.. -.-- / .-- .... . -. / .. - / .. ... / --- .--. . -.
2013/1/17 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...markus [dot] klotzbuecher [..] ...>>
On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ...<mailto:mirko [dot] comparetti [..] ...> wrote:
> Hi all,
> In
> [http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-components-manual.html
> this manual] there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
> in an ops script, in order to wait some seconds.
> I need the deployer to wait some time before executing two commands in an ops
> script, like
>
>
> Component1.start();
> //Sleep here for 5 s
> Component2.start();
>
>
> but I didn't find how to do it actually.
>
> Does anybody have an idea on how to do that?
Adding such timeouts is often an indication of a questionable system
architecture or deployment. If possible, I would recommend getting rid
of such sleeps and instead making the necessary condition for
continuing explicit, e.g. introduce a "ready event" or ready()
operation which you can check in you script.
Markus
--
Orocos-Users mailing list
Orocos-Users [..] ...<mailto:Orocos-Users [..] ...>
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
Do you have two components connected to each other through a ROS topic? Why? Why not just connect them using a standard Orocos port, and also publish the OutputPort on a ROS topic for off-board subscribers? This would probably alleviate the need for sleeping all together.
But, this brings up a good question. How do you know when a ROS topic is finished being created/connecting? We have that same issue, and have an arbitrary 1sec sleep to ensure ROS topic-dependent software has a valid connection.
-dustin
"sleep" in ops script
On Thu, Jan 17, 2013 at 11:14:14AM -0600, Gooding, Dustin R. (JSC-ER411) wrote:
...
> Do you have two components connected to each other through a ROS topic? Why?
> Why not just connect them using a standard Orocos port, and also publish the
> OutputPort on a ROS topic for off-board subscribers? This would probably
> alleviate the need for sleeping all together.
>
> But, this brings up a good question. How do you know when a ROS topic is
> finished being created/connecting? We have that same issue, and have an
> arbitrary 1sec sleep to ensure ROS topic-dependent software has a valid
> connection.
I think this is not easy to find out. But couldn't you replace the
sleep with a check if there is NewData on the target port?
Markus
"sleep" in ops script
On Fri, Jan 18, 2013 at 9:23 AM, Markus Klotzbuecher <
markus [dot] klotzbuecher [..] ...> wrote:
> On Thu, Jan 17, 2013 at 11:14:14AM -0600, Gooding, Dustin R. (JSC-ER411)
> wrote:
> ...
>
> > Do you have two components connected to each other through a ROS topic?
> Why?
> > Why not just connect them using a standard Orocos port, and also
> publish the
> > OutputPort on a ROS topic for off-board subscribers? This would
> probably
> > alleviate the need for sleeping all together.
> >
> > But, this brings up a good question. How do you know when a ROS topic
> is
> > finished being created/connecting? We have that same issue, and have an
> > arbitrary 1sec sleep to ensure ROS topic-dependent software has a valid
> > connection.
>
> I think this is not easy to find out. But couldn't you replace the
> sleep with a check if there is NewData on the target port?
>
Actually, there are two things here: the connection itself (being able to
send or receive), or the first data sample (in case of receiving).
Both pieces of information can be expressed using today's API, with
connected() and a read().
The issue is that connected() is not asking the transport for this
information, so this could be
improved in case there are delays. Otherwise, you'd poll on read or install
a callback when
adding the port to the TaskContext. For writing, your data should be
published once connected() returns true....
So my question is: are you waiting for the first data sample or for the
connection and is this in receiving or sending data ?
Peter
"sleep" in ops script
In my case, I'm waiting for the first data in receiving mode.
Thank you,
- - -
Mirko D. Comparetti
M.Sc., Eng'r, *PhD Student*
Politecnico di Milano - ICT and Bioengineering Department (DEIB)
Neuro Engineering and medicAl Robotics Lab,
Piazza Leonardo da Vinci, 32
20133 Milan, Italy
www.nearlab.polimi.it
Email: mirko [dot] comparetti [..] ...
Phone: +39 02 2399 9013
Fax: +39 02 2399 9003
- .... . / -- .. -. -.. / .. ... / .-.. .. -.- . / .- / .--. .- .-. .- -.-.
.... ..- - .
.. - / .-- --- .-. -.- ... / --- -. .-.. -.-- / .-- .... . -. / .. - / ..
... / --- .--. . -.
2013/1/18 Peter Soetens <peter [..] ...>
> On Fri, Jan 18, 2013 at 9:23 AM, Markus Klotzbuecher <
> markus [dot] klotzbuecher [..] ...> wrote:
>
>> On Thu, Jan 17, 2013 at 11:14:14AM -0600, Gooding, Dustin R. (JSC-ER411)
>> wrote:
>> ...
>>
>> > Do you have two components connected to each other through a ROS topic?
>> Why?
>> > Why not just connect them using a standard Orocos port, and also
>> publish the
>> > OutputPort on a ROS topic for off-board subscribers? This would
>> probably
>> > alleviate the need for sleeping all together.
>> >
>> > But, this brings up a good question. How do you know when a ROS topic
>> is
>> > finished being created/connecting? We have that same issue, and have an
>> > arbitrary 1sec sleep to ensure ROS topic-dependent software has a valid
>> > connection.
>>
>> I think this is not easy to find out. But couldn't you replace the
>> sleep with a check if there is NewData on the target port?
>>
>
> Actually, there are two things here: the connection itself (being able to
> send or receive), or the first data sample (in case of receiving).
> Both pieces of information can be expressed using today's API, with
> connected() and a read().
>
> The issue is that connected() is not asking the transport for this
> information, so this could be
> improved in case there are delays. Otherwise, you'd poll on read or
> install a callback when
> adding the port to the TaskContext. For writing, your data should be
> published once connected() returns true....
>
> So my question is: are you waiting for the first data sample or for the
> connection and is this in receiving or sending data ?
>
> Peter
>
>
"sleep" in ops script
No, I'm using the input port to fetch some data from a ROS topic published
by a ROS node.
In OROCOS I'm connecting the components using the standard way as you said.
Your question is actually the problem I was trying to solve with the sleep
function, if there is no other (better) solution.
- - -
Mirko D. Comparetti
M.Sc., Eng'r, *PhD Student*
Politecnico di Milano - ICT and Bioengineering Department (DEIB)
Neuro Engineering and medicAl Robotics Lab,
Piazza Leonardo da Vinci, 32
20133 Milan, Italy
www.nearlab.polimi.it
Email: mirko [dot] comparetti [..] ...
Phone: +39 02 2399 9013
Fax: +39 02 2399 9003
- .... . / -- .. -. -.. / .. ... / .-.. .. -.- . / .- / .--. .- .-. .- -.-.
.... ..- - .
.. - / .-- --- .-. -.- ... / --- -. .-.. -.-- / .-- .... . -. / .. - / ..
... / --- .--. . -.
2013/1/17 Gooding, Dustin R. (JSC-ER411) <dustin [dot] r [dot] gooding [..] ...>
> On Jan 17, 2013, at 11:03 AM, Mirko Daniele Comparetti <
> mirko [dot] comparetti [..] ...> wrote:
>
> I'll revise the deployment XML.
> The problem arise because the components require some input in ports from
> other components and they stop because of lacking data and then the
> component is not started. If I wait a bit and then I try to start the
> component again, it works.
> One of this 2 ports are a connectionpolicy with a ros topic
>
>
> So in this case I assume that there is the need for a short time between
> these two components are started.
>
> Thank you,
>
>
> - - -
> Mirko D. Comparetti
>
> M.Sc., Eng'r, *PhD Student*
> Politecnico di Milano - ICT and Bioengineering Department (DEIB)
> Neuro Engineering and medicAl Robotics Lab,
> Piazza Leonardo da Vinci, 32
> 20133 Milan, Italy
> www.nearlab.polimi.it
>
> Email: mirko [dot] comparetti [..] ...
> Phone: +39 02 2399 9013
> Fax: +39 02 2399 9003
>
> - .... . / -- .. -. -.. / .. ... / .-.. .. -.- . / .- / .--. .- .-. .-
> -.-. .... ..- - .
> .. - / .-- --- .-. -.- ... / --- -. .-.. -.-- / .-- .... . -. / .. - / ..
> ... / --- .--. . -.
>
>
> 2013/1/17 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
>> On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ...e:
>> > Hi all,
>> > In
>> > [
>> http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
>> > this manual] there is an example of the use of Timer.sleep( 5.0 ) //
>> wait 5s
>> > in an ops script, in order to wait some seconds.
>> > I need the deployer to wait some time before executing two commands in
>> an ops
>> > script, like
>> >
>> >
>> > Component1.start();
>> > //Sleep here for 5 s
>> > Component2.start();
>> >
>> >
>> > but I didn't find how to do it actually.
>> >
>> > Does anybody have an idea on how to do that?
>>
>> Adding such timeouts is often an indication of a questionable system
>> architecture or deployment. If possible, I would recommend getting rid
>> of such sleeps and instead making the necessary condition for
>> continuing explicit, e.g. introduce a "ready event" or ready()
>> operation which you can check in you script.
>>
>> Markus
>>
>>
>>
>>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>
>
> Do you have two components connected to each other through a ROS topic?
> Why? Why not just connect them using a standard Orocos port, and also
> publish the OutputPort on a ROS topic for off-board subscribers? This
> would probably alleviate the need for sleeping all together.
>
> But, this brings up a good question. How do you know when a ROS topic is
> finished being created/connecting? We have that same issue, and have an
> arbitrary 1sec sleep to ensure ROS topic-dependent software has a valid
> connection.
>
> -dustin
>
"sleep" in ops script
On Jan 17, 2013, at 8:33 AM, Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...> wrote:
> On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ... wrote:
>> Hi all,
>> In
>> [http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-components-manual.html
>> this manual] there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
>> in an ops script, in order to wait some seconds.
>> I need the deployer to wait some time before executing two commands in an ops
>> script, like
>>
>>
>> Component1.start();
>> //Sleep here for 5 s
>> Component2.start();
>>
>>
>> but I didn't find how to do it actually.
>>
>> Does anybody have an idea on how to do that?
>
> Adding such timeouts is often an indication of a questionable system
> architecture or deployment. If possible, I would recommend getting rid
> of such sleeps and instead making the necessary condition for
> continuing explicit, e.g. introduce a "ready event" or ready()
> operation which you can check in you script.
>
> Markus
>
>
"sleep" in ops script
On Thu, Jan 17, 2013 at 09:13:44AM -0600, Gooding, Dustin R. (JSC-ER411) wrote:
> On Jan 17, 2013, at 8:33 AM, Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...> wrote:
>
> > On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ... wrote:
> >> Hi all,
> >> In
> >> [http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-components-manual.html
> >> this manual] there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
> >> in an ops script, in order to wait some seconds.
> >> I need the deployer to wait some time before executing two commands in an ops
> >> script, like
> >>
> >>
> >> Component1.start();
> >> //Sleep here for 5 s
> >> Component2.start();
> >>
> >>
> >> but I didn't find how to do it actually.
> >>
> >> Does anybody have an idea on how to do that?
> >
> > Adding such timeouts is often an indication of a questionable system
> > architecture or deployment. If possible, I would recommend getting rid
> > of such sleeps and instead making the necessary condition for
> > continuing explicit, e.g. introduce a "ready event" or ready()
> > operation which you can check in you script.
> >
> > Markus
> >
> >
> > --
> > Orocos-Users mailing list
> > Orocos-Users [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>
> In Mirko's defense,
>
> Sometimes those "ready events" are hard to make. For example, we
> have a logic card that has a status register with a handful of bits
> that indicate whether relays are open or closed. Unfortunately,
> some of those bits trigger almost a full 2 seconds before the actual
> relay has changed its state. Unfortunately, reconfiguring the logic
> card isn't feasible. What we do, instead, is issue a command, check
> that the bits are triggered, and then wait 2 seconds before
> continuing. We're not sure of a better way. Using a one-shot timer
> on the Timer component could work, but we haven't tested it. And it
> would still be for an arbitrary (2 sec) duration.
Yes, buggy hardware is one of the few exceptions :-)
Markus
"sleep" in ops script
On Jan 17, 2013, at 10:13 , Gooding, Dustin R. (JSC-ER411) wrote:
> On Jan 17, 2013, at 8:33 AM, Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...> wrote:
>
>> On Thu, Jan 17, 2013 at 09:40:34AM +0000, mirko [dot] comparetti [..] ... wrote:
>>> Hi all,
>>> In
>>> [http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-components-manual.html
>>> this manual] there is an example of the use of Timer.sleep( 5.0 ) // wait 5s
>>> in an ops script, in order to wait some seconds.
>>> I need the deployer to wait some time before executing two commands in an ops
>>> script, like
>>>
>>>
>>> Component1.start();
>>> //Sleep here for 5 s
>>> Component2.start();
>>>
>>>
>>> but I didn't find how to do it actually.
>>>
>>> Does anybody have an idea on how to do that?
>>
>> Adding such timeouts is often an indication of a questionable system
>> architecture or deployment. If possible, I would recommend getting rid
>> of such sleeps and instead making the necessary condition for
>> continuing explicit, e.g. introduce a "ready event" or ready()
>> operation which you can check in you script.
>>
>> Markus
>>
>>
"sleep" in ops script
On Jan 17, 2013, at 07:40 , t [dot] t [dot] g [dot] clephas [..] ... wrote:
> Maybe create (and share ;-) ) a timer component that takes 5 seconds to
> configure (or start) by means of a sleep in this hook.
A timer component already exists in OCL. We use that for exactly these situations. You can also use it for asynchronous timeouts, instead of synchronous sleeps.
YMMV
S
Re: "sleep" in ops script
Maybe create (and share ;-) ) a timer component that takes 5 seconds to configure (or start) by means of a sleep in this hook.
I think the ops file will block untill it receives the boolean back from the hook called.
Regards,
Tim
Timer.sleep( 5.0 ) // wait 5s
in an ops script, in order to wait some seconds. I need the deployer to wait some time before executing two commands in an ops script, likebut I didn't find how to do it actually.
Does anybody have an idea on how to do that?
Thank you, Best regards,
MDC