[openrtm-users 02414] Re: Deactivate RT-component from within a program

Ando Noriaki n-ando @ aist.go.jp
2012年 1月 31日 (火) 23:01:02 JST


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
>
> 2012/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
>
>
>
> _______________________________________________
> openrtm-users mailing list
> openrtm-users @ openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
>



-- 
安藤慶昭@独立行政法人産業技術総合研究所 知能システム研究部門
    統合知能研究グループ 主任研究員, 博士(工学)
    〒305-8568 つくば市梅園1-1-1 中央第2
    e-mail: n-ando @ aist.go.jp, web: http://staff.aist.go.jp/n-ando
    OpenRTM-aist: http://www.openrtm.org

Noriaki Ando, Ph.D.
    Senior Research Scientist, RT-Synthesis R.G., ISRI, AIST
    AIST Tsukuba Central 2, Tsukuba, Ibaraki 305-8568 JAPAN
    e-mail: n-ando @ aist.go.jp, web: http://staff.aist.go.jp/n-ando
    OpenRTM-aist: http://www.openrtm.org


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