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

6 個の投稿 / 0 new
最終投稿
root
オフライン
Last seen: 4日 1時間 前
登録日: 2009-06-23 14:31
[openrtm-users 01153] Clean-up of OpenRTM application

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;
}

未定義
root
オフライン
Last seen: 4日 1時間 前
登録日: 2009-06-23 14:31
[openrtm-users 01154] Clean-up of OpenRTM application

Hello,

Please try to apply the patch attached to the mailing list "[openrtm-users 01149]".
or
Please check out the source of the latest version from the following repositories.

http://openrtp.jp/openrtm/svn/OpenRTM-aist/branches/RELENG_1_0/OpenRTM-aist

Regards,
Shinji Kurihara

On Mon, 08 Mar 2010 18:04:32 +0100
Steffen Wittmeier wrote:

> 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;
> }
>

root
オフライン
Last seen: 4日 1時間 前
登録日: 2009-06-23 14:31
[openrtm-users 01157] Clean-up of OpenRTM application

Hello,

this patch fixed a segmentation fault that I had when shutting down the
application. It did not, however, help with the omniorb error message. I
already figured out that the "omni_thread_fatal" message only appears
when the manager is run in non-blocking mode.

Do I need to do anything else on clean-up? I found this on the web:
http://www.omniorb-support.com/pipermail/omniorb-list/2005-June/026811.html

Thanks,
Steffen Wittmeier

On 03/10/2010 06:14 AM, kurihara shinji wrote:
> Hello,
>
> Please try to apply the patch attached to the mailing list "[openrtm-users 01149]".
> or
> Please check out the source of the latest version from the following repositories.
>
> http://openrtp.jp/openrtm/svn/OpenRTM-aist/branches/RELENG_1_0/OpenRTM-aist
>
>
> Regards,
> Shinji Kurihara
>
> On Mon, 08 Mar 2010 18:04:32 +0100
> Steffen Wittmeier wrote:
>
>> 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;
>> }
>>
>
>

root
オフライン
Last seen: 4日 1時間 前
登録日: 2009-06-23 14:31
[openrtm-users 01158] Clean-up of OpenRTM application - SOLVED

Hello,

I found the bug. It was in one of our components.

Thanks for the support.

Regards,
Steffen Wittmeier

On 03/11/2010 06:42 PM, Steffen Wittmeier wrote:
> Hello,
>
> this patch fixed a segmentation fault that I had when shutting down the
> application. It did not, however, help with the omniorb error message. I
> already figured out that the "omni_thread_fatal" message only appears
> when the manager is run in non-blocking mode.
>
> Do I need to do anything else on clean-up? I found this on the web:
> http://www.omniorb-support.com/pipermail/omniorb-list/2005-June/026811.html
>
> Thanks,
> Steffen Wittmeier
>
> On 03/10/2010 06:14 AM, kurihara shinji wrote:
>> Hello,
>>
>> Please try to apply the patch attached to the mailing list
>> "[openrtm-users 01149]".
>> or
>> Please check out the source of the latest version from the following
>> repositories.
>>
>> http://openrtp.jp/openrtm/svn/OpenRTM-aist/branches/RELENG_1_0/OpenRTM-aist
>>
>>
>>
>> Regards,
>> Shinji Kurihara
>>
>> On Mon, 08 Mar 2010 18:04:32 +0100
>> Steffen Wittmeier wrote:
>>
>>> 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;
>>> }
>>>
>>
>>
>

root
オフライン
Last seen: 4日 1時間 前
登録日: 2009-06-23 14:31
[openrtm-users 01182] Clean-up of OpenRTM application

Hi,

The proposed solution works fine for the cleanup of all our components now.
I still have a problem with the cleanup of the RTC::Manager, though. It
seems that a bunch of threads are started when the runManager method is
called but they are not terminated properly when the Manager is
terminated. I still have two threads running after calling
manager->terminate(), with the following backtrace:

