Deactivate RT-component from within a program

9 個の投稿 / 0 new
最終投稿
hong
オフライン
Last seen: 12年 2ヶ月 前
登録日: 2012-01-30 18:19
Deactivate RT-component from within a program

Hi,

How can I deactivate RT-component from within the program? For example, from onExecute, or from other method. An illustrative case is that a user input toggled a bool variable, which is being checked in onExecute to decide if to deactivate (NOT exit) the component. Hope to get some help.

Thanks. Hong

英語
hong
オフライン
Last seen: 12年 2ヶ月 前
登録日: 2012-01-30 18:19
[openrtm-users 02409] Deactivate RT-component from within a prog

Hi, How can I deactivate RT-component from within the program? For example,
from onExecute, or from other method. An illustrative case is that a user
input toggled a bool variable, which is being checked in onExecute to decide
if to deactivate (NOT exit) the component. Hope to get some help. Thanks.
Hong

_______________________________________________
openrtm-users mailing list
openrtm-users@openrtm.org
http://www.openrtm.org/mailman/listinfo/openrtm-users

Hajime SAITO
オフライン
Last seen: 12年 4ヶ月 前
登録日: 2011-05-19 11:20
[openrtm-users 02410] Deactivate RT-component from within a pro

Hi,

Are you asking whether the component deactivates itself? Or do you
want to trigger this from outside the component?

You have a choice of using a service port for the trigger, or you can
use a property value that you check from within the onExecute
function.

Cheers,

Hajime

2012年1月31日17:38 :
> Hi, How can I deactivate RT-component from within the program? For example,
> from onExecute, or from other method. An illustrative case is that a user
> input toggled a bool variable, which is being checked in onExecute to decide
> if to deactivate (NOT exit) the component. Hope to get some help. Thanks.
> Hong
>
> _______________________________________________
> openrtm-users mailing list
> openrtm-users@openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
_______________________________________________
openrtm-users mailing list
openrtm-users@openrtm.org
http://www.openrtm.org/mailman/listinfo/openrtm-users

root
オフライン
Last seen: 6日 18時間 前
登録日: 2009-06-23 14:31
[openrtm-users 02411] Deactivate RT-component from within a pro

Hello,

This is an example code in C++.

ReturnCode_t RTObject_impl::onExecute(RTC::UniqueId ec_id)
{
: // you code
if (gotoInactiveState)
{
RTC::ExecutionContext_var ec = get_context(ec_id);
if (CORBA::is_nil(ec))
{
ec->deactivate_component(::RTC::RTObject::_duplicate(getObjRef()));
}
}
: // your code
return RTC::RTC_OK;
}

In the next execution tick, onDeactivated() will be called and
RTC will be in the INACTIVE state.

From OpenRTM-aist-1.1.0, getExecutionContext(), deactivate(),
activate() and reset() functions are introduced in DataflowComponentBase.

Best regards,
Noriaki ANDO

2012年1月31日17:38 :
> Hi, How can I deactivate RT-component from within the program? For example,
> from onExecute, or from other method. An illustrative case is that a user
> input toggled a bool variable, which is being checked in onExecute to decide
> if to deactivate (NOT exit) the component. Hope to get some help. Thanks.
> Hong
>
> _______________________________________________
> openrtm-users mailing list
> openrtm-users@openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
_______________________________________________
openrtm-users mailing list
openrtm-users@openrtm.org
http://www.openrtm.org/mailman/listinfo/openrtm-users

hong
オフライン
Last seen: 12年 2ヶ月 前
登録日: 2012-01-30 18:19
[openrtm-users 02412] Deactivate RT-component from within a pro

Thank you very much, Ando-san, Hajime-san.I had to invert the condition to !CORBA::is_nil(ec) to make it work.Hope I am not doing anything wrong.  I don't exactly get the meaning of CORBA::is_null(obj), however the document says it checks if the obj is nil.

RegardsHong2012/1/31 Ando Noriaki <n-ando@aist.go.jp>

Hello,

This is an example code in C++.

 ReturnCode_t RTObject_impl::onExecute(RTC::UniqueId ec_id)
 {
    : // you code
 if (gotoInactiveState)
   {
     RTC::ExecutionContext_var ec = get_context(ec_id);
     if (CORBA::is_nil(ec))
      {
         ec->deactivate_component(::RTC::RTObject::_duplicate(getObjRef()));
      }
   }
    : // your code
  return RTC::RTC_OK;
 }

 In the next execution tick, onDeactivated() will be called and
RTC will be in the INACTIVE state.

From OpenRTM-aist-1.1.0, getExecutionContext(), deactivate(),
activate() and reset() functions are introduced in DataflowComponentBase.

Best regards,
Noriaki ANDO

2012年1月31日17:38  <owh@ieee.org>:
> Hi, How can I deactivate RT-component from within the program? For example,
> from onExecute, or from other method. An illustrative case is that a user
> input toggled a bool variable, which is being checked in onExecute to decide
> if to deactivate (NOT exit) the component. Hope to get some help. Thanks.
> Hong
>
> _______________________________________________
> openrtm-users mailing list
> openrtm-users@openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
_______________________________________________
openrtm-users mailing list
openrtm-users@openrtm.org
http://www.openrtm.org/mailman/listinfo/openrtm-users

