Hi,
I have several components that take some time to configure. Some of this
time is due to hardware, so the processor is not working and I would like
to do this in parallel.
Is there a mean to do this in C++ ? in script ?
The Orocos ProjectSmarter control in robotics & automation! |
|
Configuring component in background
Hi, I have several components that take some time to configure. Some of this Is there a mean to do this in C++ ? in script ? |
Configuring component in background
Hi Willy,
On Sun, Feb 19, 2012 at 05:39:06PM +0100, Willy Lambert wrote:
>
> I have several components that take some time to configure. Some of this time
> is due to hardware, so the processor is not working and I would like to do this
> in parallel.
>
> Is there a mean to do this in C++ ? in script ?
One idea: if your components don't have any dependencies for
configuration, you could try to "send" your "configure" operations
instead of calling them?
Markus
For example in Lua (takes a table of "tc" handles). (Completly
untested).
function configure_in_parallel(comps)
local handles={}
-- send all "configure" ops
for _,c in ipairs(comps) do
handles[#handles+1] = c:getOperation("configure"):send()
end
-- wait for all handles
for _,h in ipairs(handles) do h:collect() end
end
Configuring component in background
2012/2/20 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> Hi Willy,
>
> On Sun, Feb 19, 2012 at 05:39:06PM +0100, Willy Lambert wrote:
> >
> > I have several components that take some time to configure. Some of this
> time
> > is due to hardware, so the processor is not working and I would like to
> do this
> > in parallel.
> >
> > Is there a mean to do this in C++ ? in script ?
>
> One idea: if your components don't have any dependencies for
> configuration, you could try to "send" your "configure" operations
> instead of calling them?
>
> Markus
>
> For example in Lua (takes a table of "tc" handles). (Completly
> untested).
>
> function configure_in_parallel(comps)
> local handles={}
> -- send all "configure" ops
> for _,c in ipairs(comps) do
> handles[#handles+1] = c:getOperation("configure"):send()
> end
> -- wait for all handles
> for _,h in ipairs(handles) do h:collect() end
> end
>
Thanks, this is what I want to do but in C++. I usually call the
configure() function on my slave peers, but I think this is not going
througth the Operation calls. Should I use the getOperation("configure")
instead of calling directly the C++ function ?
Configuring component in background
On Mon, Feb 20, 2012 at 12:30:16PM +0100, Willy Lambert wrote:
>
>
> 2012/2/20 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> Hi Willy,
>
> On Sun, Feb 19, 2012 at 05:39:06PM +0100, Willy Lambert wrote:
> >
> > I have several components that take some time to configure. Some of this
> time
> > is due to hardware, so the processor is not working and I would like to
> do this
> > in parallel.
> >
> > Is there a mean to do this in C++ ? in script ?
>
> One idea: if your components don't have any dependencies for
> configuration, you could try to "send" your "configure" operations
> instead of calling them?
>
> Markus
>
> For example in Lua (takes a table of "tc" handles). (Completly
> untested).
>
> function configure_in_parallel(comps)
> local handles={}
> -- send all "configure" ops
> for _,c in ipairs(comps) do
> handles[#handles+1] = c:getOperation("configure"):send()
> end
> -- wait for all handles
> for _,h in ipairs(handles) do h:collect() end
> end
>
>
> Thanks, this is what I want to do but in C++. I usually call the configure()
> function on my slave peers, but I think this is not going througth the
> Operation calls. Should I use the getOperation("configure") instead of calling
> directly the C++ function ?
The important thing is to asynchronously call the operation (AKA to
"send" it)! You can do from C++ too, although I wonder why you would
want to do such deployment stuff from C++...
Best regards
Markus
Configuring component in background
2012/2/20 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> On Mon, Feb 20, 2012 at 12:30:16PM +0100, Willy Lambert wrote:
> >
> >
> > 2012/2/20 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > Hi Willy,
> >
> > On Sun, Feb 19, 2012 at 05:39:06PM +0100, Willy Lambert wrote:
> > >
> > > I have several components that take some time to configure. Some
> of this
> > time
> > > is due to hardware, so the processor is not working and I would
> like to
> > do this
> > > in parallel.
> > >
> > > Is there a mean to do this in C++ ? in script ?
> >
> > One idea: if your components don't have any dependencies for
> > configuration, you could try to "send" your "configure" operations
> > instead of calling them?
> >
> > Markus
> >
> > For example in Lua (takes a table of "tc" handles). (Completly
> > untested).
> >
> > function configure_in_parallel(comps)
> > local handles={}
> > -- send all "configure" ops
> > for _,c in ipairs(comps) do
> > handles[#handles+1] = c:getOperation("configure"):send()
> > end
> > -- wait for all handles
> > for _,h in ipairs(handles) do h:collect() end
> > end
> >
> >
> > Thanks, this is what I want to do but in C++. I usually call the
> configure()
> > function on my slave peers, but I think this is not going througth the
> > Operation calls. Should I use the getOperation("configure") instead of
> calling
> > directly the C++ function ?
>
> The important thing is to asynchronously call the operation (AKA to
> "send" it)! You can do from C++ too, although I wonder why you would
> want to do such deployment stuff from C++...
>
>
It's about competecies of people I work with. They do no how to do C++, not
always other languages. Orocos scripts were a way because of the
similitudes with C++ but it is not always easy to do some complex stuff.
It's a pragmatic problem.
This is not done in the deployment but in a "monitoring component". I am
just missing the composition in Orocos so this kind of components are doing
it for me. I configure the monitor, and it configure all the slave peers.
For instance, in the hardware lawer I have to configure/start the "bus
components" before the "nodes components". This C++ component is doing it
for me on a registering base (in the deployment I jsut register component
to the monitor by adding them as "node peers" or bus peers").
I am waiting composition and deployment subject to go further for Orocos to
do clean work on this. For now it's just the direct way that is used. But
If you have suggestions on this I am really keen to listen.
> Best regards
> Markus
>
>
>
>
>
Configuring component in background
On Feb 19, 2012, at 11:39 , Willy Lambert wrote:
> Hi,
>
> I have several components that take some time to configure. Some of this time is due to hardware, so the processor is not working and I would like to do this in parallel.
>
> Is there a mean to do this in C++ ? in script ?
We have similar problems with some of our hardware, and use a state machine/script within the component to manage the configuration of that piece of hardware. A system level coordinator waits for the hardware to become available, before the system can actually do anything. This way all our components start immediately and there is no system-wide stall or delay.
HTH
S