[openrtm-users 01444] Re: about having multiple instance in a manager

Geoffrey Biggs geoffrey.biggs @ aist.go.jp
2010年 10月 25日 (月) 08:42:14 JST


Hi Tony,

On 24/10/10 16:22, Tony Kuo wrote:
> Hi OpenRTM ML and Geoff:
> 
> I was wondering how do I create two instances of the same component with
> a manager in the main() of a component??
> 
> I couldn't find any documentation on the website, except in the tutorial
> on rtcshell (rtmgr)
> 
> (I use VC8 in windows)
> I tried, copying and pasting the dll and exe to another folder and run
> two instances at the same time.
> But it seemed to confuse the RTSystemEditor and both instance disappear
> from the RTSystem Editor list and also rtls.


If you run two separate instances of a component in standalone mode, as
you do when running the EXE from two folders, they will separate
managers and so have no knowledge of each other. This means that they
will clobber each other on the name server.

You can start two instances from a single manager using the manager's
API. Have a look in the documentation that came with OpenRTM. It should
be in the class hierarchy. The function you need is createComponent().
Pass in the implementation ID of the component you want to create, along
with any extra arguments specified in URL-style (e.g.
"ConsoleIn?config.default.blurgle=4&config.default.blorgle=2"). You can
call this twice in the module initialisation function of the manager
(the one that is specified in main()), or you can run the manager in
non-blocking mode and call it after calling runManager() - but remember
to block yourself or everything will shut down again as soon as main()
finishes.

Geoff



openrtm-users メーリングリストの案内