#0 0x0012d422 in __kernel_vsyscall ()
#1 0x00a3b142 in pthread_cond_timedwait@@GLIBC_2.3.2 () from
/lib/tls/i686/cmov/libpthread.so.0
#2 0x009c58d4 in pthread_cond_timedwait () from
/lib/tls/i686/cmov/libc.so.6
#3 0x00bd3e48 in omni_condition::timedwait(unsigned long, unsigned
long) () from /usr/lib/libomnithread.so.3
#4 0x00b35f79 in omni::Scavenger::execute (this=0x808aff8) at
../../../../../src/lib/omniORB/orbcore/giopStrand.cc:719
#5 0x00ae5ca2 in omniAsyncWorker::real_run (this=0x808f0c8) at
../../../../../src/lib/omniORB/orbcore/invoker.cc:232
#6 0x00ae565b in omniAsyncWorkerInfo::run (this=0xb6fd7314) at
../../../../../src/lib/omniORB/orbcore/invoker.cc:280
#7 0x00ae5f5a in omniAsyncWorker::run (this=0x808f0c8) at
../../../../../src/lib/omniORB/orbcore/invoker.cc:159
#8 0x00bd39c7 in omni_thread_wrapper () from /usr/lib/libomnithread.so.3
#9 0x00a3680e in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#10 0x009b88de in clone () from /lib/tls/i686/cmov/libc.so.6

The method manager->join() is supposed to wait for the removal fo all
threads and surely enough it does. One more thread gets closed but it
stays in the join method indefinitely as the last missing worker thread
is not exited. Am I missing something?

I am trying to restart the manager again after everything is closed in
the same application. Is that possible at all? At the moment it gives me
an error when I do that but I figure that it is due to the unclean state
after manager->terminate().

thanks a lot
Michael Jäntsch

Am 11.03.2010 18:42, schrieb Steffen Wittmeier:
> Hello,
>
> this patch fixed a segmentation fault that I had when shutting down
> the application. It did not, however, help with the omniorb error
> message. I already figured out that the "omni_thread_fatal" message
> only appears when the manager is run in non-blocking mode.
>
> Do I need to do anything else on clean-up? I found this on the web:
> http://www.omniorb-support.com/pipermail/omniorb-list/2005-June/026811.html
>
>
> Thanks,
> Steffen Wittmeier
>
> On 03/10/2010 06:14 AM, kurihara shinji wrote:
>> Hello,
>>
>> Please try to apply the patch attached to the mailing list
>> "[openrtm-users 01149]".
>> or
>> Please check out the source of the latest version from the following
>> repositories.
>>
>>
>> http://openrtp.jp/openrtm/svn/OpenRTM-aist/branches/RELENG_1_0/OpenRTM-aist
>>
>>
>>
>> Regards,
>> Shinji Kurihara
>>
>> On Mon, 08 Mar 2010 18:04:32 +0100
>> Steffen Wittmeier wrote:
>>
>>> 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;
>>> }
>>>
>>
>>
>

root
オフライン
Last seen: 4日 1時間 前
登録日: 2009-06-23 14:31
[openrtm-users 01161] Clean-up of OpenRTM application

Hello,

I am going to resend it now because I forgot to attach the patch file. (Manager.cpp.diff)

Regards,
Shinji Kurihara

On Wed, 10 Mar 2010 14:14:21 +0900
kurihara shinji wrote:

> Hello,
>
> Please try to apply the patch attached to the mailing list "[openrtm-users 01149]".
> or
> Please check out the source of the latest version from the following repositories.
>
> http://openrtp.jp/openrtm/svn/OpenRTM-aist/branches/RELENG_1_0/OpenRTM-aist
>
>
> Regards,
> Shinji Kurihara
>
> On Mon, 08 Mar 2010 18:04:32 +0100
> Steffen Wittmeier wrote:
>
> > 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;
> > }
> >
>
>

コメントを投稿するにはログインまたはユーザー登録を行ってください

ダウンロード

最新バージョン : 2.0.1-RELESE

統計

Webサイト統計
ユーザ数:2209
プロジェクト統計
RTコンポーネント307
RTミドルウエア35
ツール22
文書・仕様書2

Choreonoid

モーションエディタ/シミュレータ

OpenHRP3

動力学シミュレータ

OpenRTP

統合開発プラットフォーム

産総研RTC集

産総研が提供するRTC集

TORK

東京オープンソースロボティクス協会

DAQ-Middleware

ネットワーク分散環境でデータ収集用ソフトウェアを容易に構築するためのソフトウェア・フレームワーク