[openrtm-beginners:00427] Re: (無題)

Ando Noriaki n-ando @ aist.go.jp
2013年 4月 17日 (水) 11:01:40 JST


Hi,

> Oh, I didn't know that! When I tried I think I just assumed it didn't work,
> because I didn't see the port appearing in system editor. But that's a great

Please reload (= delete from editor and DnD RTC from nameservice view
again :-)your RTCs on the system editor. You can see new Data Port on it.

>From OpenRTM-aist-1.1, I've experimentally added ComponentObserverConsumer
to OpenRTM in order to notify component's event to RTSystemEditor. If you
compile and load it to your RTC process, port-add event would be notified
to RTSystemEditor, and its system editor view will be updated automatically.

http://svn.openrtm.org/OpenRTM-aist/tags/RELEASE_1_1_0/OpenRTM-aist/src/ext/sdo/observer/

> news. Thanks. Now if I leave out the call for manager->setModuleInitProc()
> completely, and refactor the code as below, it works. It is also safe to do
> this way, right?
>
> coil::Properties profile(comp_spec);
> RTC::Manager* manager;
> RTC::RtcBase* comp; manager = RTC::Manager::init(argc, argv);
> manager->init(argc, argv);
> manager->registerFactory(profile, RTC::Create, RTC::Delete);
> manager->activateManager(); comp = manager->createComponent("MyComp");
> if (comp == NULL) { std::cerr << "Component create failed." << std::endl; abort(); }
> manager->runManager(!block);
>
> Now I'm also curious about: Is manager
> thread-safe? If I want to run multiple component from the same process, can
> I run multiple managers?

Manager is singleton object, and its instance that are obtained by
Manager::instance()
function is always same.

Of course you can create multiple RTCs in one manager (=process).

RTC::Manager* manager;
manager = RTC::Manager::init(argc, argv);
manager->activateManager();

manager->load("MyComponentA.so", "MyComponentAInit");
manager->load("MyComponentB.so", "MyComponentBInit");
manager->load("MyComponentC.so", "MyComponentCInit");
manager->runManager(!block); // block = false

comp = manager->createComponent("MyComponentA");
if (comp == NULL) { std::cerr << "Component create failed." <<
std::endl; abort(); }
comp = manager->createComponent("MyComponentB");
if (comp == NULL) { std::cerr << "Component create failed." <<
std::endl; abort(); }
comp = manager->createComponent("MyComponentC");
if (comp == NULL) { std::cerr << "Component create failed." <<
std::endl; abort(); }

while (1) {
  // do my task
  sleep(1);
}

manager->shutdown();
return 0;


This code load MyComponent[A-C].so shared objects, and
create three component from them.

If you just only create multiple component in one proces, you can use
manager.modules.preload:
manager.components.precreate:
options to load and instantiate RTCs.

http://svn.openrtm.org/OpenRTM-aist/tags/RELEASE_1_1_0/OpenRTM-aist/etc/rtc.conf.sample

> I noticed a section called "RTC daemon" in the
> tutorial, and that sounds like it would do exactly this, but it seems the
> page hasn't been written yet. Thanks, Gabor

I'm sorry. That page is still under construction. I'll write it as
soon as possible.


Best regards,
Noriaki Ando


More information about the openrtm-beginners mailing list