[openrtm-users 01153] Clean-up of OpenRTM application

Steffen Wittmeier steffen.wittmeier @ in.tum.de
2010年 3月 9日 (火) 02:04:32 JST


Hi,

I am building a robot simulator application based on OpenRTM components 
(so that the simulator can smoothly be integrated with the real robot 
which also uses RTCs).

The simulator GUI is using Qt and the main window as well as the 
individual widgets are derived from QMainWindow and QWidget, 
respectively, as well as from RTC::DataFlowComponentBase. Hence, every 
widget is a RTC and a GUI widget at the same time.

This approach works quite well and I can even delete individual 
widgets/RTC at run-time by catching the widget close event and calling 
exit() on the component.

However, I am having troubles with cleaning-up the application on 
closing. I am always getting the following error:

terminate called after throwing an instance of 'omni_thread_fatal'
Aborted

What would be the right way of destructing the RTCs? I already updated 
to OpenRTM 1.0 as the destructors were not called when I used OpenRTM 0.42.

Any help is appreciated...


Here's a snapshot of the code that I am using:
int
main(int argc, char** argv)
{
   RTC::Manager* manager;
   manager = RTC::Manager::init(argc, argv);

   // Initialize manager
   manager->init(argc, argv);

   // Set module initialization procedure
   // that's where I create the basic components of the GUI
   // (MainWindow, Model, Controller, LogManager)
   manager->setModuleInitProc(createComponents);

   // Activate manager and register to naming service
   manager->activateManager();

   // run the manager in non-blocking mode
   manager->runManager(true);

   // Qt main loop
   application.exec();

  // when the main loop exits, clean up components
  // compMainWindow, compEcceosController, etc. are handles
  // to the component, they are of type RTC::RtcBase*
   if (compMainWindow != 0)
   {
     std::cout << "Exiting main window" << std::endl;
     compMainWindow->exit();
   }

   if (compEcceosController != 0)
   {
     std::cout << "Exiting controller" << std::endl;
     compEcceosController->exit();
   }

   if (compEcceosModel != 0)
   {
     std::cout << "Exiting model" << std::endl;
     compEcceosModel->exit();
   }

   if (compLogManager != 0)
   {
     std::cout << "Exiting log manager" << std::endl;
     //compLogManager->exit();
   }

   manager->terminate();

   return 0;
}



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