root
オフライン
Last seen: 6日 18時間 前
登録日: 2009-06-23 14:31
[openrtm-users 02414] Deactivate RT-component from within a pro

Hello

Oh! It's my mistake.

CORBA::is_nil(object) means the object's reference is invalid.
# It's almost same as null pointer in C/C++ or Java.

If CORBA::is_nil(object) == true, you cannot call any operations of the object.

2012年1月31日22:16 Ong Wee Hong :
> Thank you very much, Ando-san, Hajime-san.
>
> I had to invert the condition to !CORBA::is_nil(ec) to make it work.
> Hope I am not doing anything wrong. I don't exactly get the meaning of
> CORBA::is_null(obj), however the document says it checks if the obj is nil.
>
> Regards
> Hong
>
> 2012/1/31 Ando Noriaki
>>
>> Hello,
>>
>> This is an example code in C++.
>>
>> ReturnCode_t RTObject_impl::onExecute(RTC::UniqueId ec_id)
>> {
>> : // you code
>> if (gotoInactiveState)
>> {
>> RTC::ExecutionContext_var ec = get_context(ec_id);
>> if (CORBA::is_nil(ec))
>> {
>>
>> ec->deactivate_component(::RTC::RTObject::_duplicate(getObjRef()));
>> }
>> }
>> : // your code
>> return RTC::RTC_OK;
>> }
>>
>> In the next execution tick, onDeactivated() will be called and
>> RTC will be in the INACTIVE state.
>>
>> From OpenRTM-aist-1.1.0, getExecutionContext(), deactivate(),
>> activate() and reset() functions are introduced in DataflowComponentBase.
>>
>> Best regards,
>> Noriaki ANDO
>>
>> 2012年1月31日17:38 :
>> > Hi, How can I deactivate RT-component from within the program? For
>> > example,
>> > from onExecute, or from other method. An illustrative case is that a
>> > user
>> > input toggled a bool variable, which is being checked in onExecute to
>> > decide
>> > if to deactivate (NOT exit) the component. Hope to get some help.
>> > Thanks.
>> > Hong
>> >
>> > _______________________________________________
>> > openrtm-users mailing list
>> > openrtm-users@openrtm.org
>> > http://www.openrtm.org/mailman/listinfo/openrtm-users
>> _______________________________________________
>> openrtm-users mailing list
>> openrtm-users@openrtm.org
>> http://www.openrtm.org/mailman/listinfo/openrtm-users
>
>
>
> _______________________________________________
> openrtm-users mailing list
> openrtm-users@openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
>

hong
オフライン
Last seen: 12年 2ヶ月 前
登録日: 2012-01-30 18:19
[openrtm-users 02415] Deactivate RT-component from within a pro

Thanks a lot for the clarification!
Regards
Hong
在 2012-1-31 下午11:01,"Ando Noriaki" <n-ando@aist.go.jp>写道:
>
> Hello
>
> Oh! It's my mistake.
>
> CORBA::is_nil(object) means the object's reference is invalid.
> # It's almost same as null pointer in C/C++ or Java.
>
> If CORBA::is_nil(object) == true, you cannot call any operations of the object.
>
>
> 2012年1月31日22:16 Ong Wee Hong <owh@ieee.org>:
> > Thank you very much, Ando-san, Hajime-san.
> >
> > I had to invert the condition to !CORBA::is_nil(ec) to make it work.
> > Hope I am not doing anything wrong.  I don't exactly get the meaning of
> > CORBA::is_null(obj), however the document says it checks if the obj is nil.
> >
> > Regards
> > Hong

hong
オフライン
Last seen: 12年 2ヶ月 前
登録日: 2012-01-30 18:19
Deactivate RT-component from

Thank you very much, Ando-san, Hajime-san.

I had to invert the condition to !CORBA::is_nil(ec) to make it work. Hope I am not doing anything wrong. I don't exactly get the meaning of CORBA::is_null(obj), however the document says it checks if the obj is nil.

Regards Hong PS. Apology for the mess of the posts, still getting accustomed to the forum. I hope this one goes to the right place.

hong
オフライン
Last seen: 12年 2ヶ月 前
登録日: 2012-01-30 18:19
[openrtm-users 02413] Deactivate RT-component from

Thank you very much, Ando-san, Hajime-san. I had to invert the condition to
!CORBA::is_nil(ec) to make it work. Hope I am not doing anything wrong. I
don't exactly get the meaning of CORBA::is_null(obj), however the document
says it checks if the obj is nil. Regards Hong PS. Apology for the mess of
the posts, still getting accustomed to the forum. I hope this one goes to the
right place.

_______________________________________________
openrtm-users mailing list
openrtm-users@openrtm.org
http://www.openrtm.org/mailman/listinfo/openrtm-users

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

ダウンロード

最新バージョン : 2.0.1-RELESE

統計

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

Choreonoid

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

OpenHRP3

動力学シミュレータ

OpenRTP

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

産総研RTC集

産総研が提供するRTC集

TORK

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

DAQ-Middleware

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