Hello,
We have a few Components that are loaded (by a deployment script) with
names that are generated by another Component. We have done this to avoid
name conflicts without us having to manually specify each Component's name
ourselves.
The problem is that these generated names are stored in variables. Since
the various hooks are called in the manner of componentName.hookName, we
have been unable to call their startHooks from the deployment script.
I found that I can achieve this in Lua with
depl:getPeer(componentName):start(). However, we would like to be able to
do this in the Orocos scripting language, in which I have been unable to
find an equivalent to the Lua/C++ getPeer().
Any thoughts/solutions would be appreciated.
Soo-Hyun Yoo
How to start/stop a component when its name is stored in a varia
On Mon, Aug 27, 2012 at 7:17 PM, Soo-Hyun Yoo <yoos117 [..] ...> wrote:
> Hello,
>
> We have a few Components that are loaded (by a deployment script) with
> names that are generated by another Component. We have done this to avoid
> name conflicts without us having to manually specify each Component's name
> ourselves.
>
> The problem is that these generated names are stored in variables. Since
> the various hooks are called in the manner of componentName.hookName, we
> have been unable to call their startHooks from the deployment script.
>
> I found that I can achieve this in Lua with
> depl:getPeer(componentName):start(). However, we would like to be able to
> do this in the Orocos scripting language, in which I have been unable to
> find an equivalent to the Lua/C++ getPeer().
>
Writing component.hookname in Orocos scripting is equivalent to 'getPeer',
it's just done by the parser instead of by you. What you need to do however
is to put it in a second script, since the first script is *first* parsed
completely and *then* executed, so the 'componentname' does not exist yet
at that time. Another method is to use 'top level' statements in your
script (so not in a function nor program snippet), which get parsed &
executed line by line.
Does that make sense to you ?
Peter