[openrtm-users 01597] knowing the LifeCycleState of service provider

2 posts / 0 new
Last post
root
Offline
Last seen: 2 days 2 hours ago
Joined: 2009-06-23 14:31
[openrtm-users 01597] knowing the LifeCycleState of service provider

Dear Sirs,

I'd like to know how to get the lifecycle state of a service provider
component from one of its consumer.

I've got the following issue : One of my component, during his
onExecuted function, calls a service from another component. During the
activation of the complete set of components, if this component is
activated before the service provider, the service call will fail,
setting the component in a error state. I'd like to avoid any order in
the component's activation, thus I'd like to check 1-if a service
provider is connected (done using getObject) and 2-then also check if it
has been activated (LifeCycleState == ACTIVE).

Could you explain me how to handle this issue ?

Thank you very much,
Best regards,

Matthieu

Undefined
root
Offline
Last seen: 2 days 2 hours ago
Joined: 2009-06-23 14:31
[openrtm-users 01607] knowing the LifeCycleState of service pro

Dear Matthieu-san

> Dear Sirs,
>
> I'd like to know how to get the lifecycle state of a service provider
> component from one of its consumer.
>
> I've got the following issue : One of my component, during his onExecuted
> function, calls a service from another component. During the activation of
> the complete set of components, if this component is activated before the
> service provider, the service call will fail, setting the component in a
> error state. I'd like to avoid any order in the component's activation, thus
> I'd like to check 1-if a service provider is connected (done using
> getObject) and 2-then also check if it has been activated (LifeCycleState ==
> ACTIVE).
>
> Could you explain me how to handle this issue ?

Currently we are not providing easy way to get status of other end of
RTC on the port.
But if you already have the RTC 's reference on the port
you might get the status in the following code.

const char* stateName[] = {
"CREATED_STATE", "INACTIVE_STATE", "ACTIVE_STATE", "ERROR_STATE" };
RTC::ExecutionContextList_var ec = rtc->get_owned_contexts();
for (CORBA::ULong i(0); i < ec.length(); ++i)
{
LifeCycleState state = ec[i]->get_component_state(rtc);
std::cout << "State on EC" << i << " is " << stateName[state] << std::endl;
}

See the following IDL reference
http://www.openrtm.org/OpenRTM-aist/documents/IDLReference-en/namespaces.html

I would like to discuss to provide such kind of operation in the next
version of OpenRTM.
e.g. PortBase::getConnectedRtcs(), getConnectedRtcsState(), etc...

But the easiest way would be just calling the service and catching
the exception. If you want to avoid the side effect of operation call,
you can call CORBA::Object::_non_existent() operation.
But this method cannot distinguish whether the other RTC is
dead and whether it is just inactive state.

Best regards,
Noriaki Ando

>
>
> Thank you very much,
> Best regards,
>
> Matthieu
>
>
>

Log in or register to post comments

Download

latest Releases : 2.0.0-RELESE

2.0.0-RELESE Download page

Number of Projects

Choreonoid

Motion editor/Dynamics simulator

OpenHRP3

Dynamics simulator

OpenRTP

Integrated Development Platform

AIST RTC collection

RT-Components collection by AIST

TORK

Tokyo Opensource Robotics Association

DAQ-Middleware

Middleware for DAQ (Data Aquisition) by KEK