OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
RTC::OpenHRPExecutionContext Class Reference

OpenHRPExecutionContext class. More...

#include <OpenHRPExecutionContext.h>

Inheritance diagram for RTC::OpenHRPExecutionContext:
Collaboration diagram for RTC::OpenHRPExecutionContext:

Public Member Functions

 OpenHRPExecutionContext ()
 Constructor .
 
 ~OpenHRPExecutionContext () override
 Destructor .
 
void tick () override
 Move forward one step of ExecutionContext.
 
CORBA::Boolean is_running () override
 Check for ExecutionContext running state.
 
RTC::ReturnCode_t start () override
 Start the ExecutionContext.
 
RTC::ReturnCode_t stop () override
 Stop the ExecutionContext.
 
CORBA::Double get_rate () override
 Get execution rate(Hz) of ExecutionContext.
 
RTC::ReturnCode_t set_rate (CORBA::Double rate) override
 Set execution rate(Hz) of ExecutionContext.
 
RTC::ReturnCode_t activate_component (RTC::LightweightRTObject_ptr comp) override
 Activate an RT-component.
 
RTC::ReturnCode_t deactivate_component (RTC::LightweightRTObject_ptr comp) override
 Deactivate an RT-component.
 
RTC::ReturnCode_t reset_component (RTC::LightweightRTObject_ptr comp) override
 Reset the RT-component.
 
RTC::LifeCycleState get_component_state (RTC::LightweightRTObject_ptr comp) override
 Get RT-component's state.
 
RTC::ExecutionKind get_kind () override
 Get the ExecutionKind.
 
RTC::ReturnCode_t add_component (RTC::LightweightRTObject_ptr comp) override
 Add an RT-component.
 
RTC::ReturnCode_t remove_component (RTC::LightweightRTObject_ptr comp) override
 Remove the RT-Component from participant list.
 
RTC::ExecutionContextProfile * get_profile () override
 Get the ExecutionContextProfile.
 
- Public Member Functions inherited from RTC::ExecutionContextBase
 ExecutionContextBase (const char *name)
 Constructor.
 
virtual ~ExecutionContextBase ()
 Virtual Destructor.
 
virtual void init (coil::Properties &props)
 Initialize the ExecutionContext.
 
virtual RTC::ReturnCode_t bindComponent (RTC::RTObject_impl *rtc)
 Bind the component.
 
CORBA::Boolean isRunning ()
 Check for ExecutionContext running state.
 
RTC::ReturnCode_t start ()
 Start the ExecutionContext.
 
double getRate () const
 Get execution rate(Hz) of ExecutionContext.
 
std::chrono::nanoseconds getPeriod () const
 
RTC::ReturnCode_t setRate (double rate)
 Set execution rate(Hz) of ExecutionContext.
 
RTC::ReturnCode_t addComponent (RTC::LightweightRTObject_ptr comp)
 Add an RT-component.
 
RTC::ReturnCode_t removeComponent (RTC::LightweightRTObject_ptr comp)
 Remove the RT-Component from participant list.
 
RTC::ReturnCode_t activateComponent (RTC::LightweightRTObject_ptr comp)
 Activate an RT-component.
 
RTC::ReturnCode_t deactivateComponent (RTC::LightweightRTObject_ptr comp)
 Deactivate an RT-component.
 
RTC::ReturnCode_t resetComponent (RTC::LightweightRTObject_ptr comp)
 Reset the RT-component.
 
RTC::LifeCycleState getComponentState (RTC::LightweightRTObject_ptr comp)
 Get RT-component's state.
 
RTC::ExecutionKind getKind () const
 Get the ExecutionKind.
 
RTC::ExecutionContextProfile * getProfile ()
 Getting Profile.
 
void setObjRef (RTC::ExecutionContextService_ptr ec_ptr)
 Get the reference to the CORBA object.
 
RTC::ExecutionContextService_ptr getObjRef () const
 
RTC::ReturnCode_t setKind (RTC::ExecutionKind kind)
 Set the ExecutionKind.
 
RTC::ReturnCode_t setOwner (RTC::LightweightRTObject_ptr comp)
 Setting owner component of the execution context.
 
RTC::RTObject_ptr getOwner () const
 Getting a reference of the owner component.
 
const RTC::RTCList & getComponentList () const
 Getting participant RTC list.
 
void setProperties (coil::Properties &props)
 Setting Properties.
 
coil::Properties getProperties () const
 Setting Properties.
 
const RTC::ExecutionContextProfile & getProfile () const
 Getting Profile.
 
bool isAllCurrentState (RTC::LifeCycleState state)
 
bool isAllNextState (RTC::LifeCycleState state)
 
bool isOneOfCurrentState (RTC::LifeCycleState state)
 
bool isOneOfNextState (RTC::LifeCycleState state)
 
void invokeWorker ()
 
void invokeWorkerPreDo ()
 
void invokeWorkerDo ()
 
