[openrtm-users 02411] Re: Deactivate RT-component from within a program
Ando Noriaki
n-ando @ aist.go.jp
2012年 1月 31日 (火) 18:02:27 JST
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 メーリングリストの案内