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

Ong Wee Hong owh @ ieee.org
2012年 1月 31日 (火) 22:16:48 JST


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 at 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 at 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 at openrtm.org
> > http://www.openrtm.org/mailman/listinfo/openrtm-users
> _______________________________________________
> openrtm-users mailing list
> openrtm-users at openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.openrtm.org/pipermail/openrtm-users/attachments/20120131/3097d3b2/attachment-0001.html>


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