void invokeWorkerPostDo ()
 

Protected Member Functions

RTC::ReturnCode_t onAddedComponent (RTC::LightweightRTObject_ptr rtobj) override
 onAddedComponent() template function
 
RTC::ReturnCode_t onRemovedComponent (RTC::LightweightRTObject_ptr rtobj) override
 onRemovedComponent() template function
 
- Protected Member Functions inherited from RTC::ExecutionContextBase
virtual bool onIsRunning (bool running)
 
virtual RTC::ReturnCode_t onStarting ()
 
virtual RTC::ReturnCode_t onStarted ()
 
virtual RTC::ReturnCode_t onStopping ()
 
virtual RTC::ReturnCode_t onStopped ()
 
virtual double onGetRate (double rate) const
 
virtual double onSettingRate (double rate)
 
virtual RTC::ReturnCode_t onSetRate (double)
 
virtual RTC::ReturnCode_t onAddingComponent (RTC::LightweightRTObject_ptr)
 
virtual RTC::ReturnCode_t onRemovingComponent (RTC::LightweightRTObject_ptr)
 
virtual RTC::ReturnCode_t onActivating (RTC::LightweightRTObject_ptr)
 
virtual RTC::ReturnCode_t onWaitingActivated (RTC_impl::RTObjectStateMachine *, long int)
 
virtual RTC::ReturnCode_t onActivated (RTC_impl::RTObjectStateMachine *, long int)
 
virtual RTC::ReturnCode_t onDeactivating (RTC::LightweightRTObject_ptr)
 
virtual RTC::ReturnCode_t onWaitingDeactivated (RTC_impl::RTObjectStateMachine *, long int)
 
virtual RTC::ReturnCode_t onDeactivated (RTC_impl::RTObjectStateMachine *, long int)
 
virtual RTC::ReturnCode_t onResetting (RTC::LightweightRTObject_ptr)
 
virtual RTC::ReturnCode_t onWaitingReset (RTC_impl::RTObjectStateMachine *, long int)
 
virtual RTC::ReturnCode_t onReset (RTC_impl::RTObjectStateMachine *, long int)
 
virtual RTC::LifeCycleState onGetComponentState (RTC::LifeCycleState state)
 
virtual RTC::ExecutionKind onGetKind (RTC::ExecutionKind kind) const
 
virtual RTC::ExecutionContextProfile * onGetProfile (RTC::ExecutionContextProfile *&profile)
 

Protected Attributes

std::mutex m_tickmutex
 Mutex to guard tick() reenter.
 
- Protected Attributes inherited from RTC::ExecutionContextBase
RTC::Logger rtclog
 
RTC_impl::ExecutionContextWorker m_worker
 
RTC_impl::ExecutionContextProfile m_profile
 
std::chrono::nanoseconds m_activationTimeout
 
std::chrono::nanoseconds m_deactivationTimeout
 
std::chrono::nanoseconds m_resetTimeout
 
bool m_syncActivation
 
bool m_syncDeactivation
 
bool m_syncReset
 

Additional Inherited Members

- Static Public Member Functions inherited from RTC::ExecutionContextBase
static const char * getStateString (RTC::LifeCycleState state)
 
static const char * getKindString (RTC::ExecutionKind kind)
 Converting ExecutionKind enum to string.
 

Detailed Description

OpenHRPExecutionContext class.

This is ExecutionContext for OpenHRP3. This EC can execute only one cycle by tick() call from external framework.

Constructor & Destructor Documentation

◆ OpenHRPExecutionContext()

RTC::OpenHRPExecutionContext::OpenHRPExecutionContext ( )

Constructor .

◆ ~OpenHRPExecutionContext()

RTC::OpenHRPExecutionContext::~OpenHRPExecutionContext ( )
override

Destructor .

Member Function Documentation

◆ activate_component()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::activate_component ( RTC::LightweightRTObject_ptr comp)
override

Activate an RT-component.

The given participant RTC is Inactive and is therefore not being invoked according to the execution context’s execution kind. This operation shall cause the RTC to transition to the Active state such that it may subsequently be invoked in this execution context. The callback on_activate shall be called as a result of calling this operation. This operation shall not return until the callback has returned, and shall result in an error if the callback does.

Parameters
compThe target RT-Component for activation
Returns
The return code of ReturnCode_t type

◆ add_component()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::add_component ( RTC::LightweightRTObject_ptr comp)
override

Add an RT-component.

The operation causes the given RTC to begin participating in the execution context. The newly added RTC will receive a call to LightweightRTComponent::attach_context and then enter the Inactive state. BAD_PARAMETER will be invoked, if the given RT-Component is null or if the given RT-Component is other than DataFlowComponent.

Parameters
compThe target RT-Component for add
Returns
The return code of ReturnCode_t type

◆ deactivate_component()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::deactivate_component ( RTC::LightweightRTObject_ptr comp)
override

Deactivate an RT-component.

The given RTC is Active in the execution context. Cause it to transition to the Inactive state such that it will not be subsequently invoked from the context unless and until it is activated again. The callback on_deactivate shall be called as a result of calling this operation. This operation shall not return until the callback has returned, and shall result in an error if the callback does.

Parameters
compThe target RT-Component for deactivate
Returns
The return code of ReturnCode_t type

◆ get_component_state()

RTC::LifeCycleState RTC::OpenHRPExecutionContext::get_component_state ( RTC::LightweightRTObject_ptr comp)
override

Get RT-component's state.

This operation shall report the LifeCycleState of the given participant RTC. UNKNOWN_STATE will be returned, if the given RT-Component is not inclued in the participant list.

Parameters
compThe target RT-Component to get the state
Returns
The current state of the target RT-Component(LifeCycleState)

◆ get_kind()

RTC::ExecutionKind RTC::OpenHRPExecutionContext::get_kind ( )
override

Get the ExecutionKind.

This operation shall report the execution kind of the execution context.

Returns
ExecutionKind

◆ get_profile()

RTC::ExecutionContextProfile * RTC::OpenHRPExecutionContext::get_profile ( )
override

Get the ExecutionContextProfile.

This operation provides a profile “descriptor” for the execution context.

Returns
ExecutionContextProfile

◆ get_rate()

CORBA::Double RTC::OpenHRPExecutionContext::get_rate ( )
override

Get execution rate(Hz) of ExecutionContext.

This operation shall return the rate (in hertz) at which its Active participating RTCs are being invoked.

Returns
Execution cycle(Unit:Hz)

◆ is_running()

CORBA::Boolean RTC::OpenHRPExecutionContext::is_running ( )
override

Check for ExecutionContext running state.

This operation shall return true if the context is in the Running state. While the context is Running, all Active RTCs participating in the context shall be executed according to the context’s execution kind.

Returns
Check state function (Running:true、Stopping:false)

◆ onAddedComponent()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::onAddedComponent ( RTC::LightweightRTObject_ptr rtobj)
overrideprotectedvirtual

onAddedComponent() template function

Reimplemented from RTC::ExecutionContextBase.

◆ onRemovedComponent()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::onRemovedComponent ( RTC::LightweightRTObject_ptr rtobj)
overrideprotectedvirtual

onRemovedComponent() template function

Reimplemented from RTC::ExecutionContextBase.

◆ remove_component()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::remove_component ( RTC::LightweightRTObject_ptr comp)
override

Remove the RT-Component from participant list.

This operation causes a participant RTC to stop participating in the execution context. The removed RTC will receive a call to LightweightRTComponent::detach_context. BAD_PARAMETER will be returned, if the given RT-Component is not participating in the participant list.

Parameters
compThe target RT-Component for delete
Returns
The return code of ReturnCode_t type

◆ reset_component()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::reset_component ( RTC::LightweightRTObject_ptr comp)
override

Reset the RT-component.

Attempt to recover the RTC when it is in Error. The ComponentAction::on_reset callback shall be invoked. This operation shall not return until the callback has returned, and shall result in an error if the callback does. If possible, the RTC developer should implement that callback such that the RTC may be returned to a valid state.

Parameters
compThe target RT-Component for reset
Returns
The return code of ReturnCode_t type

◆ set_rate()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::set_rate ( CORBA::Double rate)
override

Set execution rate(Hz) of ExecutionContext.

This operation shall set the rate (in hertz) at which this context’s Active participating RTCs are being called. If the execution kind of the context is PERIODIC, a rate change shall result in the invocation of on_rate_changed on any RTCs realizing DataFlowComponentAction that are registered with any RTCs participating in the context.

Parameters
rateExecution cycle(Unit:Hz)
Returns
The return code of ReturnCode_t type

◆ start()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::start ( )
override

Start the ExecutionContext.

Request that the context enter the Running state. Once the state transition occurs, the ComponentAction::on_startup operation will be invoked. An execution context may not be started until the RT-Components that participate in it have been initialized. An execution context may be started and stopped multiple times.

Returns
The return code of ReturnCode_t type

◆ stop()

RTC::ReturnCode_t RTC::OpenHRPExecutionContext::stop ( )
overridevirtual

Stop the ExecutionContext.

Request that the context enter the Stopped state. Once the transition occurs, the ComponentAction::on_shutdown operation will be invoked. An execution context must be stopped before the RT components that participate in it are finalized. An execution context may be started and stopped multiple times.

Returns
The return code of ReturnCode_t type

Reimplemented from RTC::ExecutionContextBase.

◆ tick()

void RTC::OpenHRPExecutionContext::tick ( )
override

Move forward one step of ExecutionContext.

Move forward one step of the ExecutionContext processing.

Member Data Documentation

◆ m_tickmutex

std::mutex RTC::OpenHRPExecutionContext::m_tickmutex
protected

Mutex to guard tick() reenter.


The documentation for this class was generated from the following file: