[openrtm-commit:02626] r836 - in branches/FSM4RTC/OpenRTM-aist-Python: . OpenRTM_aist OpenRTM_aist/RTM_IDL OpenRTM_aist/examples OpenRTM_aist/examples/SimpleIO OpenRTM_aist/examples/StaticFsm OpenRTM_aist/ext/sdo OpenRTM_aist/ext/sdo/extended_fsm OpenRTM_aist/ext/sdo/fsm4rtc_observer OpenRTM_aist/python3_examples OpenRTM_aist/python3_examples/SimpleIO OpenRTM_aist/python3_examples/StaticFsm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 6月 12日 (月) 13:45:32 JST
Author: miyamoto
Date: 2017-06-12 13:45:32 +0900 (Mon, 12 Jun 2017)
New Revision: 836
Added:
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventDrivenExecutionContext.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventPort.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponent.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponentBase.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmActionListener.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmObject.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSConsumer.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Macho.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSConsumer.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort_OpenRTM.idl
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/ExtendedFsmService.idl
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectBase.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StaticFSM.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Timestamp.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Display.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Inputbutton.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Microwave.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/MicrowaveFsm.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/display.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/inputbutton.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/microwave.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/rtc.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/ExtendedFsmServiceProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/rtc.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/COCTestRTC.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserver.idl
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/rtc.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.bat
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.sh
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Display.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Inputbutton.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Microwave.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/MicrowaveFsm.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/display.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/inputbutton.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/microwave.conf
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/rtc.conf
Modified:
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ConnectorListener.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/DataFlowComponentBase.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FactoryInit.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPort.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrConsumer.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPort.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortPushConnector.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherFlush.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort.idl
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/OpenRTM.idl
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectStateMachine.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleIn.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleIn.py
branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleOut.py
branches/FSM4RTC/OpenRTM-aist-Python/setup.py
Log:
[incompat,2.0,FSM4RTC] add Files
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ConnectorListener.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ConnectorListener.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ConnectorListener.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -19,8 +19,46 @@
from omniORB import any
import OpenRTM_aist
+import OpenRTM_aist.Guard
+import threading
+##
+# @if jp
+# @class ConnectorListenerStatus mixin class
+# @brief ConnectorListenerStatus mixin ¥¯¥é¥¹
+#
+# ¤³¤Î¥¯¥é¥¹¤Ï¡¢enumÄêµÁ¤µ¤ì¤¿¥ê¥¿¡¼¥ó¥³¡¼¥É¤ò¡¢ConnectorListener´Ø
+# Ï¢¤Î¥µ¥Ö¥¯¥é¥¹¤Ç¶¦ÄÌÍøÍѤ¹¤ë¤¿¤á¤Î mixin ¥¯¥é¥¹¤Ç¤¢¤ë¡£¤³¤Î¥ê¥¿¡¼
+# ¥ó¥³¡¼¥É¤ò»ÈÍѤ¹¤ë¥¯¥é¥¹¤Ç¤Ï¡¢ConnectorListenerStatus ¥¯¥é¥¹¤ò
+# public ·Ñ¾µ¤·¡¢²¼¤Ëdefine ¤·¤Æ¤¢¤ë CONNLISTENER_STATUS_ENUM ¤ò¥¯¥é
+# ¥¹Æâ¤Ëµ½Ò¤¹¤ë¤³¤È¤ÇÍøÍѲÄǽ¤È¤Ê¤ë¡£¤³¤ì¤Ë¤è¤ê¡¢enum ¤ò
+# ReturnCode ·¿¤È¤·¤Æ typedef ¤·¡¢°Ê¸å ReturnCode ¤òÍøÍѤǤ¤ë¤è¤¦¤Ë
+# ¤¹¤ë¤È¤È¤â¤Ë¡¢Ì¾Á°¶õ´Ö¤Ë enum ÄêµÁ¤µ¤ì¤¿³Æ¼±Ê̻ҤòÅö³º¥¯¥é¥¹Ì¾Á°¶õ
+# ´ÖÆâ¤ËƳÆþ¤¹¤ë¡£
+#
+# @else
+# @class DataPortStatus mixin class
+# @brief DataPortStatus mixin class
+#
+# This is a mixin class to provide enumed return codes that are
+# commonly utilised in connector listener related sub-classes. To
+# use this class, sub-class should inherit this class as a public
+# super class, and declare CONNLISTENERSTATUS_ENUM defined
+# below. Consequently, ReturnCode type that is typedefed by this
+# macro can be used in the sub-class, and enumed identifiers are
+# imported to the class's namespace.
+#
+# @endif
+#
+class ConnectorListenerStatus:
+ NO_CHANGE = 0
+ INFO_CHANGED = 1 << 0
+ DATA_CHANGED = 1 << 1
+ BOTH_CHANGED = INFO_CHANGED | DATA_CHANGED
+
+
+
##
# @if jp
# @brief ConnectorDataListener ¤Î¥¿¥¤¥×
@@ -180,7 +218,7 @@
def __del__(self):
pass
- # virtual void operator()(const ConnectorInfo& info,
+ # virtual ReturnCode operator()(const ConnectorInfo& info,
# const cdrMemoryStream& data) = 0;
def __call__(self, info, data):
pass
@@ -284,7 +322,7 @@
#
# @endif
#
- # virtual void operator()(const ConnectorInfo& info,
+ # virtual ReturnCode operator()(const ConnectorInfo& info,
# const cdrMemoryStream& cdrdata)
def __call__(self, info, cdrdata, data):
endian = info.properties.getProperty("serializer.cdr.endian","little")
@@ -349,6 +387,7 @@
##
# @if jp
# @class ConnectorListener ¥¯¥é¥¹
+# @brief ConnectorListener ¥¯¥é¥¹
#
# ¥Ç¡¼¥¿¥Ý¡¼¥È¤Î Connector ¤Ë¤ª¤¤¤ÆȯÀ¸¤¹¤ë³Æ¼ï¥¤¥Ù¥ó¥È¤ËÂФ¹¤ë¥³¡¼
# ¥ë¥Ð¥Ã¥¯¤ò¼Â¸½¤¹¤ë¥ê¥¹¥Ê¥¯¥é¥¹¤Î´ðÄ쥯¥é¥¹¡£
@@ -362,51 +401,62 @@
# ¾ì¹ç¤Ê¤É¤Ë¥³¡¼¥ë¤µ¤ì¤ë¥Õ¥¡¥ó¥¯¥¿¤Î°ú¿ô¤Ë²¿¤â¤È¤é¤Ê¤é¤¤
# ConnecotorListener ¤¬¤¢¤ë¡£
#
-# ¥Ç¡¼¥¿¥Ý¡¼¥È¤Ë¤Ï¡¢Àܳ»þ¤Ë¥Ç¡¼¥¿¤ÎÁ÷¼õ¿®ÊýË¡¤Ë¤Ä¤¤¤Æ¥Ç¡¼¥¿¥Õ¥í¡¼·¿¡¢
-# ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿Åù¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
-# ConnectorDaataListener/ConnectorListener ¤Ï¶¦¤Ë¤Ë¡¢ÍÍ¡¹¤Ê¥¤¥Ù¥ó¥È
-# ¤ËÂФ¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¤¬¡¢¤³¤ì¤é¥Ç¡¼¥¿¥Õ¥í¡¼·¿
-# ¤ª¤è¤Ó¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿¤ÎÀßÄê¤Ë±þ¤¸¤Æ¡¢ÍøÍѤǤ¤ë¤â¤Î¡¢¤Ç¤¤Ê¤¤
-# ¤â¤Î¡¢¤Þ¤¿¸Æ¤Ó½Ð¤µ¤ì¤ë¥¿¥¤¥ß¥ó¥°¤¬°Û¤Ê¤ë¡£°Ê²¼¤Ë¡¢¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹
-# ¤¬CORBA CDR·¿¤Î¾ì¹ç¤Î¥³¡¼¥ë¥Ð¥Ã¥¯°ìÍ÷¤ò¼¨¤¹¡£
+# ConnectorListener ¥¯¥é¥¹¤Ë¤è¤Ã¤Æ´ØÏ¢¤¹¤ëÆ°ºî¤ò¥Õ¥Ã¥¯¤·¤¿¤¤¾ì¹ç¡¢°Ê
+# ²¼¤ÎÎã¤Î¤è¤¦¤Ë¡¢¤³¤Î¥¯¥é¥¹¤ò·Ñ¾µ¤·¡¢¥³¥Í¥¯¥¿¤Î¾ðÊó¤ò°ú¿ô¤Ë¼è¤ë°Ê²¼
+# ¤Î¤è¤¦¤Ê¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢¥Ç¡¼¥¿¥Ý¡¼¥È¤ÎŬÀڤʥ³¡¼
+# ¥ë¥Ð¥Ã¥¯ÀßÄê´Ø¿ô¤«¤é¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã¥È¤¹¤ëɬÍפ¬¤¢¤ë¡£
#
+# <pre>
+# class MyListener
+# : public ConnectorListener
+# {
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+# virtual ReturnCode operator()(ConnectorInfo& info)
+# {
+# std::cout << "Data Listener: " << m_name << std::endl;
+# std::cout << "Profile::name: " << info.name << std::endl;
+# std::cout << "Profile::id: " << info.id << std::endl;
+# std::cout << "Profile::properties: " << std::endl;
+# std::cout << info.properties;
+# };
+# std::string m_name;
+# };
+# </pre>
+#
+# ¤³¤Î¤è¤¦¤Ë¤·¤ÆÄêµÁ¤µ¤ì¤¿¥ê¥¹¥Ê¥¯¥é¥¹¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ë¥Ç¡¼¥¿¥Ý¡¼¥È¤Ë
+# ÂФ·¤Æ¡¢°Ê²¼¤Î¤è¤¦¤Ë¥»¥Ã¥È¤µ¤ì¤ë¡£
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# m_outOut.
+# addConnectorListener(ON_BUFFER_EMPTY,
+# new MyListener("ON_BUFFER_EMPTY"));
+# :
+# </pre>
+#
+# Âè1°ú¿ô¤Î "ON_BUFFER_EMPTY" ¤Ï¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò¥Õ¥Ã¥¯¤¹¤ë¥Ý¥¤¥ó¥È¤Ç
+# ¤¢¤ê¡¢°Ê²¼¤ËÎóµó¤¹¤ëÃͤò¼è¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¥Ç¡¼¥¿¥Ý¡¼¥È¤Ë¤Ï¡¢ÀÜ
+# ³»þ¤Ë¥Ç¡¼¥¿¤ÎÁ÷¼õ¿®ÊýË¡¤Ë¤Ä¤¤¤Æ¡¢¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹·¿¡¢¥Ç¡¼¥¿¥Õ¥í¡¼
+# ·¿¡¢¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿Åù¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¤¬¡¢¤³¤ì¤é¤ÎÀßÄê¤Ë
+# ¤è¤ê¥Õ¥Ã¥¯¤µ¤ì¤ë¥Ý¥¤¥ó¥È¤Ï°Û¤Ê¤ë¡£°Ê²¼¤Ë¡¢¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤¬CORBA
+# CDR·¿¤Î¾ì¹ç¤Î¥³¡¼¥ë¥Ð¥Ã¥¯°ìÍ÷¤ò¼¨¤¹¡£
+#
# OutPort:
# - Push·¿: Subscription Type¤Ë¤è¤ê¤µ¤é¤Ë¥¤¥Ù¥ó¥È¤Î¼ïÎबʬ¤«¤ì¤ë¡£
# - Flush: Flush·¿¤Ë¤Ï¥Ð¥Ã¥Õ¥¡¤¬¤Ê¤¤¤¿¤á ON_BUFFER ·Ï¤Î¥¤¥Ù¥ó¥È¤ÏȯÀ¸¤·¤Ê¤¤
-# - ON_SEND
-# - ON_RECEIVED
-# - ON_RECEIVER_FULL
-# - ON_RECEIVER_TIMEOUT
-# - ON_RECEIVER_ERROR
# - ON_CONNECT
# - ON_DISCONNECT
# .
# - New·¿
-# - ON_BUFFER_WRITE
-# - ON_BUFFER_FULL
-# - ON_BUFFER_WRITE_TIMEOUT
-# - ON_BUFFER_OVERWRITE
-# - ON_BUFFER_READ
-# - ON_SEND
-# - ON_RECEIVED
-# - ON_RECEIVER_FULL
-# - ON_RECEIVER_TIMEOUT
-# - ON_RECEIVER_ERROR
-# - ON_SENDER_ERROR
# - ON_CONNECT
# - ON_DISCONNECT
# .
# - Periodic·¿
-# - ON_BUFFER_WRITE
-# - ON_BUFFER_FULL
-# - ON_BUFFER_WRITE_TIMEOUT
-# - ON_BUFFER_READ
-# - ON_SEND
-# - ON_RECEIVED
-# - ON_RECEIVER_FULL
-# - ON_RECEIVER_TIMEOUT
-# - ON_RECEIVER_ERROR
# - ON_BUFFER_EMPTY
+# - ON_BUFFER_READ_TIMEOUT
# - ON_SENDER_EMPTY
# - ON_SENDER_ERROR
# - ON_CONNECT
@@ -414,8 +464,6 @@
# .
# .
# - Pull·¿
-# - ON_BUFFER_READ
-# - ON_SEND
# - ON_BUFFER_EMPTY
# - ON_BUFFER_READ_TIMEOUT
# - ON_SENDER_EMPTY
@@ -423,17 +471,11 @@
# - ON_SENDER_ERROR
# - ON_CONNECT
# - ON_DISCONNECT
-#
+# .
# InPort:
# - Push·¿:
-# - ON_BUFFER_WRITE
-# - ON_BUFFER_FULL
-# - ON_BUFFER_WRITE_TIMEOUT
-# - ON_BUFFER_WRITE_OVERWRITE
-# - ON_RECEIVED
-# - ON_RECEIVER_FULL
-# - ON_RECEIVER_TIMEOUT
-# - ON_RECEIVER_ERROR
+# - ON_BUFFER_EMPTY
+# - ON_BUFFER_READ_TIMEOUT
# - ON_CONNECT
# - ON_DISCONNECT
# .
@@ -440,13 +482,107 @@
# - Pull·¿
# - ON_CONNECT
# - ON_DISCONNECT
+#
# @else
# @class ConnectorListener class
+# @brief ConnectorListener class
#
# This class is abstract base class for listener classes that
-# provides callbacks for various events in the data port's
+# realize callbacks for various events in the data port's
# connectors.
#
+# Callbacks can be hooked to the various kind of events which occur
+# throgh OutPort side data write action to InPort side data-read
+# action. Two types listener classes exist. One is
+# ConnectorDataListener which receives valid data-port's data value
+# at that time such as buffer-full event, data-send event, and so
+# on. Other is ConnectorListener which does not receive any data
+# such as buffer-empty event, buffer-read-timeout event and so on.
+#
+# If you want to hook related actions by
+# ConnectorListener, a class which inherits this class should
+# be defined, and the functor should receive a connector
+# information as an argument. And then, the defined
+# class must be set to data-port object through its member
+# function, as follows.
+#
+# <pre>
+# class MyListener
+# : public ConnectorListener
+# {
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+# virtual ReturnCode operator()(ConnectorInfo& info)
+# {
+# std::cout << "Data Listener: " << m_name << std::endl;
+# std::cout << "Profile::name: " << info.name << std::endl;
+# std::cout << "Profile::id: " << info.id << std::endl;
+# std::cout << "Profile::properties: " << std::endl;
+# std::cout << info.properties;
+# };
+# std::string m_name;
+# };
+# </pre>
+#
+# The listener class defained as above can be attached to a
+# data-port as follows.
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# m_outOut.
+# addConnectorListener(ON_BUFFER_EMPTY,
+# new MyDataListener("ON_BUFFER_EMPTY"));
+# :
+# </pre>
+#
+# The first argument "ON_BUFFER_EMPTY" specifies hook point of
+# callback, and the following values are available. Data-port can
+# be specified some properties such as interface-type,
+# dataflow-type, subscription type and so on. Available hook points
+# vary by the those settings. The following hook points are
+# available when interface type is CORBA CDR type.
+#
+# OutPort:
+# - Push type: Available hook event varies by subscription type.
+# - Flush: No ON_BUFFER* events since flush-type has no buffer.
+# - ON_CONNECT
+# - ON_DISCONNECT
+# .
+# - New type:
+# - ON_CONNECT
+# - ON_DISCONNECT
+# .
+# - Periodic type:
+# - ON_BUFFER_EMPTY
+# - ON_BUFFER_READ_TIMEOUT
+# - ON_SENDER_EMPTY
+# - ON_SENDER_ERROR
+# - ON_CONNECT
+# - ON_DISCONNECT
+# .
+# .
+# - Pull type:
+# - ON_BUFFER_EMPTY
+# - ON_BUFFER_READ_TIMEOUT
+# - ON_SENDER_EMPTY
+# - ON_SENDER_TIMEOUT
+# - ON_SENDER_ERROR
+# - ON_CONNECT
+# - ON_DISCONNECT
+# .
+# InPort:
+# - Push type:
+# - ON_BUFFER_EMPTY
+# - ON_BUFFER_READ_TIMEOUT
+# - ON_CONNECT
+# - ON_DISCONNECT
+# .
+# - Pull type:
+# - ON_CONNECT
+# - ON_DISCONNECT
+#
# @endif
#
class ConnectorListener:
@@ -527,6 +663,7 @@
#
def __init__(self):
self._listeners = []
+ self._mutex = threading.RLock()
return
@@ -538,6 +675,7 @@
# @endif
#
def __del__(self):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
for listener in self._listeners:
for (k,v) in listener.items():
if v:
@@ -570,6 +708,7 @@
#
# void addListener(ConnectorDataListener* listener, bool autoclean);
def addListener(self, listener, autoclean):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
self._listeners.append({listener:autoclean})
return
@@ -595,6 +734,7 @@
#
# void removeListener(ConnectorDataListener* listener);
def removeListener(self, listener):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
for (i, _listener) in enumerate(self._listeners):
if listener in _listener:
del self._listeners[i][listener]
@@ -622,13 +762,16 @@
# @param cdrdata Data
# @endif
#
- # void notify(const ConnectorInfo& info,
+ # ReturnCode notify(const ConnectorInfo& info,
# const cdrMemoryStream& cdrdata);
def notify(self, info, cdrdata):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ ret = ConnectorListenerStatus.NO_CHANGE
+
for listener in self._listeners:
for (k,v) in listener.items():
- k(info, cdrdata)
- return
+ ret = ret | k(info, cdrdata)
+ return ret
##
@@ -657,6 +800,7 @@
#
def __init__(self):
self._listeners = []
+ self._mutex = threading.RLock()
return
@@ -668,6 +812,7 @@
# @endif
#
def __del__(self):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
for listener in self._listeners:
for (k,v) in listener.items():
if v:
@@ -700,6 +845,7 @@
#
# void addListener(ConnectorListener* listener, bool autoclean);
def addListener(self, listener, autoclean):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
self._listeners.append({listener:autoclean})
return
@@ -725,6 +871,7 @@
#
# void removeListener(ConnectorListener* listener);
def removeListener(self, listener):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
for (i, _listener) in enumerate(self._listeners):
if listener in _listener:
del self._listeners[i][listener]
@@ -740,6 +887,7 @@
#
# @param self
# @param info ConnectorInfo
+ # @return ReturnCode
# @else
#
# @brief Notify listeners.
@@ -748,14 +896,17 @@
#
# @param self
# @param info ConnectorInfo
+ # @return ReturnCode
# @endif
#
# void notify(const ConnectorInfo& info);
def notify(self, info):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ ret = ConnectorListenerStatus.NO_CHANGE
for listener in self._listeners:
for (k,v) in listener.items():
- k(info)
- return
+ ret = ret | k(info)
+ return ret
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/DataFlowComponentBase.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/DataFlowComponentBase.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/DataFlowComponentBase.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -15,6 +15,8 @@
# All rights reserved.
import OpenRTM_aist
+import OpenRTM__POA
+import RTC
##
@@ -32,7 +34,7 @@
# @class DataFlowComponentBase
# @brief DataFlowComponentBase class
# @endif
-class DataFlowComponentBase(OpenRTM_aist.RTObject_impl):
+class DataFlowComponentBase(OpenRTM_aist.RTObject_impl, OpenRTM__POA.DataFlowComponent):
"""
"""
@@ -49,8 +51,8 @@
# @else
# @brief Constructor
# @endif
- def __init__(self, manager):
- OpenRTM_aist.RTObject_impl.__init__(self, manager)
+ def __init__(self, manager=None, orb=None, poa=None):
+ OpenRTM_aist.RTObject_impl.__init__(self, manager, orb, poa)
##
@@ -69,3 +71,165 @@
pass
+
+ ##
+ # @if jp
+ #
+ # @brief [DataFlowComponentAction CORBA interface] RTC ¤ÎÄê¾ï½èÍý(Âè°ì¼þ´ü)
+ #
+ # °Ê²¼¤Î¾õÂÖ¤¬ÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢ÀßÄꤵ¤ì¤¿¼þ´ü¤ÇÄê´üŪ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # - RTC ¤Ï Alive ¾õÂ֤Ǥ¢¤ë¡£
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤¬ Running ¾õÂ֤Ǥ¢¤ë¡£
+ # ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢Two-Pass Execution ¤ÎÂè°ì¼þ´ü¤Ç¼Â¹Ô¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onExecute() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ó
+ # ½Ð¤µ¤ì¤ë¡£
+ #
+ # À©Ìó
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Î ExecutionKind ¤Ï¡¢ PERIODIC ¤Ç¤Ê¤±¤ì¤Ð¤Ê
+ # ¤é¤Ê¤¤
+ #
+ # @param self
+ # @param ec_id Äê¾ï½èÍýÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [DataFlowComponentAction CORBA interface] Primary Periodic
+ # Operation of RTC
+ #
+ # This operation will be invoked periodically at the rate of the given
+ # execution context as long as the following conditions hold:
+ # - The RTC is Active.
+ # - The given execution context is Running
+ # This callback occurs during the first execution pass.
+ #
+ # Constraints
+ # - The execution context of the given context shall be PERIODIC.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_execute(self, ec_id):
+ self._rtcout.RTC_TRACE("on_execute(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnExecute(ec_id)
+ if self._readAll:
+ self.readAll()
+
+ ret = self.onExecute(ec_id)
+
+ if self._writeAll:
+ self.writeAll()
+
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnExecute(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [DataFlowComponentAction CORBA interface] RTC ¤ÎÄê¾ï½èÍý(ÂèÆó¼þ´ü)
+ #
+ # °Ê²¼¤Î¾õÂÖ¤¬ÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢ÀßÄꤵ¤ì¤¿¼þ´ü¤ÇÄê´üŪ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # - RTC ¤Ï Alive ¾õÂ֤Ǥ¢¤ë¡£
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤¬ Running ¾õÂ֤Ǥ¢¤ë¡£
+ # ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢Two-Pass Execution ¤ÎÂèÆó¼þ´ü¤Ç¼Â¹Ô¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onStateUpdate() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # À©Ìó
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Î ExecutionKind ¤Ï¡¢ PERIODIC ¤Ç¤Ê¤±¤ì¤Ð¤Ê
+ # ¤é¤Ê¤¤
+ #
+ # @param self
+ # @param ec_id Äê¾ï½èÍýÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [DataFlowComponentAction CORBA interface] Secondary Periodic
+ # Operation of RTC
+ #
+ # This operation will be invoked periodically at the rate of the given
+ # execution context as long as the following conditions hold:
+ # - The RTC is Active.
+ # - The given execution context is Running
+ # This callback occurs during the second execution pass.
+ #
+ # Constraints
+ # - The execution context of the given context shall be PERIODIC.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_state_update(self, ec_id):
+ self._rtcout.RTC_TRACE("on_state_update(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnStateUpdate(ec_id)
+ ret = self.onStateUpdate(ec_id)
+ self._configsets.update()
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnStateUpdate(ec_id, ret)
+ return ret
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [DataFlowComponentAction CORBA interface] ¼Â¹Ô¼þ´üÊѹ¹ÄÌÃÎ
+ #
+ # ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢ExecutionContext ¤Î¼Â¹Ô¼þ´ü¤¬Êѹ¹¤µ¤ì¤¿¤³¤È¤òÄÌÃΤ¹¤ë
+ # ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onRateChanged() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # À©Ìó
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Î ExecutionKind ¤Ï¡¢ PERIODIC ¤Ç¤Ê¤±¤ì¤Ð¤Ê
+ # ¤é¤Ê¤¤
+ #
+ # @param self
+ # @param ec_id Äê¾ï½èÍýÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [DataFlowComponentAction CORBA interface] Notify rate chenged
+ #
+ # This operation is a notification that the rate of the indicated execution
+ # context has changed.
+ #
+ # Constraints
+ # - The execution context of the given context shall be PERIODIC.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_rate_changed(self, ec_id):
+ self._rtcout.RTC_TRACE("on_rate_changed(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnRateChanged(ec_id)
+ ret = self.onRateChanged(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnRateChanged(ec_id, ret)
+ return ret
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventDrivenExecutionContext.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventDrivenExecutionContext.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventDrivenExecutionContext.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file EventDrivenExecutionContext.py
+# @brief EventDrivenExecutionContext class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+import OpenRTM_aist
+import RTC
+
+##
+# @if jp
+# @class PeriodicExecutionContext
+# @brief PeriodicExecutionContext ¥¯¥é¥¹
+#
+# Periodic Sampled Data Processing(¼þ´ü¼Â¹ÔÍÑ)ExecutionContext¥¯¥é¥¹¡£
+#
+# @since 0.4.0
+#
+# @else
+# @class EventDrivenExecutionContext
+# @brief EventDrivenExecutionContext class
+# @endif
+class EventDrivenExecutionContext(OpenRTM_aist.PeriodicExecutionContext):
+ """
+ """
+
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # ÀßÄꤵ¤ì¤¿Ãͤò¥×¥í¥Õ¥¡¥¤¥ë¤ËÀßÄꤹ¤ë¡£
+ #
+ # @else
+ # @brief Constructor
+ # @endif
+ def __init__(self):
+ OpenRTM_aist.PeriodicExecutionContext.__init__(self)
+ self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("rtobject.eventdriven_ec")
+ self.setKind(RTC.EVENT_DRIVEN)
+
+ return
+
+
+
+##
+# @if jp
+# @brief ExecutionContext ¤ò½é´ü²½¤¹¤ë
+#
+# ExecutionContext µ¯Æ°ÍÑ¥Õ¥¡¥¯¥È¥ê¤òÅÐÏ¿¤¹¤ë¡£
+#
+# @param manager ¥Þ¥Í¡¼¥¸¥ã¥ª¥Ö¥¸¥§¥¯¥È
+#
+# @else
+#
+# @endif
+def PeriodicExecutionContextInit(manager):
+ OpenRTM_aist.ExecutionContextFactory.instance().addFactory("EventDrivenExecutionContext",
+ OpenRTM_aist.EventDrivenExecutionContext,
+ OpenRTM_aist.ECDelete)
+ return
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventPort.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventPort.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/EventPort.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,209 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file EventPort.py
+# @brief EventInPort template class
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import OpenRTM_aist
+
+
+class EventBinder0(OpenRTM_aist.ConnectorDataListener):
+ def __init__(self, fsm, event_name, handler):
+ self._fsm = fsm
+ self._eventName = event_name
+ self._handler = handler
+ def __del__(self):
+ pass
+ def __call__(self, info, data):
+ if info.properties.getProperty("fsm_event_name") == self._eventName or info.name == self._eventName:
+ self._fsm.dispatch(OpenRTM_aist.Macho.Event0(self._handler))
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+
+
+
+class EventBinder1(OpenRTM_aist.ConnectorDataListenerT):
+ def __init__(self, fsm, event_name, handler, data_type):
+ self._fsm = fsm
+ self._eventName = event_name
+ self._handler = handler
+ self._data_type = data_type
+ def __del__(self):
+ pass
+ def __call__(self, info, data):
+ data_ = OpenRTM_aist.ConnectorDataListenerT.__call__(self, info, data, self._data_type)
+
+ if info.properties.getProperty("fsm_event_name") == self._eventName or info.name == self._eventName:
+ self._fsm.dispatch(OpenRTM_aist.Macho.Event1(self._handler, data_))
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+
+
+
+
+
+
+##
+# @if jp
+#
+# @class EventInPort
+#
+# @brief EventInPort ¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é¥¹
+#
+# EventInPort ¤Î¼ÂÁõ¤Ç¤¢¤ë EventInPort<T> ¤Î¥Æ¥ó¥×¥ì¡¼¥È¥¯¥é¥¹¡£
+# <T> ¤ÏBasicDataType.idl ¤Ë¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë·¿¤Ç¡¢¥á¥ó¥Ð¤È¤·¤Æ
+# Time ·¿¤Î tm , ¤ª¤è¤Ó T·¿¤Î data ¤ò»ý¤Ä¹½Â¤ÂΤǤʤ¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+# EventInPort ¤ÏÆâÉô¤Ë¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ò»ý¤Á¡¢³°Éô¤«¤éÁ÷¿®¤µ¤ì¤¿¥Ç¡¼¥¿¤ò½ç¼¡
+# ¤³¤Î¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤¹¤ë¡£¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç64¤È
+# ¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¢¥³¥ó¥¹¥È¥é¥¯¥¿°ú¿ô¤Ë¤è¤ê¥µ¥¤¥º¤ò»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+# ¥Ç¡¼¥¿¤Ï¥Õ¥é¥°¤Ë¤è¤Ã¤Æ̤ÆÉ¡¢´ûÆɾõÂÖ¤¬´ÉÍý¤µ¤ì¡¢isNew(), write(), read(),
+# isFull(), isEmpty() Åù¤Î¥á¥½¥Ã¥É¤Ë¤è¤ê¥Ï¥ó¥É¥ê¥ó¥°¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+#
+# OnRead·Ï¥³¡¼¥ë¥Ð¥Ã¥¯ (Æɤ߽Ф·¤Ëµ¯°ø¤¹¤ë¥¤¥Ù¥ó¥È¤Ë¤è¤ê¥³¡¼¥ë¤µ¤ì¤ë)
+#
+# - void OnRead::operator():
+# EventInPort::read() ¤ò¸Æ¤Ó½Ð¤·Æɤ߽Ф·¤ò¹Ô¤¦ºÝ¤Ë¥³¡¼¥ë¤µ¤ì¤ë¡£
+#
+# - DataType OnReadConvert::operator(DataType):
+# EventInPort::read() ¤ò¸Æ¤Ó½Ð¤·¡¢¥Ç¡¼¥¿¤ò¥Ð¥Ã¥Õ¥¡¤«¤éÆɤߤÀ¤¹ºÝ¤Ë¸Æ¤Ð¤ì
+# ¥Ç¡¼¥¿¤ÎÊÑ´¹¤ò¹Ô¤¦¡£°ú¿ô¤Ë¤Ï¥Ð¥Ã¥Õ¥¡¤«¤éÆɤ߽Фµ¤ì¤¿Ãͤ¬Í¿¤¨¤é¤ì¡¢
+# ÊÑ´¹¸å¤Î¥Ç¡¼¥¿¤òÌá¤êÃͤȤ·¤ÆÊÖ¤¹¡£¤³¤ÎÃͤ¬read()¤ÎÊÖ¤¹ÃͤȤʤ롣
+#
+# @since 0.2.0
+#
+# @else
+#
+# @class EventInPort
+#
+# @brief EventInPort template class
+#
+# This is a template class that implements EventInPort. <T> is the type
+# defined in BasicDataType.idl and must be the structure which has
+# both Time type tm and type-T data as a member. EventInPort has a ring
+# buffer internally, and stores the received data externally in
+# this buffer one by one. The size of ring buffer can be specified
+# according to the argument of constructor, though the default size
+# is 64. Unread data and data which is already read are managed
+# with the flag, and the data can be handled by the isNew(),
+# write(), read(), isFull() and isEmpty() method etc.
+#
+# @since 0.2.0
+#
+# @endif
+#
+class EventInPort(OpenRTM_aist.InPortBase):
+ ##
+ # @if jp
+ #
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿¡£
+ # ¥Ñ¥é¥á¡¼¥¿¤È¤·¤ÆÍ¿¤¨¤é¤ì¤ë T ·¿¤ÎÊÑ¿ô¤Ë¥Ð¥¤¥ó¥É¤µ¤ì¤ë¡£
+ #
+ # @param name EventInPort ̾¡£EventInPortBase:name() ¤Ë¤è¤ê»²¾È¤µ¤ì¤ë¡£
+ # @param value ¤³¤Î EventInPort ¤Ë¥Ð¥¤¥ó¥É¤µ¤ì¤ë T ·¿¤ÎÊÑ¿ô
+ # @param bufsize EventInPort ÆâÉô¤Î¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Î¥Ð¥Ã¥Õ¥¡Ä¹(¥Ç¥Õ¥©¥ë¥ÈÃÍ:64)
+ # @param read_block Æɹþ¥Ö¥í¥Ã¥¯¥Õ¥é¥°¡£
+ # ¥Ç¡¼¥¿Æɹþ»þ¤Ë̤Æɥǡ¼¥¿¤¬¤Ê¤¤¾ì¹ç¡¢¼¡¤Î¥Ç¡¼¥¿¼õ¿®¤Þ¤Ç¥Ö¥í¥Ã¥¯¤¹¤ë
+ # ¤«¤É¤¦¤«¤òÀßÄê(¥Ç¥Õ¥©¥ë¥ÈÃÍ:false)
+ # @param write_block ½ñ¹þ¥Ö¥í¥Ã¥¯¥Õ¥é¥°¡£
+ # ¥Ç¡¼¥¿½ñ¹þ»þ¤Ë¥Ð¥Ã¥Õ¥¡¤¬¥Õ¥ë¤Ç¤¢¤Ã¤¿¾ì¹ç¡¢¥Ð¥Ã¥Õ¥¡¤Ë¶õ¤¤¬¤Ç¤¤ë
+ # ¤Þ¤Ç¥Ö¥í¥Ã¥¯¤¹¤ë¤«¤É¤¦¤«¤òÀßÄê(¥Ç¥Õ¥©¥ë¥ÈÃÍ:false)
+ # @param read_timeout Æɹþ¥Ö¥í¥Ã¥¯¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¡¢¥Ç¡¼¥¿Æɼ西¥¤¥à
+ # ¥¢¥¦¥È»þ´Ö(¥ß¥êÉÃ)(¥Ç¥Õ¥©¥ë¥ÈÃÍ:0)
+ # @param write_timeout ½ñ¹þ¥Ö¥í¥Ã¥¯¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¡¢¥Ç¡¼¥¿½ñ¹þ¥¿¥¤¥à
+ # ¥¢¥¦¥È»þ´Ö(¥ß¥êÉÃ)(¥Ç¥Õ¥©¥ë¥ÈÃÍ:0)
+ #
+ # @else
+ #
+ # @brief A constructor.
+ #
+ # constructor.
+ # This is bound to type-T variable given as a parameter.
+ #
+ # @param name A name of the EventInPort. This name is referred by
+ # EventInPortBase::name().
+ # @param value type-T variable that is bound to this EventInPort.
+ # @param bufsize Buffer length of internal ring buffer of EventInPort
+ # (The default value:64)
+ # @param read_block Flag of reading block.
+ # When there are not unread data at reading data,
+ # set whether to block data until receiving the next
+ # data. (The default value:false)
+ # @param write_block Flag of writing block.
+ # If the buffer was full at writing data, set whether
+ # to block data until the buffer has space.
+ # (The default value:false)
+ # @param read_timeout Data reading timeout time (millisecond)
+ # when not specifying read blocking.
+ # (The default value:0)
+ # @param write_timeout Data writing timeout time (millisecond)
+ # when not specifying writing block.
+ # (The default value:0)
+ #
+ # @endif
+ #
+ def __init__(self, name, fsm, bufsize=64, read_block=False, write_block=False, read_timeout=0, write_timeout=0):
+ super(EventInPort, self).__init__(name, "any")
+ self._name = name
+ self._fsm = fsm
+ ##
+ # @if jp
+ #
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # ¥Ç¥¹¥È¥é¥¯¥¿¡£
+ #
+ # @else
+ #
+ # @brief Destructor
+ #
+ # Destructor
+ #
+ # @endif
+ #
+ def __del__(self):
+ pass
+ ##
+ # @if jp
+ #
+ # @brief ¥Ý¡¼¥È̾¾Î¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # ¥Ý¡¼¥È̾¾Î¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @return ¥Ý¡¼¥È̾¾Î
+ #
+ # @else
+ #
+ # @brief Get port name
+ #
+ # Get port name.
+ #
+ # @return The port name
+ #
+ # @endif
+ #
+ def name(self):
+ return self._name
+
+ def bindEvent0(self, name, handler):
+ self.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED,
+ EventBinder0(self._fsm, name, handler))
+
+ def bindEvent1(self, name, handler, data_type):
+ self.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED,
+ EventBinder1(self._fsm, name, handler, data_type))
+
+
+
+
+
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FactoryInit.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FactoryInit.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FactoryInit.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -46,3 +46,7 @@
OpenRTM_aist.NodeNumberingPolicyInit()
OpenRTM_aist.NamingServiceNumberingPolicyInit()
OpenRTM_aist.LogstreamFileInit()
+ OpenRTM_aist.OutPortDSProviderInit()
+ OpenRTM_aist.OutPortDSConsumerInit()
+ OpenRTM_aist.InPortDSProviderInit()
+ OpenRTM_aist.InPortDSConsumerInit()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponent.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponent.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponent.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file FiniteStateMachineComponentBase.py
+# @brief Finite StateMachine Component Base class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+import OpenRTM_aist
+import OpenRTM, OpenRTM__POA
+
+
+
+
+
+##
+# @if jp
+# @brief
+# FiniteStateMachine¤Î¥Ù¡¼¥¹¥¯¥é¥¹¡£
+# ¥æ¡¼¥¶¤¬¿·¤¿¤ÊRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òºîÀ®¤¹¤ë¾ì¹ç¤Ï¡¢¤³¤Î¥¯¥é¥¹¤ò³ÈÄ¥¤¹¤ë¡£
+# ³ÆRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë¥¯¥é¥¹¡£}
+#
+#
+# @else
+# @brief
+# This is a class to be a base of each RT-Component.
+# This is a implementation class of lightweightRTComponent in Robotic
+# Technology Component specification
+#
+# @endif
+class FiniteStateMachineComponent_impl(OpenRTM_aist.RTObject_impl, OpenRTM__POA.FiniteStateMachineComponent):
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @brief Consructor
+ #
+ #
+ # @endif
+ def __init__(self, manager=None, orb=None, poa=None):
+ OpenRTM_aist.RTObject_impl.__init__(self, manager, orb, poa)
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_action(self, ec_id):
+ self._rtcout.RTC_TRACE("on_action(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ #self.preOnAction(ec_id)
+ ret = self.onAction(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ #self.postOnAction(ec_id, ret)
+ return ret
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponentBase.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponentBase.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FiniteStateMachineComponentBase.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,848 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file FiniteStateMachineComponentBase.py
+# @brief Finite StateMachine Component Base class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+import OpenRTM_aist
+import RTC
+
+
+##
+# @if jp
+# @brief
+# FiniteStateMachine¤Î¥Ù¡¼¥¹¥¯¥é¥¹¡£
+# ¥æ¡¼¥¶¤¬¿·¤¿¤ÊRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òºîÀ®¤¹¤ë¾ì¹ç¤Ï¡¢¤³¤Î¥¯¥é¥¹¤ò³ÈÄ¥¤¹¤ë¡£
+# ³ÆRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë¥¯¥é¥¹¡£}
+#
+#
+# @else
+# @brief
+# This is a class to be a base of each RT-Component.
+# This is a implementation class of lightweightRTComponent in Robotic
+# Technology Component specification
+#
+# @endif
+class FiniteStateMachineComponentBase(OpenRTM_aist.RTObject_impl):
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @brief Consructor
+ #
+ #
+ # @endif
+ def __init__(self, manager):
+ OpenRTM_aist.RTObject_impl.__init__(self, manager)
+ self._rtcout = self._manager.getLogbuf("FiniteStateMachineComponentBase")
+ self._ref = None
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC¤ò½é´ü²½¤¹¤ë
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ¡¢ComponentAction::on_initialize
+ # ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¡£
+ #
+ # À©Ìó
+ # - RTC ¤Ï Created¾õÂ֤ξì¹ç¤ß½é´ü²½¤¬¹Ô¤ï¤ì¤ë¡£Â¾¤Î¾õÂ֤ˤ¤¤ë¾ì¹ç¤Ë¤Ï
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤¬ÊÖ¤µ¤ì¸Æ¤Ó½Ð¤·¤Ï¼ºÇÔ¤¹¤ë¡£
+ # - ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï RTC ¤Î¥ß¥É¥ë¥¦¥¨¥¢¤«¤é¸Æ¤Ð¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤ª¤ê¡¢
+ # ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¼Ô¤ÏľÀܤ³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ò¸Æ¤Ö¤³¤È¤ÏÁÛÄê
+ # ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief Initialize the RTC that realizes this interface.
+ #
+ # The invocation of this operation shall result in the invocation of the
+ # callback ComponentAction::on_initialize.
+ #
+ # Constraints
+ # - An RTC may be initialized only while it is in the Created state. Any
+ # attempt to invoke this operation while in another state shall fail
+ # with ReturnCode_t::PRECONDITION_NOT_MET.
+ # - Application developers are not expected to call this operation
+ # directly; it exists for use by the RTC infrastructure.
+ #
+ # @return
+ #
+ # @endif
+ def initialize(self):
+ return OpenRTM_aist.RTObject_impl.initialize(self)
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC ¤ò½ªÎ»¤¹¤ë
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ ComponentAction::on_finalize()
+ # ¤ò¸Æ¤Ó½Ð¤¹¡£
+ #
+ # À©Ìó
+ # - RTC ¤¬ ExecutionContext ¤Ë½ê°¤·¤Æ¤¤¤ë´Ö¤Ï½ªÎ»¤µ¤ì¤Ê¤¤¡£¤³¤Î¾ì¹ç¤Ï¡¢
+ # ¤Þ¤ººÇ½é¤Ë ExecutionContextOperations::remove_component ¤Ë¤è¤Ã¤Æ»²²Ã¤ò
+ # ²ò½ü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Ï
+ # ¤¤¤«¤Ê¤ë¾ì¹ç¤â ReturnCode_t::PRECONDITION_NOT_ME ¤Ç¼ºÇÔ¤¹¤ë¡£
+ # - RTC ¤¬ Created ¾õÂ֤Ǥ¢¤ë¾ì¹ç¡¢½ªÎ»½èÍý¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
+ # ¤³¤Î¾ì¹ç¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Ï¤¤¤«¤Ê¤ë¾ì¹ç¤â
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤Ç¼ºÇÔ¤¹¤ë¡£
+ # - ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ÏRTC¤Î¥ß¥É¥ë¥¦¥¨¥¢¤«¤é¸Æ¤Ð¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤ª¤ê¡¢
+ # ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¼Ô¤ÏľÀܤ³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ò¸Æ¤Ö¤³¤È¤ÏÁÛÄê
+ # ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief Finalize the RTC for preparing it for destruction
+ #
+ # This invocation of this operation shall result in the invocation of the
+ # callback ComponentAction::on_finalize.
+ #
+ # Constraints
+ # - An RTC may not be finalized while it is participating in any execution
+ # context. It must first be removed with
+ # ExecutionContextOperations::remove_component. Otherwise, this operation
+ # shall fail with ReturnCode_t::PRECONDITION_NOT_MET.
+ # - An RTC may not be finalized while it is in the Created state. Any
+ # attempt to invoke this operation while in that state shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ # - Application developers are not expected to call this operation directly;
+ # it exists for use by the RTC infrastructure.
+ #
+ # @return
+ #
+ # @endif
+ def finalize(self):
+ return OpenRTM_aist.RTObject_impl.finalize(self)
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC ¤¬¥ª¡¼¥Ê¡¼¤Ç¤¢¤ë ExecutionContext ¤ò
+ # Ää»ß¤µ¤»¡¢¤½¤Î¥³¥ó¥Æ¥ó¥Ä¤È¶¦¤Ë½ªÎ»¤µ¤»¤ë
+ #
+ # ¤³¤Î RTC ¤¬¥ª¡¼¥Ê¡¼¤Ç¤¢¤ë¤¹¤Ù¤Æ¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤òÄä»ß¤¹¤ë¡£
+ # ¤³¤Î RTC ¤¬Â¾¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤ò½êͤ¹¤ë RTC ¤Ë°¤¹¤ë¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È
+ # (i.e. ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤ò½êͤ¹¤ë RTC ¤Ï¤¹¤Ê¤ï¤Á¤½¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î
+ # ¥ª¡¼¥Ê¡¼¤Ç¤¢¤ë¡£)¤Ë»²²Ã¤·¤Æ¤¤¤ë¾ì¹ç¡¢Åö³º RTC ¤Ï¤½¤ì¤é¤Î¥³¥ó¥Æ¥¥¹¥È¾å
+ # ¤ÇÈó³èÀ²½¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ # RTC ¤¬¼Â¹ÔÃæ¤Î¤É¤Î ExecutionContext ¤Ç¤â Active ¾õÂ֤ǤϤʤ¯¤Ê¤Ã¤¿¸å¡¢
+ # ¤³¤Î RTC ¤È¤³¤ì¤Ë´Þ¤Þ¤ì¤ë RTC ¤¬½ªÎ»¤¹¤ë¡£
+ #
+ # À©Ìó
+ # - RTC ¤¬½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢½ªÎ»¤µ¤»¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£
+ # Created ¾õÂ֤ˤ¢¤ë RTC ¤Ë exit() ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¡¢
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤Ç¼ºÇÔ¤¹¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief Stop the RTC's execution context(s) and finalize it along with its
+ # contents.
+ #
+ # Any execution contexts for which the RTC is the owner shall be stopped.
+ # If the RTC participates in any execution contexts belonging to another
+ # RTC that contains it, directly or indirectly (i.e. the containing RTC
+ # is the owner of the ExecutionContext), it shall be deactivated in those
+ # contexts.
+ # After the RTC is no longer Active in any Running execution context, it
+ # and any RTCs contained transitively within it shall be finalized.
+ #
+ # Constraints
+ # - An RTC cannot be exited if it has not yet been initialized. Any
+ # attempt to exit an RTC that is in the Created state shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ #
+ # @return
+ #
+ # @endif
+ def exit(self):
+ return OpenRTM_aist.RTObject_impl.exit(self)
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC ¤¬ Alive ¾õÂ֤Ǥ¢¤ë¤«¤É¤¦¤«³Îǧ¤¹¤ë¡£
+ #
+ # RTC ¤¬»ØÄꤷ¤¿ ExecutionContext ¤ËÂФ·¤Æ Alive¾õÂ֤Ǥ¢¤ë¤«¤É¤¦¤«³Îǧ¤¹¤ë¡£
+ # RTC ¤Î¾õÂÖ¤¬ Active ¤Ç¤¢¤ë¤«¡¢Inactive ¤Ç¤¢¤ë¤«¡¢Error ¤Ç¤¢¤ë¤«¤Ï¼Â¹ÔÃæ¤Î
+ # ExecutionContext ¤Ë°Í¸¤¹¤ë¡£¤¹¤Ê¤ï¤Á¡¢¤¢¤ë ExecutionContext ¤ËÂФ·¤Æ¤Ï
+ # Active ¾õÂ֤Ǥ¢¤Ã¤Æ¤â¡¢Â¾¤Î ExecutionContext ¤ËÂФ·¤Æ¤Ï Inactive ¾õÂÖ¤È
+ # ¤Ê¤ë¾ì¹ç¤â¤¢¤ê¤¨¤ë¡£½¾¤Ã¤Æ¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï»ØÄꤵ¤ì¤¿
+ # ExecutionContext ¤ËÌ䤤¹ç¤ï¤»¤Æ¡¢¤³¤Î RTC ¤Î¾õÂÖ¤¬ Active¡¢Inactive¡¢
+ # Error ¤Î¾ì¹ç¤Ë¤Ï Alive ¾õÂ֤Ȥ·¤ÆÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @param exec_context ¼èÆÀÂÐ¾Ý ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @return Alive ¾õÂÖ³Îǧ·ë²Ì
+ #
+ # @else
+ #
+ # @brief Confirm whether RTC is an Alive state or NOT.
+ #
+ # A component is alive or not regardless of the execution context from
+ # which it is observed. However, whether or not it is Active, Inactive,
+ # or in Error is dependent on the execution context(s) in which it is
+ # running. That is, it may be Active in one context but Inactive in
+ # another. Therefore, this operation shall report whether this RTC is
+ # either Active, Inactive or in Error; which of those states a component
+ # is in with respect to a particular context may be queried from the
+ # context itself.
+ #
+ # @return Result of Alive state confirmation
+ #
+ # @endif
+ # virtual CORBA::Boolean is_alive(ExecutionContext_ptr exec_context)
+ def is_alive(self, exec_context):
+ return OpenRTM_aist.RTObject_impl.is_alive(self, exec_context)
+
+
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ½êͤ¹¤ë ExecutionContextList¤ò ¼èÆÀ¤¹¤ë
+ #
+ # ¤³¤Î RTC ¤¬½êͤ¹¤ë ExecutionContext ¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @return ExecutionContext ¥ê¥¹¥È
+ #
+ # @else
+ # @brief [CORBA interface] Get ExecutionContextList.
+ #
+ # This operation returns a list of all execution contexts owned by this
+ # RTC.
+ #
+ # @return ExecutionContext List
+ #
+ # @endif
+ # virtual ExecutionContextList* get_owned_contexts()
+ def get_owned_contexts(self):
+ return OpenRTM_aist.RTObject_impl.get_owned_contexts(self)
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤ò¼èÆÀ¤¹¤ë
+ #
+ # »ØÄꤷ¤¿¥Ï¥ó¥É¥ë¤Î ExecutionContext ¤ò¼èÆÀ¤¹¤ë¡£
+ # ¥Ï¥ó¥É¥ë¤«¤é ExecutionContext ¤Ø¤Î¥Þ¥Ã¥Ô¥ó¥°¤Ï¡¢ÆÃÄê¤Î RTC ¥¤¥ó¥¹¥¿¥ó¥¹¤Ë
+ # ¸ÇͤǤ¢¤ë¡£¥Ï¥ó¥É¥ë¤Ï¤³¤Î RTC ¤ò attach_context ¤·¤¿ºÝ¤Ë¼èÆÀ¤Ç¤¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¼èÆÀÂÐ¾Ý ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @return ExecutionContext
+ #
+ # @else
+ # @brief [CORBA interface] Get ExecutionContext.
+ #
+ # Obtain a reference to the execution context represented by the given
+ # handle.
+ # The mapping from handle to context is specific to a particular RTC
+ # instance. The given handle must have been obtained by a previous call to
+ # attach_context on this RTC.
+ #
+ # @param ec_id ExecutionContext handle
+ #
+ # @return ExecutionContext
+ #
+ # @endif
+ # virtual ExecutionContext_ptr get_context(UniqueId exec_handle)
+ def get_owned_contexts(self):
+ return OpenRTM_aist.RTObject_impl.get_owned_contexts(self)
+
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤ò¼èÆÀ¤¹¤ë
+ #
+ # »ØÄꤷ¤¿¥Ï¥ó¥É¥ë¤Î ExecutionContext ¤ò¼èÆÀ¤¹¤ë¡£
+ # ¥Ï¥ó¥É¥ë¤«¤é ExecutionContext ¤Ø¤Î¥Þ¥Ã¥Ô¥ó¥°¤Ï¡¢ÆÃÄê¤Î RTC ¥¤¥ó¥¹¥¿¥ó¥¹¤Ë
+ # ¸ÇͤǤ¢¤ë¡£¥Ï¥ó¥É¥ë¤Ï¤³¤Î RTC ¤ò attach_context ¤·¤¿ºÝ¤Ë¼èÆÀ¤Ç¤¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¼èÆÀÂÐ¾Ý ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @return ExecutionContext
+ #
+ # @else
+ # @brief [CORBA interface] Get ExecutionContext.
+ #
+ # Obtain a reference to the execution context represented by the given
+ # handle.
+ # The mapping from handle to context is specific to a particular RTC
+ # instance. The given handle must have been obtained by a previous call to
+ # attach_context on this RTC.
+ #
+ # @param ec_id ExecutionContext handle
+ #
+ # @return ExecutionContext
+ #
+ # @endif
+ # virtual ExecutionContext_ptr get_context(UniqueId exec_handle)
+ def get_context(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.get_context(self, ec_id)
+
+
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] »²²Ã¤·¤Æ¤¤¤ë ExecutionContextList ¤ò¼èÆÀ¤¹¤ë
+ #
+ # ¤³¤Î RTC ¤¬»²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @return ExecutionContext ¥ê¥¹¥È
+ #
+ # @else
+ # @brief [CORBA interface] Get participating ExecutionContextList.
+ #
+ # This operation returns a list of all execution contexts in
+ # which this RTC participates.
+ #
+ # @return ExecutionContext List
+ #
+ # @endif
+ # virtual ExecutionContextList* get_participating_contexts()
+ def get_participating_contexts(self):
+ return OpenRTM_aist.RTObject_impl.get_participating_contexts(self)
+
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext ¤Î¥Ï¥ó¥É¥ë¤òÊÖ¤¹
+ #
+ # @param ExecutionContext ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È
+ #
+ # @return ExecutionContextHandle
+ #
+ # Í¿¤¨¤é¤ì¤¿¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥Ï¥ó¥É¥ë¤òÊÖ¤¹¡£
+ #
+ # @else
+ # @brief [CORBA interface] Return a handle of a ExecutionContext
+ #
+ # @param ExecutionContext
+ #
+ # @return ExecutionContextHandle
+ #
+ # This operation returns a handle that is associated with the given
+ # execution context.
+ #
+ # @endif
+ #
+ # virtual ExecutionContextHandle_t
+ # get_context_handle(ExecutionContext_ptr cxt)
+ def get_context_handle(self, cxt):
+ return OpenRTM_aist.RTObject_impl.get_context_handle(self, cxt)
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [RTObject CORBA interface] ¥³¥ó¥Ý¡¼¥Í¥ó¥È¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+ #
+ # Åö³º¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¾ðÊó¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥³¥ó¥Ý¡¼¥Í¥ó¥È¥×¥í¥Õ¥¡¥¤¥ë
+ #
+ # @else
+ #
+ # @brief [RTObject CORBA interface] Get RTC's profile
+ #
+ # This operation returns the ComponentProfile of the RTC
+ #
+ # @return ComponentProfile
+ #
+ # @endif
+ # virtual ComponentProfile* get_component_profile()
+ def get_component_profile(self):
+ return OpenRTM_aist.RTObject_impl.get_component_profile(self)
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [RTObject CORBA interface] ¥Ý¡¼¥È¤ò¼èÆÀ¤¹¤ë
+ #
+ # Åö³º¥³¥ó¥Ý¡¼¥Í¥ó¥È¤¬ÊÝͤ¹¤ë¥Ý¡¼¥È¤Î»²¾È¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥Ý¡¼¥È¥ê¥¹¥È
+ #
+ # @else
+ #
+ # @brief [RTObject CORBA interface] Get Ports
+ #
+ # This operation returns a list of the RTCs ports.
+ #
+ # @return PortList
+ #
+ # @endif
+ # virtual PortServiceList* get_ports()
+ def get_ports(self):
+ return OpenRTM_aist.RTObject_impl.get_ports(self)
+
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤òattach¤¹¤ë
+ #
+ # »ØÄꤷ¤¿ ExecutionContext ¤Ë¤³¤Î RTC ¤ò½ê°¤µ¤»¤ë¡£¤³¤Î RTC ¤È´ØÏ¢¤¹¤ë
+ # ExecutionContext ¤Î¥Ï¥ó¥É¥ë¤òÊÖ¤¹¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢ExecutionContextOperations::add_component ¤¬¸Æ¤Ð¤ì¤¿
+ # ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£ÊÖ¤µ¤ì¤¿¥Ï¥ó¥É¥ë¤Ï¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤Ç»ÈÍѤ¹¤ë¤³¤È¤òÁÛÄê
+ # ¤·¤Æ¤¤¤Ê¤¤¡£
+ #
+ # @param self
+ # @param exec_context ½ê°Àè ExecutionContext
+ #
+ # @return ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @else
+ # @brief [CORBA interface] Attach ExecutionContext.
+ #
+ # Inform this RTC that it is participating in the given execution context.
+ # Return a handle that represents the association of this RTC with the
+ # context.
+ # This operation is intended to be invoked by
+ # ExecutionContextOperations::add_component. It is not intended for use by
+ # other clients.
+ #
+ # @param exec_context Prticipating ExecutionContext
+ #
+ # @return ExecutionContext Handle
+ #
+ # @endif
+ # UniqueId attach_context(ExecutionContext_ptr exec_context)
+ def attach_context(self, exec_context):
+ return OpenRTM_aist.RTObject_impl.attach_context(self, exec_context)
+
+
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤òdetach¤¹¤ë
+ #
+ # »ØÄꤷ¤¿ ExecutionContext ¤«¤é¤³¤Î RTC ¤Î½ê°¤ò²ò½ü¤¹¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢ExecutionContextOperations::remove_component ¤¬¸Æ¤Ð
+ # ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£ÊÖ¤µ¤ì¤¿¥Ï¥ó¥É¥ë¤Ï¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤Ç»ÈÍѤ¹¤ë¤³¤È¤ò
+ # ÁÛÄꤷ¤Æ¤¤¤Ê¤¤¡£
+ #
+ # À©Ìó
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Ë RTC ¤¬¤¹¤Ç¤Ë½ê°¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤¬ÊÖ¤µ¤ì¤ë¡£
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Ë¤¿¤·¤¤¤ÆÂФ·¤Æ RTC ¤¬Active ¾õÂ֤Ǥ¢¤ë¾ì
+ # ¹ç¤Ë¤Ï¡¢ ReturnCode_t::PRECONDITION_NOT_MET ¤¬ÊÖ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ²ò½üÂÐ¾Ý ExecutionContext¥Ï¥ó¥É¥ë
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ # @brief [CORBA interface] Attach ExecutionContext.
+ #
+ # Inform this RTC that it is no longer participating in the given execution
+ # context.
+ # This operation is intended to be invoked by
+ # ExecutionContextOperations::remove_component. It is not intended for use
+ # by other clients.
+ # Constraints
+ # - This operation may not be invoked if this RTC is not already
+ # participating in the execution context. Such a call shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ # - This operation may not be invoked if this RTC is Active in the indicated
+ # execution context. Otherwise, it shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ #
+ # @param ec_id Dettaching ExecutionContext Handle
+ #
+ # @return
+ #
+ # @endif
+ # ReturnCode_t detach_context(UniqueId exec_handle)
+ def detach_context(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.detach_context(self, ec_id)
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î½é´ü²½
+ #
+ # RTC ¤¬½é´ü²½¤µ¤ì¡¢Alive ¾õÂÖ¤ËÁ«°Ü¤¹¤ë¡£
+ # RTC ¸Çͤνé´ü²½½èÍý¤Ï¤³¤³¤Ç¼Â¹Ô¤¹¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onInitialize() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Initialize RTC
+ #
+ # The RTC has been initialized and entered the Alive state.
+ # Any RTC-specific initialization logic should be performed here.
+ #
+ # @return
+ #
+ # @endif
+ def on_initialize(self):
+ return OpenRTM_aist.RTObject_impl.on_initialize(self)
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î½ªÎ»
+ #
+ # RTC ¤¬ÇË´þ¤µ¤ì¤ë¡£
+ # RTC ¸ÇͤνªÎ»½èÍý¤Ï¤³¤³¤Ç¼Â¹Ô¤¹¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onFinalize() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Finalize RTC
+ #
+ # The RTC is being destroyed.
+ # Any final RTC-specific tear-down logic should be performed here.
+ #
+ # @return
+ #
+ # @endif
+ def on_finalize(self):
+ return OpenRTM_aist.RTObject_impl.on_finalize(self)
+
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î³«»Ï
+ #
+ # RTC ¤¬½ê°¤¹¤ë ExecutionContext ¤¬ Stopped ¾õÂÖ¤«¤é Running ¾õÂÖ¤ØÁ«°Ü
+ # ¤·¤¿¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onStartup() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¾õÂÖÁ«°Ü¤·¤¿ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] StartUp RTC
+ #
+ # The given execution context, in which the RTC is participating, has
+ # transitioned from Stopped to Running.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_startup(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_startup(self, ec_id)
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤ÎÄä»ß
+ #
+ # RTC ¤¬½ê°¤¹¤ë ExecutionContext ¤¬ Running ¾õÂÖ¤«¤é Stopped ¾õÂÖ¤ØÁ«°Ü
+ # ¤·¤¿¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onShutdown() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¾õÂÖÁ«°Ü¤·¤¿ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] ShutDown RTC
+ #
+ # The given execution context, in which the RTC is participating, has
+ # transitioned from Running to Stopped.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_shutdown(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_shutdown(self, ec_id)
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î³èÀ²½
+ #
+ # ½ê°¤¹¤ë ExecutionContext ¤«¤é RTC ¤¬³èÀ²½¤µ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onActivated() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ³èÀ²½ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Activate RTC
+ #
+ # The RTC has been activated in the given execution context.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_activated(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_activated(self, ec_id)
+
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤ÎÈó³èÀ²½
+ #
+ # ½ê°¤¹¤ë ExecutionContext ¤«¤é RTC ¤¬Èó³èÀ²½¤µ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onDeactivated() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id Èó³èÀ²½ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Deactivate RTC
+ #
+ # The RTC has been deactivated in the given execution context.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_deactivated(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_deactivated(self, ec_id)
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î¥¨¥é¡¼½èÍý
+ #
+ # RTC ¤¬¥¨¥é¡¼¾õÂ֤ˤ¤¤ëºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # RTC ¤¬¥¨¥é¡¼¾õÂ֤ξì¹ç¤Ë¡¢ÂоݤȤʤë ExecutionContext ¤ÎExecutionKind ¤Ë
+ # ±þ¤¸¤¿¥¿¥¤¥ß¥ó¥°¤Ç¸Æ¤Ó½Ð¤µ¤ì¤ë¡£Î㤨¤Ð¡¢
+ # - ExecutionKind ¤¬ PERIODIC ¤Î¾ì¹ç¡¢ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï
+ # DataFlowComponentAction::on_execute ¤È on_state_update ¤ÎÂؤï¤ê¤Ë¡¢
+ # ÀßÄꤵ¤ì¤¿½çÈÖ¡¢ÀßÄꤵ¤ì¤¿¼þ´ü¤Ç¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # - ExecutionKind ¤¬ EVENT_DRIVEN ¤Î¾ì¹ç¡¢ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï
+ # FsmParticipantAction::on_action ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¡¢Âؤï¤ê¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onError() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ó½Ð
+ # ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Error Processing of RTC
+ #
+ # The RTC remains in the Error state.
+ # If the RTC is in the Error state relative to some execution context when
+ # it would otherwise be invoked from that context (according to the
+ # context¡Çs ExecutionKind), this callback shall be invoked instead.
+ # For example,
+ # - If the ExecutionKind is PERIODIC, this operation shall be invoked in
+ # sorted order at the rate of the context instead of
+ # DataFlowComponentAction::on_execute and on_state_update.
+ # - If the ExecutionKind is EVENT_DRIVEN, this operation shall be invoked
+ # whenever FsmParticipantAction::on_action would otherwise have been
+ # invoked.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_error(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_error(self, ec_id)
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î¥¨¥é¡¼¾õÂ֤ؤÎÁ«°Ü
+ #
+ # RTC ¤¬½ê°¤¹¤ë ExecutionContext ¤¬ Active ¾õÂÖ¤«¤é Error ¾õÂÖ¤ØÁ«°Ü¤·¤¿
+ # ¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï RTC ¤¬ Error ¾õÂÖ¤ËÁ«°Ü¤·¤¿ºÝ¤Ë°ìÅÙ¤À¤±¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onAborting() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¾õÂÖÁ«°Ü¤·¤¿ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Transition Error State
+ #
+ # The RTC is transitioning from the Active state to the Error state in some
+ # execution context.
+ # This callback is invoked only a single time for time that the RTC
+ # transitions into the Error state from another state. This behavior is in
+ # contrast to that of on_error.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_aborting(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_aborting(self, ec_id)
+
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î¥ê¥»¥Ã¥È
+ #
+ # Error ¾õÂ֤ˤ¢¤ë RTC ¤Î¥ê¥«¥Ð¥ê½èÍý¤ò¼Â¹Ô¤·¡¢Inactive ¾õÂÖ¤ËÉüµ¢¤µ¤»¤ë
+ # ¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # RTC ¤Î¥ê¥«¥Ð¥ê½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¤Ï Inactive ¾õÂÖ¤ËÉüµ¢¤¹¤ë¤¬¡¢¤½¤ì°Ê³°¤Î
+ # ¾ì¹ç¤Ë¤Ï Error ¾õÂÖ¤Ëα¤Þ¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onReset() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ó
+ # ½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¥ê¥»¥Ã¥ÈÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Resetting RTC
+ #
+ # The RTC is in the Error state. An attempt is being made to recover it such
+ # that it can return to the Inactive state.
+ # If the RTC was successfully recovered and can safely return to the
+ # Inactive state, this method shall complete with ReturnCode_t::OK. Any
+ # other result shall indicate that the RTC should remain in the Error state.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_reset(self, ec_id):
+ return OpenRTM_aist.RTObject_impl.on_reset(self, ec_id)
+
+
+
+
+ ##
+ # @if jp
+ # @brief
+ #
+ #
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @brief Consructor
+ #
+ #
+ # @endif
+ def on_action(self, ec_id):
+ return RTC.RTC_OK
\ No newline at end of file
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmActionListener.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmActionListener.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmActionListener.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,1599 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file FsmActionListener.py
+# @brief FSM Action listener class
+# @date $Date$
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+#
+# $Id$
+#
+
+import OpenRTM_aist
+import threading
+import OpenRTM_aist.Guard
+
+##
+# @if jp
+# @brief
+#
+# FSM¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ë´Ø¤¹¤ë¼ï¡¹¤Î¿¶¤ëÉñ¤¤¤ò¥Õ¥Ã¥¯¤¹¤ë¤¿¤á¤Î¥ê¥¹¥ÊÄê
+# µÁ¡£¥ê¥¹¥Ê¤Ë¤ÏÂ礤¯Ê¬¤±¤ë¤È¡¢
+#
+# - FSM¤½¤Î¤â¤Î¤ÎÆ°ºî¤ò¥Õ¥Ã¥¯¤¹¤ë¤¿¤á¤Î¥ê¥¹¥Ê
+# - FSM¤Ë´Ø¤¹¤ë¥á¥¿¥Ç¡¼¥¿Êѹ¹Åù¤ÎÆ°ºî¤ò¥Õ¥Ã¥¯¤¹¤ë¤¿¤á¤Î¥ê¥¹¥Ê
+#
+# ¤Î2¼ïÎà¤Ëʬ¤±¤é¤ì¤ë¡£¤µ¤é¤ËÁ°¼Ô¤Ï¡¢FSM¤Î¾õÂÖÁ«°ÜÅù¤Î¥¢¥¯¥·¥ç¥ó¤ÎÁ°
+# ¸å¤½¤ì¤¾¤ì¤ò¥Õ¥Ã¥¯¤¹¤ë¤¿¤á¤Î PreFsmActionListener ¤È
+# PostFsmActionListener ¤ÎÆó¤Ä¤¬¤¢¤ê¡¢¸å¼Ô¤Ï¡¢FSM¤ÎProfile¤ÎÊѹ¹¤ò¥Õ¥Ã
+# ¥¯¤¹¤ë FsmProfileListener ¤È FSM¤Î¹½Â¤ (Structure) ¤ÎÊѹ¹¤ò¥Õ¥Ã¥¯
+# ¤¹¤ë FsmStructureListener ¤ÎÆó¤Ä¤Ëʬ¤±¤é¤ì¤ë¡£°Ê¾å¡¢°Ê²¼¤ÎFSM¤Ë´Ø
+# ¤¹¤ë°Ê²¼¤Î4¼ïÎà¤Î¥ê¥¹¥Ê¡¼¥¯¥é¥¹·²¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¡£
+#
+# - PreFsmActionListener
+# - PostFsmActionListener
+# - FsmProfileListner
+# - FsmStructureListener
+#
+#
+# @else
+#
+#
+# @endif
+#
+
+##
+# @if jp
+# @brief PreFsmActionListener ¤Î¥¿¥¤¥×
+#
+# PreFsmActionListener ¤Ë¤Ï°Ê²¼¤Î¥Õ¥Ã¥¯¥Ý¥¤¥ó¥È¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤³
+# ¤ì¤é¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤«¤É¤¦¤«¤Ï¡¢FSM¤Î¼ÂÁõ¤Ë°Í¸¤¹¤ë¡£
+#
+# - PRE_ON_INIT: init ľÁ°
+# - PRE_ON_ENTRY: entry ľÁ°
+# - PRE_ON_DO: do ľÁ°
+# - PRE_ON_EXIT: exit ľÁ°
+# - PRE_ON_STATE_CHANGE: ¾õÂÖÁ«°ÜľÁ°
+#
+# @else
+# @brief The types of ConnectorDataListener
+#
+# PreFsmActionListener has the following hook points. If these
+# listeners are actually called or not called are depends on FSM
+# implementations.
+#
+# - PRE_ON_INIT: just before "init" action
+# - PRE_ON_ENTRY: just before "entry" action
+# - PRE_ON_DO: just before "do" action
+# - PRE_ON_EXIT: just before "exit" action
+# - PRE_ON_STATE_CHANGE: just before state transition action
+#
+# @endif
+#
+class PreFsmActionListenerType:
+ """
+ """
+
+ def __init__(self):
+ pass
+ PRE_ON_INIT = 0
+ PRE_ON_ENTRY = 1
+ PRE_ON_DO = 2
+ PRE_ON_EXIT = 3
+ PRE_ON_STATE_CHANGE = 4
+ PRE_FSM_ACTION_LISTENER_NUM = 5
+
+
+##
+# @if jp
+# @class PreFsmActionListener ¥¯¥é¥¹
+# @brief PreFsmActionListener ¥¯¥é¥¹
+#
+# PreFsmActionListener ¥¯¥é¥¹¤Ï¡¢Fsm¤Î¥¢¥¯¥·¥ç¥ó¤Ë´Ø¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+# ¤ò¼Â¸½¤¹¤ë¥ê¥¹¥Ê¡¼¥ª¥Ö¥¸¥§¥¯¥È¤Î´ðÄ쥯¥é¥¹¤Ç¤¢¤ë¡£FSM¤Î¥¢¥¯¥·¥ç¥ó
+# ¤ÎľÁ°¤ÎÆ°ºî¤ò¥Õ¥Ã¥¯¤·¤¿¤¤¾ì¹ç¡¢°Ê²¼¤ÎÎã¤Î¤è¤¦¤Ë¡¢¤³¤Î¥¯¥é¥¹¤ò·Ñ¾µ
+# ¤·¤¿¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢Å¬Àڤʥ³¡¼¥ë¥Ð¥Ã¥¯ÀßÄê´Ø¿ô¤«
+# ¤éRTObject¤ËÂФ·¤Æ¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã¥È¤¹¤ëɬÍפ¬¤¢¤ë¡£
+#
+# <pre>
+# class MyListener
+# : public PreFsmActionListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+#
+# virtual void operator()(const char* state_name)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# std::cout << "Current state: " state_name << std::endl;
+# };
+# };
+# </pre>
+#
+# ¤³¤Î¤è¤¦¤Ë¤·¤ÆÄêµÁ¤µ¤ì¤¿¥ê¥¹¥Ê¥¯¥é¥¹¤Ï¡¢°Ê²¼¤Î¤è¤¦¤ËRTObject¤ËÂФ·
+# ¤Æ¡¢¥»¥Ã¥È¤µ¤ì¤ë¡£
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addPreFsmActionListener(PRE_ON_STATE_CHANGE,
+# new MyListener("init listener"),
+# true);
+# :
+# </pre>
+#
+# Âè1°ú¿ô¤Î "PRE_ON_STATE_CHANGE" ¤Ï¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò¥Õ¥Ã¥¯¤¹¤ë¥Ý¥¤¥ó
+# ¥È¤Ç¤¢¤ê¡¢°Ê²¼¤ÎÃͤò¼è¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¤Ê¤ª¡¢¤¹¤Ù¤Æ¤Î¥³¡¼¥ë¥Ð¥Ã
+# ¥¯¥Ý¥¤¥ó¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤È¤Ï¸Â¤é¤º¡¢¤³¤ì¤é¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤«¤É¤¦¤«
+# ¤Ï¡¢FSM¤Î¼ÂÁõ¤Ë°Í¸¤¹¤ë¡£
+#
+# - PRE_ON_INIT: init ľÁ°
+# - PRE_ON_ENTRY: entry ľÁ°
+# - PRE_ON_DO: do ľÁ°
+# - PRE_ON_EXIT: exit ľÁ°
+# - PRE_ON_STATE_CHANGE: ¾õÂÖÁ«°ÜľÁ°
+#
+# Âè2°ú¿ô¤Ï¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Âè3°ú¿ô¤Ï¥ª¥Ö¥¸¥§¥¯¥È
+# ¼«Æ°ºï½ü¥Õ¥é¥°¤Ç¤¢¤ê¡¢true ¤Î¾ì¹ç¤Ï¡¢RTObjectºï½ü»þ¤Ë¼«Æ°Åª¤Ë¥ê¥¹
+# ¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤¬ºï½ü¤µ¤ì¤ë¡£false¤Î¾ì¹ç¤Ï¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+# ¸Æ¤Ó½Ð¤·Â¦¤Ë»Ä¤ê¡¢ºï½ü¤Ï¸Æ¤Ó½Ð¤·Â¦¤ÎÀÕǤ¤Ç¹Ô¤ï¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+# RTObject ¤Î¥é¥¤¥Õ¥µ¥¤¥¯¥ëÃæ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤¬É¬Íפʤé¤Ð¾åµ¤Î¤è¤¦¤Ê
+# ¸Æ¤Ó½Ð¤·Êý¤ÇÂè3°ú¿ô¤ò true ¤È¤·¤Æ¤ª¤¯¤È¤è¤¤¡£µÕ¤Ë¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò
+# ¾õ¶·Åù¤Ë±þ¤¸¤Æ¥»¥Ã¥È¤·¤¿¤ê¥¢¥ó¥»¥Ã¥È¤·¤¿¤ê¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ï
+# false¤È¤·¤ÆÃÖ¤¡¢¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤ò¥á¥ó¥ÐÊÑ¿ô¤Ê¤É¤ËÊÝ
+# »ý¤·¤Æ¤ª¤¡¢
+# RTObject_impl::addPreFsmActionListener()/removePreFsmActionListener()
+# ¤Ë¤è¤ê¡¢¥»¥Ã¥È¤È¥¢¥ó¥»¥Ã¥È¤ò´ÉÍý¤¹¤ë¤È¤¤¤Ã¤¿»È¤¤Êý¤â²Äǽ¤Ç¤¢¤ë¡£
+#
+# @else
+# @class PreFsmActionListener class
+# @brief PreFsmActionListener class
+#
+# PreFsmActionListener class is a base class for the listener
+# objects which realize callback to hook FSM related pre-actions.
+# To hook execution just before a FSM action, the callback object
+# should be defined as follows, and set to RTObject through
+# appropriate callback set function.
+#
+# <pre>
+# class MyListener
+# : public PreFsmActionListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+#
+# virtual void operator()(const char* state_name)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# std::cout << "Current state: " state_name << std::endl;
+# };
+# };
+# </pre>
+#
+# The listener class defined above is set to RTObject as follows.
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addPreFsmActionListener(PRE_ON_STATE_CHANGE,
+# new MyListener("init listener"),
+# true);
+# :
+# </pre>
+#
+# The first argument "PRE_ON_STATE_CHANGE" specifies callback hook
+# point, and the following values are available. Not all the
+# callback points are implemented. It depends on the FSM
+# implementations.
+#
+# - PRE_ON_INIT: just before "init" action
+# - PRE_ON_ENTRY: just before "entry" action
+# - PRE_ON_DO: just before "do" action
+# - PRE_ON_EXIT: just before "exit" action
+# - PRE_ON_STATE_CHANGE: just before state transition action
+#
+# The second argument is a pointers to the listener object. The
+# third argument is a flag for automatic object destruction. When
+# "true" is given to the third argument, the given object in second
+# argument is automatically destructed with RTObject. In the "false
+# " case, the ownership of the object is left in the caller side,
+# and then destruction of the object must be done by users'
+# responsibility.
+#
+# It is good for setting "true" as third argument, if the listener
+# object life span is equals to the RTObject's life cycle. On the
+# otehr hand, if callbacks are required to set/unset depending on
+# its situation, the third argument could be "false". In that
+# case, listener objects pointers must be stored to member
+# variables, and set/unset of the listener objects shoud be
+# paerformed throguh
+# RTObject_impl::addPreFsmActionListener()/removePreFsmActionListener()
+# functions.
+#
+# @endif
+#
+class PreFsmActionListener:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ pass
+
+
+ ##
+ # @if jp
+ #
+ # @brief ²¾ÁÛ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # PreFsmActionListener ¤Î¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # @else
+ #
+ # @brief Virtual Callback function
+ #
+ # This is a the Callback function for PreFsmActionListener.
+ #
+ # @endif
+ # virtual void operator()(const char*) = 0;
+ def __call__(self, state):
+ pass
+
+ ##
+ # @if jp
+ #
+ # @brief PreFsmActionListenerType ¤òʸ»úÎó¤ËÊÑ´¹
+ #
+ # PreFsmActionListenerType ¤òʸ»úÎó¤ËÊÑ´¹¤¹¤ë
+ #
+ # @param type ÊÑ´¹ÂÐ¾Ý PreFsmActionListenerType
+ #
+ # @return ʸ»úÎóÊÑ´¹·ë²Ì
+ #
+ # @else
+ #
+ # @brief Convert PreFsmActionListenerType into the string.
+ #
+ # Convert PreFsmActionListenerType into the string.
+ #
+ # @param type The target PreFsmActionListenerType for transformation
+ #
+ # @return Trnasformation result of string representation
+ #
+ # @endif
+ #
+ def toString(type):
+ typeString = ["PRE_ON_INIT",
+ "PRE_ON_ENTRY",
+ "PRE_ON_DO",
+ "PRE_ON_EXIT",
+ "PRE_ON_STATE_CHANGE",
+ "PRE_FSM_ACTION_LISTENER_NUM"]
+ if type < PreFsmActionListenerType.PRE_FSM_ACTION_LISTENER_NUM:
+ return typeString[type]
+
+ return ""
+ toString = staticmethod(toString)
+
+
+
+##
+# @if jp
+# @brief PreFsmActionListener ¤Î¥¿¥¤¥×
+#
+# PreFsmActionListener ¤Ë¤Ï°Ê²¼¤Î¥Õ¥Ã¥¯¥Ý¥¤¥ó¥È¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤³
+# ¤ì¤é¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤«¤É¤¦¤«¤Ï¡¢FSM¤Î¼ÂÁõ¤Ë°Í¸¤¹¤ë¡£
+#
+# - POST_ON_INIT: init ľ¸å
+# - POST_ON_ENTRY: entry ľ¸å
+# - POST_ON_DO: do ľ¸å
+# - POST_ON_EXIT: exit ľ¸å
+# - POST_ON_STATE_CHANGE: ¾õÂÖÁ«°Üľ¸å
+#
+# @else
+# @brief The types of ConnectorDataListener
+#
+# PreFsmActionListener has the following hook points. If these
+# listeners are actually called or not called are depends on FSM
+# implementations.
+#
+# - POST_ON_INIT: just after "init" action
+# - POST_ON_ENTRY: just after "entry" action
+# - POST_ON_DO: just after "do" action
+# - POST_ON_EXIT: just after "exit" action
+# - POST_ON_STATE_CHANGE: just after state transition action
+#
+# @endif
+#
+class PostFsmActionListenerType:
+ """
+ """
+
+ def __init__(self):
+ pass
+ POST_ON_INIT = 0
+ POST_ON_ENTRY = 1
+ POST_ON_DO = 2
+ POST_ON_EXIT = 3
+ POST_ON_STATE_CHANGE = 4
+ POST_FSM_ACTION_LISTENER_NUM = 5
+
+
+
+
+##
+# @if jp
+# @class PostFsmActionListener ¥¯¥é¥¹
+# @brief PostFsmActionListener ¥¯¥é¥¹
+#
+# PostFsmActionListener ¥¯¥é¥¹¤Ï¡¢Fsm¤Î¥¢¥¯¥·¥ç¥ó¤Ë´Ø¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+# ¤ò¼Â¸½¤¹¤ë¥ê¥¹¥Ê¡¼¥ª¥Ö¥¸¥§¥¯¥È¤Î´ðÄ쥯¥é¥¹¤Ç¤¢¤ë¡£FSM¤Î¥¢¥¯¥·¥ç¥ó
+# ¤Îľ¸å¤ÎÆ°ºî¤ò¥Õ¥Ã¥¯¤·¤¿¤¤¾ì¹ç¡¢°Ê²¼¤ÎÎã¤Î¤è¤¦¤Ë¡¢¤³¤Î¥¯¥é¥¹¤ò·Ñ¾µ
+# ¤·¤¿¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢Å¬Àڤʥ³¡¼¥ë¥Ð¥Ã¥¯ÀßÄê´Ø¿ô¤«
+# ¤éRTObject¤ËÂФ·¤Æ¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã¥È¤¹¤ëɬÍפ¬¤¢¤ë¡£
+#
+# <pre>
+# class MyListener
+# : public PostFsmActionListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+#
+# virtual void operator()(const char* state_name, ReturnCode_t ret)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# std::cout << "Current state: " state_name << std::endl;
+# };
+# };
+# </pre>
+#
+# ¤³¤Î¤è¤¦¤Ë¤·¤ÆÄêµÁ¤µ¤ì¤¿¥ê¥¹¥Ê¥¯¥é¥¹¤Ï¡¢°Ê²¼¤Î¤è¤¦¤ËRTObject¤ËÂФ·
+# ¤Æ¡¢¥»¥Ã¥È¤µ¤ì¤ë¡£
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addPostFsmActionListener(POST_ON_STATE_CHANGE,
+# new MyListener("init listener"),
+# true);
+# :
+# </pre>
+#
+# Âè1°ú¿ô¤Î "POST_ON_STATE_CHANGE" ¤Ï¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò¥Õ¥Ã¥¯¤¹¤ë¥Ý¥¤¥ó
+# ¥È¤Ç¤¢¤ê¡¢°Ê²¼¤ÎÃͤò¼è¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¤Ê¤ª¡¢¤¹¤Ù¤Æ¤Î¥³¡¼¥ë¥Ð¥Ã
+# ¥¯¥Ý¥¤¥ó¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤È¤Ï¸Â¤é¤º¡¢¤³¤ì¤é¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤«¤É¤¦¤«
+# ¤Ï¡¢FSM¤Î¼ÂÁõ¤Ë°Í¸¤¹¤ë¡£
+#
+# - POST_ON_INIT: init ľ¸å
+# - POST_ON_ENTRY: entry ľ¸å
+# - POST_ON_DO: do ľ¸å
+# - POST_ON_EXIT: exit ľ¸å
+# - POST_ON_STATE_CHANGE: ¾õÂÖÁ«°Üľ¸å
+#
+# Âè2°ú¿ô¤Ï¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Âè3°ú¿ô¤Ï¥ª¥Ö¥¸¥§¥¯¥È
+# ¼«Æ°ºï½ü¥Õ¥é¥°¤Ç¤¢¤ê¡¢true ¤Î¾ì¹ç¤Ï¡¢RTObjectºï½ü»þ¤Ë¼«Æ°Åª¤Ë¥ê¥¹
+# ¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤¬ºï½ü¤µ¤ì¤ë¡£false¤Î¾ì¹ç¤Ï¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+# ¸Æ¤Ó½Ð¤·Â¦¤Ë»Ä¤ê¡¢ºï½ü¤Ï¸Æ¤Ó½Ð¤·Â¦¤ÎÀÕǤ¤Ç¹Ô¤ï¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+# RTObject ¤Î¥é¥¤¥Õ¥µ¥¤¥¯¥ëÃæ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤¬É¬Íפʤé¤Ð¾åµ¤Î¤è¤¦¤Ê
+# ¸Æ¤Ó½Ð¤·Êý¤ÇÂè3°ú¿ô¤ò true ¤È¤·¤Æ¤ª¤¯¤È¤è¤¤¡£µÕ¤Ë¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò
+# ¾õ¶·Åù¤Ë±þ¤¸¤Æ¥»¥Ã¥È¤·¤¿¤ê¥¢¥ó¥»¥Ã¥È¤·¤¿¤ê¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ï
+# false¤È¤·¤ÆÃÖ¤¡¢¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤ò¥á¥ó¥ÐÊÑ¿ô¤Ê¤É¤ËÊÝ
+# »ý¤·¤Æ¤ª¤¡¢
+# RTObject_impl::addPostFsmActionListener()/removePostFsmActionListener()
+# ¤Ë¤è¤ê¡¢¥»¥Ã¥È¤È¥¢¥ó¥»¥Ã¥È¤ò´ÉÍý¤¹¤ë¤È¤¤¤Ã¤¿»È¤¤Êý¤â²Äǽ¤Ç¤¢¤ë¡£
+#
+# @else
+# @class PostFsmActionListener class
+# @brief PostFsmActionListener class
+#
+# PostFsmActionListener class is a base class for the listener
+# objects which realize callback to hook FSM related post-actions.
+# To hook execution just before a FSM action, the callback object
+# should be defined as follows, and set to RTObject through
+# appropriate callback set function.
+#
+# <pre>
+# class MyListener
+# : public PostFsmActionListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+#
+# virtual void operator()(const char* state_name, ReturnCode\t ret)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# std::cout << "Current state: " state_name << std::endl;
+# };
+# };
+# </pre>
+#
+# The listener class defined above is set to RTObject as follows.
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addPostFsmActionListener(POST_ON_STATE_CHANGE,
+# new MyListener("init listener"),
+# true);
+# :
+# </pre>
+#
+# The first argument "POST_ON_STATE_CHANGE" specifies callback hook
+# point, and the following values are available. Not all the
+# callback points are implemented. It depends on the FSM
+# implementations.
+#
+# - POST_ON_INIT: just after "init" action
+# - POST_ON_ENTRY: just after "entry" action
+# - POST_ON_DO: just after "do" action
+# - POST_ON_EXIT: just after "exit" action
+# - POST_ON_STATE_CHANGE: just after state transition action
+#
+# The second argument is a pointers to the listener object. The
+# third argument is a flag for automatic object destruction. When
+# "true" is given to the third argument, the given object in second
+# argument is automatically destructed with RTObject. In the "false
+# " case, the ownership of the object is left in the caller side,
+# and then destruction of the object must be done by users'
+# responsibility.
+#
+# It is good for setting "true" as third argument, if the listener
+# object life span is equals to the RTObject's life cycle. On the
+# otehr hand, if callbacks are required to set/unset depending on
+# its situation, the third argument could be "false". In that
+# case, listener objects pointers must be stored to member
+# variables, and set/unset of the listener objects shoud be
+# paerformed throguh
+# RTObject_impl::addPostFsmActionListener()/removePostFsmActionListener()
+# functions.
+#
+# @endif
+#
+class PostFsmActionListener:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ pass
+
+
+ ##
+ # @if jp
+ #
+ # @brief ²¾ÁÛ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # PostFsmActionListener ¤Î¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # @else
+ #
+ # @brief Virtual Callback function
+ #
+ # This is a the Callback function for PostFsmActionListener.
+ #
+ # @endif
+ # virtual void operator()(const char* state, ReturnCode_t ret) = 0;
+ def __call__(self, state, ret):
+ pass
+
+ ##
+ # @if jp
+ #
+ # @brief PostFsmActionListenerType ¤òʸ»úÎó¤ËÊÑ´¹
+ #
+ # PostFsmActionListenerType ¤òʸ»úÎó¤ËÊÑ´¹¤¹¤ë
+ #
+ # @param type ÊÑ´¹ÂÐ¾Ý PostFsmActionListenerType
+ #
+ # @return ʸ»úÎóÊÑ´¹·ë²Ì
+ #
+ # @else
+ #
+ # @brief Convert PostFsmActionListenerType into the string.
+ #
+ # Convert PostFsmActionListenerType into the string.
+ #
+ # @param type The target PostFsmActionListenerType for transformation
+ #
+ # @return Trnasformation result of string representation
+ #
+ # @endif
+ #
+ def toString(type):
+ typeString = ["POST_ON_INIT",
+ "POST_ON_ENTRY",
+ "POST_ON_DO",
+ "POST_ON_EXIT",
+ "POST_ON_STATE_CHANGE",
+ "POST_FSM_ACTION_LISTENER_NUM"]
+ if type < PostFsmActionListenerType.POST_FSM_ACTION_LISTENER_NUM:
+ return typeString[type]
+
+ return ""
+ toString = staticmethod(toString)
+
+
+
+##
+# @if jp
+# @brief FsmProfileListener ¤Î¥¿¥¤¥×
+#
+# - SET_FSM_PROFILE : FSM ProfileÀßÄê»þ
+# - GET_FSM_PROFILE : FSM Profile¼èÆÀ»þ
+# - ADD_FSM_STATE : FSM¤ËState¤¬Äɲ䵤줿
+# - REMOVE_FSM_STATE : FSM¤«¤éState¤¬ºï½ü¤µ¤ì¤¿
+# - ADD_FSM_TRANSITION : FSM¤ËÁ«°Ü¤¬Äɲ䵤줿
+# - REMOVE_FSM_TRANSITION : FSM¤«¤éÁ«°Ü¤¬ºï½ü¤µ¤ì¤¿
+# - BIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+# - UNBIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥¢¥ó¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+#
+# @else
+# @brief The types of FsmProfileListener
+#
+# - SET_FSM_PROFILE : Setting FSM Profile
+# - GET_FSM_PROFILE : Getting FSM Profile
+# - ADD_FSM_STATE : A State added to the FSM
+# - REMOVE_FSM_STATE : A State removed from FSM
+# - ADD_FSM_TRANSITION : A transition added to the FSM
+# - REMOVE_FSM_TRANSITION : A transition removed from FSM
+# - BIND_FSM_EVENT : An event bounded to the FSM
+# - UNBIND_FSM_EVENT : An event unbounded to the FSM
+#
+# @endif
+#
+class FsmProfileListenerType:
+ """
+ """
+
+ def __init__(self):
+ pass
+ SET_FSM_PROFILE = 0
+ GET_FSM_PROFILE = 1
+ ADD_FSM_STATE = 2
+ REMOVE_FSM_STATE = 3
+ ADD_FSM_TRANSITION = 4
+ REMOVE_FSM_TRANSITION = 5
+ BIND_FSM_EVENT = 6
+ UNBIND_FSM_EVENT = 7
+ FSM_PROFILE_LISTENER_NUM = 8
+
+
+
+##
+# @if jp
+# @class FsmProfileListener ¥¯¥é¥¹
+# @brief FsmProfileListener ¥¯¥é¥¹
+#
+# FsmProfileListener ¥¯¥é¥¹¤Ï¡¢FSM¤ÎProfile¤Ë´ØÏ¢¤·¤¿¥¢¥¯¥·¥ç¥ó¤Î¥³¡¼
+# ¥ë¥Ð¥Ã¥¯¤ò¼Â¸½¤¹¤ë¥ê¥¹¥Ê¡¼¥ª¥Ö¥¸¥§¥¯¥È¤Î´ðÄ쥯¥é¥¹¤Ç¤¢¤ë¡£FSM
+# Profile¤Î¥¢¥¯¥·¥ç¥ó¤ÎÆ°ºî¤ò¥Õ¥Ã¥¯¤·¤¿¤¤¾ì¹ç¡¢°Ê²¼¤ÎÎã¤Î¤è¤¦¤Ë¡¢¤³
+# ¤Î¥¯¥é¥¹¤ò·Ñ¾µ¤·¤¿¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢Å¬Àڤʥ³¡¼¥ë¥Ð¥Ã
+# ¥¯ÀßÄê´Ø¿ô¤«¤éRTObject¤ËÂФ·¤Æ¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã¥È¤¹¤ë
+# ɬÍפ¬¤¢¤ë¡£
+#
+# <pre>
+# class MyListener
+# : public FsmProfileListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+#
+# virtual void operator()(const ::RTC::FsmProfile& fsmprof)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# };
+# };
+# </pre>
+#
+# ¤³¤Î¤è¤¦¤Ë¤·¤ÆÄêµÁ¤µ¤ì¤¿¥ê¥¹¥Ê¥¯¥é¥¹¤Ï¡¢°Ê²¼¤Î¤è¤¦¤ËRTObject¤ËÂФ·
+# ¤Æ¡¢¥»¥Ã¥È¤µ¤ì¤ë¡£
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addFsmProfileListener(SET_FSM_PROFILE,
+# new MyListener("prof listener"),
+# true);
+# :
+# </pre>
+#
+# Âè1°ú¿ô¤Î "SET_FSM_PROFILE" ¤Ï¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò¥Õ¥Ã¥¯¤¹¤ë¥Ý¥¤¥ó
+# ¥È¤Ç¤¢¤ê¡¢°Ê²¼¤ÎÃͤò¼è¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¤Ê¤ª¡¢¤¹¤Ù¤Æ¤Î¥³¡¼¥ë¥Ð¥Ã
+# ¥¯¥Ý¥¤¥ó¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤È¤Ï¸Â¤é¤º¡¢¤³¤ì¤é¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤«¤É¤¦¤«
+# ¤Ï¡¢FSM¥µ¡¼¥Ó¥¹¤Î¼ÂÁõ¤Ë°Í¸¤¹¤ë¡£
+#
+# - SET_FSM_PROFILE : FSM ProfileÀßÄê»þ
+# - GET_FSM_PROFILE : FSM Profile¼èÆÀ»þ
+# - ADD_FSM_STATE : FSM¤ËState¤¬Äɲ䵤줿
+# - REMOVE_FSM_STATE : FSM¤«¤éState¤¬ºï½ü¤µ¤ì¤¿
+# - ADD_FSM_TRANSITION : FSM¤ËÁ«°Ü¤¬Äɲ䵤줿
+# - REMOVE_FSM_TRANSITION : FSM¤«¤éÁ«°Ü¤¬ºï½ü¤µ¤ì¤¿
+# - BIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+# - UNBIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥¢¥ó¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+#
+# Âè2°ú¿ô¤Ï¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Âè3°ú¿ô¤Ï¥ª¥Ö¥¸¥§¥¯¥È
+# ¼«Æ°ºï½ü¥Õ¥é¥°¤Ç¤¢¤ê¡¢true ¤Î¾ì¹ç¤Ï¡¢RTObjectºï½ü»þ¤Ë¼«Æ°Åª¤Ë¥ê¥¹
+# ¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤¬ºï½ü¤µ¤ì¤ë¡£false¤Î¾ì¹ç¤Ï¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+# ¸Æ¤Ó½Ð¤·Â¦¤Ë»Ä¤ê¡¢ºï½ü¤Ï¸Æ¤Ó½Ð¤·Â¦¤ÎÀÕǤ¤Ç¹Ô¤ï¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+# RTObject ¤Î¥é¥¤¥Õ¥µ¥¤¥¯¥ëÃæ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤¬É¬Íפʤé¤Ð¾åµ¤Î¤è¤¦¤Ê
+# ¸Æ¤Ó½Ð¤·Êý¤ÇÂè3°ú¿ô¤ò true ¤È¤·¤Æ¤ª¤¯¤È¤è¤¤¡£µÕ¤Ë¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò
+# ¾õ¶·Åù¤Ë±þ¤¸¤Æ¥»¥Ã¥È¤·¤¿¤ê¥¢¥ó¥»¥Ã¥È¤·¤¿¤ê¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ï
+# false¤È¤·¤ÆÃÖ¤¡¢¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤ò¥á¥ó¥ÐÊÑ¿ô¤Ê¤É¤ËÊÝ
+# »ý¤·¤Æ¤ª¤¡¢addFsmProfileListener()/removeFsmProfileListener() ¤Ë
+# ¤è¤ê¡¢¥»¥Ã¥È¤È¥¢¥ó¥»¥Ã¥È¤ò´ÉÍý¤¹¤ë¤È¤¤¤Ã¤¿»È¤¤Êý¤â²Äǽ¤Ç¤¢¤ë¡£
+#
+# @else
+# @class FsmProfileListener class
+# @brief FsmProfileListener class
+#
+# FsmProfileListener class is a base class for the listener
+# objects which realize callback to hook FSM Profile related actions.
+# To hook execution just before a FSM profile action, the callback object
+# should be defined as follows, and set to RTObject through
+# appropriate callback set function.
+#
+# <pre>
+# class MyListener
+# : public FsmProfileListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+#
+# virtual void operator()(const ::RTC::FsmProfile& fsmprof)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# };
+# };
+# </pre>
+#
+# The listener class defined above is set to RTObject as follows.
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addFsmProfileListener(SET_FSM_PROFILE,
+# new MyListener("prof listener"),
+# true);
+# :
+# </pre>
+#
+# The first argument "SET_FSM_PROFILE" specifies callback hook
+# point, and the following values are available. Not all the
+# callback points are implemented. It depends on the FSM service
+# implementations.
+#
+# - SET_FSM_PROFILE : Setting FSM Profile
+# - GET_FSM_PROFILE : Getting FSM Profile
+# - ADD_FSM_STATE : A State added to the FSM
+# - REMOVE_FSM_STATE : A State removed from FSM
+# - ADD_FSM_TRANSITION : A transition added to the FSM
+# - REMOVE_FSM_TRANSITION : A transition removed from FSM
+# - BIND_FSM_EVENT : An event bounded to the FSM
+# - UNBIND_FSM_EVENT : An event unbounded to the FSM
+#
+# The second argument is a pointers to the listener object. The
+# third argument is a flag for automatic object destruction. When
+# "true" is given to the third argument, the given object in second
+# argument is automatically destructed with RTObject. In the "false
+# " case, the ownership of the object is left in the caller side,
+# and then destruction of the object must be done by users'
+# responsibility.
+#
+# It is good for setting "true" as third argument, if the listener
+# object life span is equals to the RTObject's life cycle. On the
+# otehr hand, if callbacks are required to set/unset depending on
+# its situation, the third argument could be "false". In that
+# case, listener objects pointers must be stored to member
+# variables, and set/unset of the listener objects shoud be
+# paerformed throguh
+# addFsmProfileListener()/removeFsmProfileListener() functions.
+#
+# @endif
+#
+class FsmProfileListener:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ pass
+
+
+ ##
+ # @if jp
+ #
+ # @brief ²¾ÁÛ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # FsmProfileListener ¤Î¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # @else
+ #
+ # @brief Virtual Callback function
+ #
+ # This is a the Callback function for FsmProfileListener.
+ #
+ # @endif
+ # virtual void operator()(const ::RTC::FsmProfile& fsmprof) = 0;
+ def __call__(self, fsmprof):
+ pass
+
+ ##
+ # @if jp
+ #
+ # @brief FsmProfileListenerType ¤òʸ»úÎó¤ËÊÑ´¹
+ #
+ # FsmProfileListenerType ¤òʸ»úÎó¤ËÊÑ´¹¤¹¤ë
+ #
+ # @param type ÊÑ´¹ÂÐ¾Ý FsmProfileListenerType
+ #
+ # @return ʸ»úÎóÊÑ´¹·ë²Ì
+ #
+ # @else
+ #
+ # @brief Convert FsmProfileListenerType into the string.
+ #
+ # Convert FsmProfileListenerType into the string.
+ #
+ # @param type The target FsmProfileListenerType for transformation
+ #
+ # @return Trnasformation result of string representation
+ #
+ # @endif
+ #
+ def toString(type):
+ typeString = ["SET_FSM_PROFILE",
+ "GET_FSM_PROFILE",
+ "ADD_FSM_STATE",
+ "REMOVE_FSM_STATE",
+ "ADD_FSM_TRANSITION",
+ "REMOVE_FSM_TRANSITION",
+ "BIND_FSM_EVENT",
+ "UNBIND_FSM_EVENT",
+ "PRE_FSM_ACTION_LISTENER_NUM"]
+ if type < FsmProfileListenerType.FSM_PROFILE_LISTENER_NUM:
+ return typeString[type]
+
+ return ""
+ toString = staticmethod(toString)
+
+
+
+##
+# @if jp
+# @brief FsmStructureListener ¤Î¥¿¥¤¥×
+#
+# - SET_FSM_STRUCTURE: FSM¹½Â¤¤ÎÀßÄê
+# - GET_FSM_STRUCTURE: FSM¹½Â¤¤Î¼èÆÀ
+#
+# @else
+# @brief The types of FsmStructureListener
+#
+# - SET_FSM_STRUCTURE: Setting FSM structure
+# - GET_FSM_STRUCTURE: Getting FSM structure
+#
+# @endif
+#
+class FsmStructureListenerType:
+ """
+ """
+
+ def __init__(self):
+ pass
+ SET_FSM_STRUCTURE = 0
+ GET_FSM_STRUCTURE = 1
+ FSM_STRUCTURE_LISTENER_NUM = 2
+
+
+##
+# @if jp
+# @class FsmStructureListener ¥¯¥é¥¹
+# @brief FsmStructureListener ¥¯¥é¥¹
+#
+# FsmStructureListener ¥¯¥é¥¹¤Ï¡¢FSM Structure¤Î¥¢¥¯¥·¥ç¥ó¤Ë´Ø¤¹¤ë¥³¡¼
+# ¥ë¥Ð¥Ã¥¯¤ò¼Â¸½¤¹¤ë¥ê¥¹¥Ê¡¼¥ª¥Ö¥¸¥§¥¯¥È¤Î´ðÄ쥯¥é¥¹¤Ç¤¢¤ë¡£FSM
+# Structure ¤Î¥¢¥¯¥·¥ç¥ó¤Îľ¸å¤ÎÆ°ºî¤ò¥Õ¥Ã¥¯¤·¤¿¤¤¾ì¹ç¡¢°Ê²¼¤ÎÎã¤Î¤è
+# ¤¦¤Ë¡¢¤³¤Î¥¯¥é¥¹¤ò·Ñ¾µ¤·¤¿¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢Å¬ÀÚ¤Ê
+# ¥³¡¼¥ë¥Ð¥Ã¥¯ÀßÄê´Ø¿ô¤«¤éRTObject¤ËÂФ·¤Æ¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò
+# ¥»¥Ã¥È¤¹¤ëɬÍפ¬¤¢¤ë¡£
+#
+# <pre>
+# class MyListener
+# : public FsmStructureListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+# virtual void operator()(::RTC::FsmStructure& pprof)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# };
+# };
+# </pre>
+#
+# ¤³¤Î¤è¤¦¤Ë¤·¤ÆÄêµÁ¤µ¤ì¤¿¥ê¥¹¥Ê¥¯¥é¥¹¤Ï¡¢°Ê²¼¤Î¤è¤¦¤ËRTObject¤ËÂФ·
+# ¤Æ¡¢¥»¥Ã¥È¤µ¤ì¤ë¡£
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addFsmStructureListener(SET_FSM_STRUCTURE,
+# new MyListener("set structure listener"),
+# true);
+# :
+# </pre>
+#
+# Âè1°ú¿ô¤Î "SET_FSM_STRUCTURE" ¤Ï¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò¥Õ¥Ã¥¯¤¹¤ë¥Ý¥¤¥ó
+# ¥È¤Ç¤¢¤ê¡¢°Ê²¼¤ÎÃͤò¼è¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£¤Ê¤ª¡¢¤¹¤Ù¤Æ¤Î¥³¡¼¥ë¥Ð¥Ã
+# ¥¯¥Ý¥¤¥ó¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤È¤Ï¸Â¤é¤º¡¢¤³¤ì¤é¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤«¤É¤¦¤«
+# ¤Ï¡¢FSM¤Î¼ÂÁõ¤Ë°Í¸¤¹¤ë¡£
+#
+# - SET_FSM_STRUCTURE: FSM¹½Â¤¤ÎÀßÄê
+# - GET_FSM_STRUCTURE: FSM¹½Â¤¤Î¼èÆÀ
+#
+# Âè2°ú¿ô¤Ï¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Âè3°ú¿ô¤Ï¥ª¥Ö¥¸¥§¥¯¥È
+# ¼«Æ°ºï½ü¥Õ¥é¥°¤Ç¤¢¤ê¡¢true ¤Î¾ì¹ç¤Ï¡¢RTObjectºï½ü»þ¤Ë¼«Æ°Åª¤Ë¥ê¥¹
+# ¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤¬ºï½ü¤µ¤ì¤ë¡£false¤Î¾ì¹ç¤Ï¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+# ¸Æ¤Ó½Ð¤·Â¦¤Ë»Ä¤ê¡¢ºï½ü¤Ï¸Æ¤Ó½Ð¤·Â¦¤ÎÀÕǤ¤Ç¹Ô¤ï¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+# RTObject ¤Î¥é¥¤¥Õ¥µ¥¤¥¯¥ëÃæ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤¬É¬Íפʤé¤Ð¾åµ¤Î¤è¤¦¤Ê
+# ¸Æ¤Ó½Ð¤·Êý¤ÇÂè3°ú¿ô¤ò true ¤È¤·¤Æ¤ª¤¯¤È¤è¤¤¡£µÕ¤Ë¡¢¥³¡¼¥ë¥Ð¥Ã¥¯¤ò
+# ¾õ¶·Åù¤Ë±þ¤¸¤Æ¥»¥Ã¥È¤·¤¿¤ê¥¢¥ó¥»¥Ã¥È¤·¤¿¤ê¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ï
+# false¤È¤·¤ÆÃÖ¤¡¢¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤ò¥á¥ó¥ÐÊÑ¿ô¤Ê¤É¤ËÊÝ
+# »ý¤·¤Æ¤ª¤¡¢
+# RTObject_impl::addPostFsmActionListener()/removePostFsmActionListener()
+# ¤Ë¤è¤ê¡¢¥»¥Ã¥È¤È¥¢¥ó¥»¥Ã¥È¤ò´ÉÍý¤¹¤ë¤È¤¤¤Ã¤¿»È¤¤Êý¤â²Äǽ¤Ç¤¢¤ë¡£
+#
+# @else
+# @class FsmStructureListener class
+# @brief FsmStructureListener class
+#
+# PostFsmActionListener class is a base class for the listener
+# objects which realize callback to hook FSM structure profile
+# related actions. To hook execution just before a FSM action, the
+# callback object should be defined as follows, and set to RTObject
+# through appropriate callback set function.
+#
+# <pre>
+# class MyListener
+# : public FsmStructureListener
+# {
+# std::string m_name;
+# public:
+# MyListener(const char* name) : m_name(name) {}
+# virtual ~MyListener() {}
+# virtual void operator()(::RTC::FsmStructure& pprof)
+# {
+# std::cout << "Listner name: " m_name << std::endl;
+# };
+# };
+# </pre>
+#
+# The listener class defined above is set to RTObject as follows.
+#
+# <pre>
+# RTC::ReturnCode_t ConsoleIn::onInitialize()
+# {
+# addFsmStructureListener(SET_FSM_STRUCTURE,
+# new MyListener("set structure listener"),
+# true);
+# :
+# </pre>
+#
+# The first argument "SET_FSM_STRUCTURE" specifies callback hook
+# point, and the following values are available. Not all the
+# callback points are implemented. It depends on the FSM
+# implementations.
+#
+# - SET_FSM_STRUCTURE: Setting FSM structure
+# - GET_FSM_STRUCTURE: Getting FSM structure
+#
+# The second argument is a pointers to the listener object. The
+# third argument is a flag for automatic object destruction. When
+# "true" is given to the third argument, the given object in second
+# argument is automatically destructed with RTObject. In the "false
+# " case, the ownership of the object is left in the caller side,
+# and then destruction of the object must be done by users'
+# responsibility.
+#
+# It is good for setting "true" as third argument, if the listener
+# object life span is equals to the RTObject's life cycle. On the
+# otehr hand, if callbacks are required to set/unset depending on
+# its situation, the third argument could be "false". In that
+# case, listener objects pointers must be stored to member
+# variables, and set/unset of the listener objects shoud be
+# paerformed throguh
+# RTObject_impl::addPostFsmActionListener()/removePostFsmActionListener()
+# functions.
+#
+# @endif
+#
+class FsmStructureListener:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ pass
+
+
+ ##
+ # @if jp
+ #
+ # @brief ²¾ÁÛ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # FsmStructureListener ¤Î¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # @else
+ #
+ # @brief Virtual Callback function
+ #
+ # This is a the Callback function for FsmStructureListener.
+ #
+ # @endif
+ # virtual void operator()(const ::RTC::FsmStructure& fsmprof) = 0;
+ def __call__(self, pprof):
+ pass
+
+ ##
+ # @if jp
+ #
+ # @brief FsmStructureListenerType ¤òʸ»úÎó¤ËÊÑ´¹
+ #
+ # FsmStructureListenerType ¤òʸ»úÎó¤ËÊÑ´¹¤¹¤ë
+ #
+ # @param type ÊÑ´¹ÂÐ¾Ý FsmStructureListenerType
+ #
+ # @return ʸ»úÎóÊÑ´¹·ë²Ì
+ #
+ # @else
+ #
+ # @brief Convert FsmStructureListenerType into the string.
+ #
+ # Convert FsmStructureListenerType into the string.
+ #
+ # @param type The target FsmStructureListenerType for transformation
+ #
+ # @return Trnasformation result of string representation
+ #
+ # @endif
+ #
+ def toString(type):
+ typeString = ["SET_FSM_STRUCTURE",
+ "GET_FSM_STRUCTURE",
+ "FSM_STRUCTURE_LISTENER_NUM"]
+ if type < FsmStructureListenerType.FSM_STRUCTURE_LISTENER_NUM:
+ return typeString[type]
+
+ return ""
+ toString = staticmethod(toString)
+
+
+class Entry:
+ def __init__(self,listener, autoclean):
+ self.listener = listener
+ self.autoclean = autoclean
+ return
+
+
+##
+# @if jp
+# @class PreFsmActionListenerHolder
+# @brief PreFsmActionListener ¥Û¥ë¥À¥¯¥é¥¹
+#
+# Ê£¿ô¤Î PreFsmActionListener ¤òÊÝ»ý¤·´ÉÍý¤¹¤ë¥¯¥é¥¹¡£
+#
+# @else
+# @class PreFsmActionListenerHolder
+# @brief PreFsmActionListener holder class
+#
+# This class manages one ore more instances of
+# PreFsmActionListener class.
+#
+# @endif
+#
+class PreFsmActionListenerHolder:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ self._listeners = []
+ self._mutex = threading.RLock()
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for (idx, listener) in enumerate(self._listeners):
+ if listener.autoclean:
+ self._listeners[idx] = None
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ÎÄɲÃ
+ #
+ # ¥ê¥¹¥Ê¡¼¤òÄɲ乤롣
+ #
+ # @param listener Äɲ乤ë¥ê¥¹¥Ê
+ # @param autoclean true:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤¹¤ë,
+ # false:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤·¤Ê¤¤
+ # @else
+ #
+ # @brief Add the listener.
+ #
+ # This method adds the listener.
+ #
+ # @param listener Added listener
+ # @param autoclean true:The listener is deleted at the destructor.,
+ # false:The listener is not deleted at the destructor.
+ # @endif
+ #
+ def addListener(self, listener, autoclean):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ self._listeners.append(Entry(listener, autoclean))
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤Îºï½ü
+ #
+ # ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener ºï½ü¤¹¤ë¥ê¥¹¥Ê
+ # @else
+ #
+ # @brief Remove the listener.
+ #
+ # This method removes the listener.
+ #
+ # @param listener Removed listener
+ # @endif
+ #
+ def removeListener(self, listener):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ len_ = len(self._listeners)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ if self._listeners[idx].listener == listener:
+ if self._listeners[idx].autoclean:
+ self._listeners[idx].listener = None
+ del self._listeners[idx]
+ return
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ØÄÌÃΤ¹¤ë
+ #
+ # ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ê¥¹¥Ê¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡£
+ #
+ # @param info ConnectorInfo
+ # @else
+ #
+ # @brief Notify listeners.
+ #
+ # This calls the Callback method of the registered listener.
+ #
+ # @param info ConnectorInfo
+ # @endif
+ #
+ def notify(self, state):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for listener in self._listeners:
+ listener.listener(state)
+ return
+
+
+
+
+
+##
+# @if jp
+# @class PostFsmActionListenerHolder
+# @brief PostFsmActionListener ¥Û¥ë¥À¥¯¥é¥¹
+#
+# Ê£¿ô¤Î PostFsmActionListener ¤òÊÝ»ý¤·´ÉÍý¤¹¤ë¥¯¥é¥¹¡£
+#
+# @else
+# @class PostFsmActionListenerHolder
+# @brief PostFsmActionListener holder class
+#
+# This class manages one ore more instances of
+# PostFsmActionListener class.
+#
+# @endif
+#
+class PostFsmActionListenerHolder:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ self._listeners = []
+ self._mutex = threading.RLock()
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for (idx, listener) in enumerate(self._listeners):
+ if listener.autoclean:
+ self._listeners[idx] = None
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ÎÄɲÃ
+ #
+ # ¥ê¥¹¥Ê¡¼¤òÄɲ乤롣
+ #
+ # @param listener Äɲ乤ë¥ê¥¹¥Ê
+ # @param autoclean true:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤¹¤ë,
+ # false:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤·¤Ê¤¤
+ # @else
+ #
+ # @brief Add the listener.
+ #
+ # This method adds the listener.
+ #
+ # @param listener Added listener
+ # @param autoclean true:The listener is deleted at the destructor.,
+ # false:The listener is not deleted at the destructor.
+ # @endif
+ #
+ def addListener(self, listener, autoclean):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ self._listeners.append(Entry(listener, autoclean))
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤Îºï½ü
+ #
+ # ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener ºï½ü¤¹¤ë¥ê¥¹¥Ê
+ # @else
+ #
+ # @brief Remove the listener.
+ #
+ # This method removes the listener.
+ #
+ # @param listener Removed listener
+ # @endif
+ #
+ def removeListener(self, listener):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ len_ = len(self._listeners)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ if self._listeners[idx].listener == listener:
+ if self._listeners[idx].autoclean:
+ self._listeners[idx].listener = None
+ del self._listeners[idx]
+ return
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ØÄÌÃΤ¹¤ë
+ #
+ # ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ê¥¹¥Ê¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡£
+ #
+ # @param info ConnectorInfo
+ # @else
+ #
+ # @brief Notify listeners.
+ #
+ # This calls the Callback method of the registered listener.
+ #
+ # @param info ConnectorInfo
+ # @endif
+ #
+ def notify(self, state, ret):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for listener in self._listeners:
+ listener.listener(state, ret)
+ return
+
+
+##
+# @if jp
+# @class FsmProfileListenerHolder
+# @brief FsmProfileListener ¥Û¥ë¥À¥¯¥é¥¹
+#
+# Ê£¿ô¤Î FsmProfileListener ¤òÊÝ»ý¤·´ÉÍý¤¹¤ë¥¯¥é¥¹¡£
+#
+# @else
+# @class FsmProfileListenerHolder
+# @brief FsmProfileListener holder class
+#
+# This class manages one ore more instances of
+# FsmProfileListener class.
+#
+# @endif
+#
+class FsmProfileListenerHolder:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ self._listeners = []
+ self._mutex = threading.RLock()
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for (idx, listener) in enumerate(self._listeners):
+ if listener.autoclean:
+ self._listeners[idx] = None
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ÎÄɲÃ
+ #
+ # ¥ê¥¹¥Ê¡¼¤òÄɲ乤롣
+ #
+ # @param listener Äɲ乤ë¥ê¥¹¥Ê
+ # @param autoclean true:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤¹¤ë,
+ # false:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤·¤Ê¤¤
+ # @else
+ #
+ # @brief Add the listener.
+ #
+ # This method adds the listener.
+ #
+ # @param listener Added listener
+ # @param autoclean true:The listener is deleted at the destructor.,
+ # false:The listener is not deleted at the destructor.
+ # @endif
+ #
+ def addListener(self, listener, autoclean):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ self._listeners.append(Entry(listener, autoclean))
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤Îºï½ü
+ #
+ # ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener ºï½ü¤¹¤ë¥ê¥¹¥Ê
+ # @else
+ #
+ # @brief Remove the listener.
+ #
+ # This method removes the listener.
+ #
+ # @param listener Removed listener
+ # @endif
+ #
+ def removeListener(self, listener):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ len_ = len(self._listeners)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ if self._listeners[idx].listener == listener:
+ if self._listeners[idx].autoclean:
+ self._listeners[idx].listener = None
+ del self._listeners[idx]
+ return
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ØÄÌÃΤ¹¤ë
+ #
+ # ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ê¥¹¥Ê¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡£
+ #
+ # @param info ConnectorInfo
+ # @else
+ #
+ # @brief Notify listeners.
+ #
+ # This calls the Callback method of the registered listener.
+ #
+ # @param info ConnectorInfo
+ # @endif
+ #
+ def notify(self, state):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for listener in self._listeners:
+ listener.listener(state)
+ return
+
+##
+# @if jp
+# @class FsmStructureListenerHolder
+# @brief FsmStructureListener ¥Û¥ë¥À¥¯¥é¥¹
+#
+# Ê£¿ô¤Î FsmStructureListener ¤òÊÝ»ý¤·´ÉÍý¤¹¤ë¥¯¥é¥¹¡£
+#
+# @else
+# @class FsmStructureListenerHolder
+# @brief FsmStructureListener holder class
+#
+# This class manages one ore more instances of
+# FsmStructureListener class.
+#
+# @endif
+#
+class FsmStructureListenerHolder:
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Constructor
+ # @endif
+ #
+ def __init__(self):
+ self._listeners = []
+ self._mutex = threading.RLock()
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @else
+ # @brief Destructor
+ # @endif
+ #
+ def __del__(self):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for (idx, listener) in enumerate(self._listeners):
+ if listener.autoclean:
+ self._listeners[idx] = None
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ÎÄɲÃ
+ #
+ # ¥ê¥¹¥Ê¡¼¤òÄɲ乤롣
+ #
+ # @param listener Äɲ乤ë¥ê¥¹¥Ê
+ # @param autoclean true:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤¹¤ë,
+ # false:¥Ç¥¹¥È¥é¥¯¥¿¤Çºï½ü¤·¤Ê¤¤
+ # @else
+ #
+ # @brief Add the listener.
+ #
+ # This method adds the listener.
+ #
+ # @param listener Added listener
+ # @param autoclean true:The listener is deleted at the destructor.,
+ # false:The listener is not deleted at the destructor.
+ # @endif
+ #
+ def addListener(self, listener, autoclean):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ self._listeners.append(Entry(listener, autoclean))
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤Îºï½ü
+ #
+ # ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener ºï½ü¤¹¤ë¥ê¥¹¥Ê
+ # @else
+ #
+ # @brief Remove the listener.
+ #
+ # This method removes the listener.
+ #
+ # @param listener Removed listener
+ # @endif
+ #
+ def removeListener(self, listener):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ len_ = len(self._listeners)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ if self._listeners[idx].listener == listener:
+ if self._listeners[idx].autoclean:
+ self._listeners[idx].listener = None
+ del self._listeners[idx]
+ return
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥¹¥Ê¡¼¤ØÄÌÃΤ¹¤ë
+ #
+ # ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ê¥¹¥Ê¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡£
+ #
+ # @param info ConnectorInfo
+ # @else
+ #
+ # @brief Notify listeners.
+ #
+ # This calls the Callback method of the registered listener.
+ #
+ # @param info ConnectorInfo
+ # @endif
+ #
+ def notify(self, state):
+ guard = OpenRTM_aist.Guard.ScopedLock(self._mutex)
+ for listener in self._listeners:
+ listener.listener(state)
+ return
+
+
+
+
+##
+# @if jp
+# @class FsmActionListeners
+# @brief FsmActionListeners ¥¯¥é¥¹
+#
+#
+# @else
+# @class FsmActionListeners
+# @brief FsmActionListeners class
+#
+#
+# @endif
+class FsmActionListeners:
+ def __init__(self):
+
+ ##
+ # @if jp
+ # @brief PreFsmActionListenerType
+ # PreFsmActionListenerType¥ê¥¹¥Ê¤ò³ÊǼ
+ # @else
+ # @brief PreFsmActionListenerType listener array
+ # The PreFsmActionListenerType listener is stored.
+ # @endif
+ self.preaction_num = PreFsmActionListenerType.PRE_FSM_ACTION_LISTENER_NUM
+ self.preaction_ = [PreFsmActionListenerHolder()
+ for i in range(self.preaction_num)]
+
+ ##
+ # @if jp
+ # @brief PostFsmActionType¥ê¥¹¥ÊÇÛÎó
+ # PostFsmActionType¥ê¥¹¥Ê¤ò³ÊǼ
+ # @else
+ # @brief PostFsmActionType listener array
+ # The PostFsmActionType listener is stored.
+ # @endif
+ self.postaction_num = PostFsmActionListenerType.POST_FSM_ACTION_LISTENER_NUM
+ self.postaction_ = [PostFsmActionListenerHolder()
+ for i in range(self.postaction_num)]
+
+ ##
+ # @if jp
+ # @brief FsmProfileType
+ # FsmProfileType¥ê¥¹¥Ê¤ò³ÊǼ
+ # @else
+ # @brief FsmProfileType listener array
+ # The FsmProfileType listener is stored.
+ # @endif
+ self.profile_num = FsmProfileListenerType.FSM_PROFILE_LISTENER_NUM
+ self.profile_ = [FsmProfileListenerHolder()
+ for i in range(self.profile_num)]
+
+ ##
+ # @if jp
+ # @brief FsmStructureType¥ê¥¹¥ÊÇÛÎó
+ # FsmStructureType¥ê¥¹¥Ê¤ò³ÊǼ
+ # @else
+ # @brief FsmStructureTypelistener array
+ # The FsmStructureType listener is stored.
+ # @endif
+ self.structure_num = FsmStructureListenerType.FSM_STRUCTURE_LISTENER_NUM
+ self.structure_ = [FsmStructureListenerHolder()
+ for i in range(self.structure_num)]
+
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmObject.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmObject.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/FsmObject.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file FsmObject.py
+# @brief Fsm Object Base class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+import OpenRTM_aist
+import RTC, RTC__POA
+
+
+##
+# @if jp
+# @brief
+# FiniteStateMachine¤Î¥Ù¡¼¥¹¥¯¥é¥¹¡£
+# ¥æ¡¼¥¶¤¬¿·¤¿¤ÊRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òºîÀ®¤¹¤ë¾ì¹ç¤Ï¡¢¤³¤Î¥¯¥é¥¹¤ò³ÈÄ¥¤¹¤ë¡£
+# ³ÆRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë¥¯¥é¥¹¡£}
+#
+#
+# @else
+# @brief
+# This is a class to be a base of each RT-Component.
+# This is a implementation class of lightweightRTComponent in Robotic
+# Technology Component specification
+#
+# @endif
+class FsmObject_impl(RTC__POA.FsmObject):
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @brief Consructor
+ #
+ #
+ # @endif
+ def __init__(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief
+ #
+ #
+ #
+ # @param self
+ #
+ # @else
+ #Send a stimulus to an FSM that realizes this interface.
+ # If the stimulus corresponds to any outgoing transition of the
+ # current state, that transition shall be taken and the state
+ # shall change. Any FSM participants associated with the exit of
+ # the current state, the transition to the new state, or the
+ # entry to the new state shall be invoked. If the stimulus does
+ # not correspond to any such transition, this operation shall
+ # succeed but have no effect.
+ #
+ # If the given execution context is a non-nil reference to a
+ # context in which this FSM participates, the transition shall be
+ # executed in that context. If the argument is nil, the FSM shall
+ # choose an EVENT_DRIVEN context in which to execute the
+ # transition. If the argument is non-nil, but this FSM does not
+ # participate in the given context, this operation shall fail
+ # with * ReturnCode_t::BAD_PARAMETER.
+ #
+ # @brief Consructor
+ #
+ #
+ # @endif
+ def send_stimulus(self, ids, id):
+ return RTC.RTC_OK
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPort.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPort.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPort.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -111,7 +111,11 @@
self._valueMutex = threading.RLock()
self._outPortConnectorList = []
+ self.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED, OpenRTM_aist.Timestamp("on_received"))
+ self.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ, OpenRTM_aist.Timestamp("on_read"))
+
+
def __del__(self, InPortBase=OpenRTM_aist.InPortBase):
InPortBase.__del__(self)
return
@@ -152,7 +156,7 @@
# @endif
#
# bool isNew()
- def isNew(self):
+ def isNew(self, names=None):
self._rtcout.RTC_TRACE("isNew()")
@@ -166,12 +170,39 @@
self._rtcout.RTC_DEBUG("no connectors")
return False
- r = self._connectors[0].getBuffer().readable()
- if r > 0:
- self._rtcout.RTC_DEBUG("isNew() = True, readable data: %d",r)
- return True
+ if names is None:
+ r = self._connectors[0].getBuffer().readable()
+ if r > 0:
+ self._rtcout.RTC_DEBUG("isNew() = True, readable data: %d",r)
+ return True
+ else:
+ self._rtcout.RTC_DEBUG("isNew() = False, no readable data")
+ return False
+ elif isinstance(names, str):
+ for con in self._connectors:
+ if con.name() == names:
+ r = con.getBuffer().readable()
+ if r > 0:
+ self._rtcout.RTC_DEBUG("isNew() = True, connector name: %s, readable data: %d",(names, r))
+ return True
+ else:
+ self._rtcout.RTC_DEBUG("isNew() = False, connector name: %s, no readable data",names)
+ return False
+ elif isinstance(names, list):
+ del names[:]
+ for con in self._connectors:
+ r = con.getBuffer().readable()
+ if r > 0:
+ self._rtcout.RTC_DEBUG("isNew() = True, connector name: %s, readable data: %d",(names, r))
+ names.append(con.name())
+ if len(names) > 0:
+ return True
+ else:
+ self._rtcout.RTC_DEBUG("isNew() = False, no readable data")
+ return False
+
- self._rtcout.RTC_DEBUG("isNew() = False, no readable data")
+ self._rtcout.RTC_ERROR("isNew() = False, Unknown Errow")
return False
@@ -288,7 +319,7 @@
# @endif
#
# DataType read()
- def read(self):
+ def read(self, name=None):
self._rtcout.RTC_TRACE("DataType read()")
if self._OnRead is not None:
@@ -323,9 +354,21 @@
_val = copy.deepcopy(self._value)
cdr = [_val]
- ret = self._connectors[0].read(cdr)
+ if name is None:
+ ret = self._connectors[0].read(cdr)
+ else:
+ ret = OpenRTM_aist.DataPortStatus.PRECONDITION_NOT_MET
+ for con in self._connectors:
+ if con.name() == name:
+ ret = con.read(cdr)
+ if ret == OpenRTM_aist.DataPortStatus.PRECONDITION_NOT_MET:
+ self._rtcout.RTC_DEBUG("not found %s",name)
+ return self._value
+
+
+
if ret == OpenRTM_aist.DataPortStatus.PORT_OK:
self._rtcout.RTC_DEBUG("data read succeeded")
self._value = cdr[0]
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrConsumer.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrConsumer.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrConsumer.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -22,6 +22,7 @@
import OpenRTM_aist
import OpenRTM
+
##
# @if jp
#
@@ -449,7 +450,6 @@
else:
return self.UNKNOWN_ERROR
-
def InPortCorbaCdrConsumerInit():
factory = OpenRTM_aist.InPortConsumerFactory.instance()
factory.addFactory("corba_cdr",
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -21,6 +21,7 @@
import OpenRTM_aist
import OpenRTM__POA,OpenRTM
+
##
# @if jp
# @class InPortCorbaCdrProvider
@@ -183,6 +184,7 @@
return OpenRTM.PORT_ERROR
ret = self._connector.write(data)
+
return self.convertReturn(ret, data)
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSConsumer.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSConsumer.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSConsumer.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,456 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file InPortDSConsumer.py
+# @brief InPortDSConsumer class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+from omniORB import any
+from omniORB import CORBA
+import OpenRTM_aist
+import RTC
+
+##
+# @if jp
+#
+# @class InPortDSConsumer
+#
+# @brief InPortDSConsumer ¥¯¥é¥¹
+#
+# ÄÌ¿®¼êÃÊ¤Ë CORBA ¤òÍøÍѤ·¤¿ÆþÎϥݡ¼¥È¥³¥ó¥·¥å¡¼¥Þ¤Î¼ÂÁõ¥¯¥é¥¹¡£
+#
+# @param DataType Ëܥݡ¼¥È¤Ë¤Æ°·¤¦¥Ç¡¼¥¿·¿
+#
+# @since 1.2.0
+#
+# @else
+# @class InPortDSConsumer
+#
+# @brief InPortDSConsumer class
+#
+# This is an implementation class of the input port Consumer
+# that uses CORBA for means of communication.
+#
+# @param DataType Data type for this port
+#
+# @since 1.2.0
+#
+# @endif
+#
+class InPortDSConsumer(OpenRTM_aist.InPortConsumer,OpenRTM_aist.CorbaConsumer):
+ """
+ """
+
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param buffer Åö³º¥³¥ó¥·¥å¡¼¥Þ¤Ë³ä¤êÅö¤Æ¤ë¥Ð¥Ã¥Õ¥¡¥ª¥Ö¥¸¥§¥¯¥È
+ #
+ # @else
+ # @brief Constructor
+ #
+ # Constructor
+ #
+ # @param buffer The buffer object that is attached to this Consumer
+ #
+ # @endif
+ #
+ def __init__(self):
+ OpenRTM_aist.CorbaConsumer.__init__(self)
+ self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("InPortDSConsumer")
+ self._properties = None
+ return
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # @else
+ # @brief Destructor
+ #
+ # Destructor
+ #
+ # @endif
+ #
+ def __del__(self, CorbaConsumer=OpenRTM_aist.CorbaConsumer):
+ self._rtcout.RTC_PARANOID("~InPortDSConsumer()")
+ CorbaConsumer.__del__(self)
+ return
+
+ ##
+ # @if jp
+ # @brief ÀßÄê½é´ü²½
+ #
+ # InPortConsumer¤Î³Æ¼ïÀßÄê¤ò¹Ô¤¦
+ #
+ # @else
+ # @brief Initializing configuration
+ #
+ # This operation would be called to configure this consumer
+ # in initialization.
+ #
+ # @endif
+ #
+ # virtual void init(coil::Properties& prop);
+ def init(self, prop):
+ self._rtcout.RTC_TRACE("init()")
+ self._properties = prop
+ return
+
+ ##
+ # @if jp
+ # @brief ÀܳÀè¤Ø¤Î¥Ç¡¼¥¿Á÷¿®
+ #
+ # ÀܳÀè¤Î¥Ý¡¼¥È¤Ø¥Ç¡¼¥¿¤òÁ÷¿®¤¹¤ë¤¿¤á¤Î½ã¿è²¾ÁÛ´Ø¿ô¡£
+ #
+ # ¤³¤Î´Ø¿ô¤Ï¡¢°Ê²¼¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É¤òÊÖ¤¹¡£
+ #
+ # - PORT_OK: Àµ¾ï½ªÎ»¡£
+ # - PORT_ERROR: ¥Ç¡¼¥¿Á÷¿®¤Î²áÄø¤Ç²¿¤é¤«¤Î¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ # - SEND_FULL: ¥Ç¡¼¥¿¤òÁ÷¿®¤·¤¿¤¬¡¢Áê¼ê¦¥Ð¥Ã¥Õ¥¡¤¬¥Õ¥ë¤À¤Ã¤¿¡£
+ # - SEND_TIMEOUT: ¥Ç¡¼¥¿¤òÁ÷¿®¤·¤¿¤¬¡¢Áê¼ê¦¥Ð¥Ã¥Õ¥¡¤¬¥¿¥¤¥à¥¢¥¦¥È¤·¤¿¡£
+ # - UNKNOWN_ERROR: ¸¶°øÉÔÌÀ¤Î¥¨¥é¡¼
+ #
+ # @param data Á÷¿®¤¹¤ë¥Ç¡¼¥¿
+ # @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ # @brief Send data to the destination port
+ #
+ # Pure virtual function to send data to the destination port.
+ #
+ # This function might the following return codes
+ #
+ # - PORT_OK: Normal return
+ # - PORT_ERROR: Error occurred in data transfer process
+ # - SEND_FULL: Buffer full although OutPort tried to send data
+ # - SEND_TIMEOUT: Timeout although OutPort tried to send data
+ # - UNKNOWN_ERROR: Unknown error
+ #
+ # @endif
+ #
+ # virtual ReturnCode put(const cdrMemoryStream& data);
+ def put(self, data):
+ self._rtcout.RTC_PARANOID("put()")
+
+ try:
+ ref_ = self.getObject()
+ if ref_:
+ ds = ref_._narrow(RTC.DataPushService)
+ return self.convertReturnCode(ds.push(data))
+ return self.CONNECTION_LOST
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ return self.CONNECTION_LOST
+
+
+
+ ##
+ # @if jp
+ # @brief InterfaceProfile¾ðÊó¤ò¸ø³«¤¹¤ë
+ #
+ # InterfaceProfile¾ðÊó¤ò¸ø³«¤¹¤ë¡£
+ # °ú¿ô¤Ç»ØÄꤹ¤ë¥×¥í¥Ñ¥Æ¥£¾ðÊóÆâ¤Î NameValue ¥ª¥Ö¥¸¥§¥¯¥È¤Î
+ # dataport.interface_type ÃͤòÄ´¤Ù¡¢Åö³º¥Ý¡¼¥È¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë
+ # ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¿¥¤¥×¤È°ìÃפ¹¤ë¾ì¹ç¤Î¤ß¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @param properties InterfaceProfile¾ðÊó¤ò¼õ¤±¼è¤ë¥×¥í¥Ñ¥Æ¥£
+ #
+ # @else
+ # @brief Publish InterfaceProfile information
+ #
+ # Publish interfaceProfile information.
+ # Check the dataport.interface_type value of the NameValue object
+ # specified by an argument in property information and get information
+ # only when the interface type of the specified port is matched.
+ #
+ # @param properties Properties to get InterfaceProfile information
+ #
+ # @endif
+ #
+ # virtual void publishInterfaceProfile(SDOPackage::NVList& properties);
+ def publishInterfaceProfile(self, properties):
+ return
+
+ ##
+ # @if jp
+ # @brief ¥Ç¡¼¥¿Á÷¿®ÄÌÃΤؤÎÅÐÏ¿
+ #
+ # »ØÄꤵ¤ì¤¿¥×¥í¥Ñ¥Æ¥£¤Ë´ð¤Å¤¤¤Æ¡¢¥Ç¡¼¥¿Á÷½ÐÄÌÃΤμõ¤±¼è¤ê¤ËÅÐÏ¿¤¹¤ë¡£
+ #
+ # @param properties ÅÐÏ¿¾ðÊó
+ #
+ # @return ÅÐÏ¿½èÍý·ë²Ì(ÅÐÏ¿À®¸ù:true¡¢ÅÐÏ¿¼ºÇÔ:false)
+ #
+ # @else
+ # @brief Subscribe to the data sending notification
+ #
+ # Subscribe to the data sending notification based on specified
+ # property information.
+ #
+ # @param properties Information for subscription
+ #
+ # @return Subscription result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # virtual bool subscribeInterface(const SDOPackage::NVList& properties);
+ def subscribeInterface(self, properties):
+ self._rtcout.RTC_TRACE("subscribeInterface()")
+ # self._rtcout.RTC_DEBUG_STR(OpenRTM_aist.NVUtil.toString(properties))
+
+ # getting InPort's ref from IOR string
+ if self.subscribeFromIor(properties):
+ return True
+
+ # getting InPort's ref from Object reference
+ if self.subscribeFromRef(properties):
+ return True
+
+ return False
+
+ ##
+ # @if jp
+ # @brief ¥Ç¡¼¥¿Á÷¿®ÄÌÃΤ«¤é¤ÎÅÐÏ¿²ò½ü
+ #
+ # ¥Ç¡¼¥¿Á÷½ÐÄÌÃΤμõ¤±¼è¤ê¤«¤éÅÐÏ¿¤ò²ò½ü¤¹¤ë¡£
+ #
+ # @param properties ÅÐÏ¿²ò½ü¾ðÊó
+ #
+ # @else
+ # @brief Unsubscribe the data send notification
+ #
+ # Unsubscribe the data send notification.
+ #
+ # @param properties Information for unsubscription
+ #
+ # @endif
+ #
+ # virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
+ def unsubscribeInterface(self, properties):
+ self._rtcout.RTC_TRACE("unsubscribeInterface()")
+ # self._rtcout.RTC_DEBUG_STR(OpenRTM_aist.NVUtil.toString(properties))
+
+ if self.unsubscribeFromIor(properties):
+ return
+
+ self.unsubscribeFromRef(properties)
+ return
+
+ ##
+ # @if jp
+ # @brief IORʸ»úÎ󤫤饪¥Ö¥¸¥§¥¯¥È»²¾È¤ò¼èÆÀ¤¹¤ë
+ #
+ # @return true: Àµ¾ï¼èÆÀ, false: ¼èÆÀ¼ºÇÔ
+ #
+ # @else
+ # @brief Getting object reference fromn IOR string
+ #
+ # @return true: succeeded, false: failed
+ #
+ # @endif
+ #
+ # bool subscribeFromIor(const SDOPackage::NVList& properties);
+ def subscribeFromIor(self, properties):
+ self._rtcout.RTC_TRACE("subscribeFromIor()")
+
+ index = OpenRTM_aist.NVUtil.find_index(properties,
+ "dataport.data_service.inport_ior")
+ if index < 0:
+ self._rtcout.RTC_ERROR("inport_ior not found")
+ return False
+
+ ior = ""
+ try:
+ ior = any.from_any(properties[index].value, keep_structs=True)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ if not ior:
+ self._rtcout.RTC_ERROR("inport_ior has no string")
+ return False
+
+ orb = OpenRTM_aist.Manager.instance().getORB()
+ obj = orb.string_to_object(ior)
+
+ if CORBA.is_nil(obj):
+ self._rtcout.RTC_ERROR("invalid IOR string has been passed")
+ return False
+
+ if not self.setObject(obj):
+ self._rtcout.RTC_WARN("Setting object to consumer failed.")
+ return False
+
+ return True
+
+ ##
+ # @if jp
+ # @brief Any¤«¤éľÀÜ¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤ò¼èÆÀ¤¹¤ë
+ #
+ # @return true: Àµ¾ï¼èÆÀ, false: ¼èÆÀ¼ºÇÔ
+ #
+ # @else
+ # @brief Getting object reference fromn Any directry
+ #
+ # @return true: succeeded, false: failed
+ #
+ # @endif
+ #
+ # bool subscribeFromRef(const SDOPackage::NVList& properties);
+ def subscribeFromRef(self, properties):
+ self._rtcout.RTC_TRACE("subscribeFromRef()")
+ index = OpenRTM_aist.NVUtil.find_index(properties,
+ "dataport.data_service.inport_ref")
+ if index < 0:
+ self._rtcout.RTC_ERROR("inport_ref not found")
+ return False
+
+ obj = None
+ try:
+ obj = any.from_any(properties[index].value, keep_structs=True)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ if not obj:
+ self._rtcout.RTC_ERROR("prop[inport_ref] is not objref")
+ return False
+
+ if CORBA.is_nil(obj):
+ self._rtcout.RTC_ERROR("prop[inport_ref] is not objref")
+ return False
+
+ if not self.setObject(obj):
+ self._rtcout.RTC_ERROR("Setting object to consumer failed.")
+ return False
+
+ return True
+
+ ##
+ # @if jp
+ # @brief Àܳ²ò½ü(IORÈÇ)
+ #
+ # @return true: Àµ¾ï¼èÆÀ, false: ¼èÆÀ¼ºÇÔ
+ #
+ # @else
+ # @brief ubsubscribing (IOR version)
+ #
+ # @return true: succeeded, false: failed
+ #
+ # @endif
+ #
+ # bool unsubscribeFromIor(const SDOPackage::NVList& properties);
+ def unsubscribeFromIor(self, properties):
+ self._rtcout.RTC_TRACE("unsubscribeFromIor()")
+ index = OpenRTM_aist.NVUtil.find_index(properties,
+ "dataport.data_service.inport_ior")
+ if index < 0:
+ self._rtcout.RTC_ERROR("inport_ior not found")
+ return False
+
+ ior = ""
+ try:
+ ior = any.from_any(properties[index].value, keep_structs=True)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ if not ior:
+ self._rtcout.RTC_ERROR("prop[inport_ior] is not string")
+ return False
+
+ orb = OpenRTM_aist.Manager.instance().getORB()
+ var = orb.string_to_object(ior)
+ if not self._ptr(True)._is_equivalent(var):
+ self._rtcout.RTC_ERROR("connector property inconsistency")
+ return False
+
+ self.releaseObject()
+ return True
+
+ ##
+ # @if jp
+ # @brief Àܳ²ò½ü(Object referenceÈÇ)
+ #
+ # @return true: Àµ¾ï¼èÆÀ, false: ¼èÆÀ¼ºÇÔ
+ #
+ # @else
+ # @brief ubsubscribing (Object reference version)
+ #
+ # @return true: succeeded, false: failed
+ #
+ # @endif
+ #
+ # bool unsubscribeFromRef(const SDOPackage::NVList& properties);
+ def unsubscribeFromRef(self, properties):
+ self._rtcout.RTC_TRACE("unsubscribeFromRef()")
+ index = OpenRTM_aist.NVUtil.find_index(properties,
+ "dataport.data_service.inport_ref")
+
+ if index < 0:
+ return False
+
+ obj = None
+ try:
+ obj = any.from_any(properties[index].value, keep_structs=True)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ if not obj:
+ return False
+
+ obj_ptr = self._ptr(True)
+
+ if obj_ptr is None or not obj_ptr._is_equivalent(obj):
+ return False
+
+ self.releaseObject()
+ return True
+
+ ##
+ # @if jp
+ # @brief ¥ê¥¿¡¼¥ó¥³¡¼¥ÉÊÑ´¹
+ # @else
+ # @brief Return codes conversion
+ # @endif
+ #
+ # ReturnCode convertReturnCode(OpenRTM::PortStatus ret)
+ def convertReturnCode(self, ret):
+ if ret == RTC.PORT_OK:
+ return self.PORT_OK
+
+ elif ret == RTC.PORT_ERROR:
+ return self.PORT_ERROR
+
+ elif ret == RTC.BUFFER_FULL:
+ return self.SEND_FULL
+
+ elif ret == RTC.BUFFER_TIMEOUT:
+ return self.SEND_TIMEOUT
+
+ elif ret == RTC.UNKNOWN_ERROR:
+ return self.UNKNOWN_ERROR
+
+ else:
+ return self.UNKNOWN_ERROR
+
+
+def InPortDSConsumerInit():
+ factory = OpenRTM_aist.InPortConsumerFactory.instance()
+ factory.addFactory("data_service",
+ OpenRTM_aist.InPortDSConsumer,
+ OpenRTM_aist.Delete)
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSProvider.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortDSProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,290 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file InPortDSProvider.py
+# @brief InPortDSProvider class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+import OpenRTM_aist
+import RTC__POA,RTC
+
+##
+# @if jp
+# @class InPortDSProvider
+# @brief InPortDSProvider ¥¯¥é¥¹
+#
+# ÄÌ¿®¼êÃÊ¤Ë CORBA ¤òÍøÍѤ·¤¿ÆþÎϥݡ¼¥È¥×¥í¥Ð¥¤¥À¡¼¤Î¼ÂÁõ¥¯¥é¥¹¡£
+#
+# @param DataType Åö³º¥×¥í¥Ð¥¤¥À¤Ë³ä¤êÅö¤Æ¤¿¥Ð¥Ã¥Õ¥¡¤¬ÊÝ»ý¤¹¤ë¥Ç¡¼¥¿·¿
+#
+# @since 1.2.0
+#
+# @else
+# @class InPortDSProvider
+# @brief InPortDSProvider class
+#
+# This is an implementation class of the input port Provider
+# that uses CORBA for means of communication.
+#
+# @param DataType Data type held by the buffer that attached
+# to this provider.
+#
+# @since 1.2.0
+#
+# @endif
+#
+class InPortDSProvider(OpenRTM_aist.InPortProvider,
+ RTC__POA.DataPushService):
+
+ """
+ """
+
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ # ¥Ý¡¼¥È¥×¥í¥Ñ¥Æ¥£¤Ë°Ê²¼¤Î¹àÌܤòÀßÄꤹ¤ë¡£
+ # - ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¥¿¥¤¥× : CORBA_Any
+ # - ¥Ç¡¼¥¿¥Õ¥í¡¼¥¿¥¤¥× : Push, Pull
+ # - ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó¥¿¥¤¥× : Any
+ #
+ # @param buffer Åö³º¥×¥í¥Ð¥¤¥À¤Ë³ä¤êÅö¤Æ¤ë¥Ð¥Ã¥Õ¥¡¥ª¥Ö¥¸¥§¥¯¥È
+ #
+ # @else
+ # @brief Constructor
+ #
+ # Constructor
+ # Set the following items to port properties
+ # - Interface type : CORBA_Any
+ # - Data flow type : Push, Pull
+ # - Subscription type : Any
+ #
+ # @param buffer Buffer object that is attached to this provider
+ #
+ # @endif
+ #
+ def __init__(self):
+ OpenRTM_aist.InPortProvider.__init__(self)
+
+ # PortProfile setting
+ self.setInterfaceType("data_service")
+
+ # ConnectorProfile setting
+ self._objref = self._this()
+
+ self._buffer = None
+
+ self._profile = None
+ self._listeners = None
+
+ # set InPort's reference
+ orb = OpenRTM_aist.Manager.instance().getORB()
+
+ self._properties.append(OpenRTM_aist.NVUtil.newNV("dataport.data_service.inport_ior",
+ orb.object_to_string(self._objref)))
+ self._properties.append(OpenRTM_aist.NVUtil.newNV("dataport.data_service.inport_ref",
+ self._objref))
+
+ return
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # @else
+ # @brief Destructor
+ #
+ # Destructor
+ #
+ # @endif
+ #
+ def __del__(self):
+ return
+
+ ##
+ # @if jp
+ # @brief ½ªÎ»½èÍý
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
+ oid = OpenRTM_aist.Manager.instance().getPOA().servant_to_id(self)
+ OpenRTM_aist.Manager.instance().getPOA().deactivate_object(oid)
+
+ ## virtual void init(coil::Properties& prop);
+ def init(self, prop):
+ pass
+
+ ## virtual void setBuffer(BufferBase<cdrMemoryStream>* buffer);
+ def setBuffer(self, buffer):
+ self._buffer = buffer
+ return
+
+ # void setListener(ConnectorInfo& info,
+ # ConnectorListeners* listeners);
+ def setListener(self, info, listeners):
+ self._profile = info
+ self._listeners = listeners
+ return
+
+ def put(self, data):
+ self._rtcout.RTC_PARANOID("InPortDSProvider.put()")
+ return RTC.UNKNOWN_ERROR
+ ##
+ # @if jp
+ # @brief [CORBA interface] ¥Ð¥Ã¥Õ¥¡¤Ë¥Ç¡¼¥¿¤ò½ñ¤¹þ¤à
+ #
+ # ÀßÄꤵ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤Ë¥Ç¡¼¥¿¤ò½ñ¤¹þ¤à¡£
+ #
+ # @param data ½ñ¹þÂоݥǡ¼¥¿
+ #
+ # @else
+ # @brief [CORBA interface] Write data into the buffer
+ #
+ # Write data into the specified buffer.
+ #
+ # @param data The target data for writing
+ #
+ # @endif
+ #
+ # virtual ::OpenRTM::PortStatus push(const ::RTC::CdrData& data)
+ # throw (CORBA::SystemException);
+ def push(self, data):
+ try:
+ self._rtcout.RTC_PARANOID("InPortDSProvider.push()")
+
+ if not self._buffer:
+ self.onReceiverError(data)
+ return RTC.PORT_ERROR
+
+ self._rtcout.RTC_PARANOID("received data size: %d", len(data))
+
+ self.onReceived(data)
+
+ if not self._connector:
+ return RTC.PORT_ERROR
+
+ ret = self._connector.write(data)
+
+ return self.convertReturn(ret, data)
+
+ except:
+ self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
+ return RTC.UNKNOWN_ERROR
+
+
+
+ def convertReturn(self, status, data):
+ if status == OpenRTM_aist.BufferStatus.BUFFER_OK:
+ self.onBufferWrite(data)
+ return RTC.PORT_OK
+
+ elif status == OpenRTM_aist.BufferStatus.BUFFER_ERROR:
+ self.onReceiverError(data)
+ return RTC.PORT_ERROR
+
+ elif status == OpenRTM_aist.BufferStatus.BUFFER_FULL:
+ self.onBufferFull(data)
+ self.onReceiverFull(data)
+ return RTC.BUFFER_FULL
+
+ elif status == OpenRTM_aist.BufferStatus.BUFFER_EMPTY:
+ return RTC.BUFFER_EMPTY
+
+ elif status == OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET:
+ self.onReceiverError(data)
+ return RTC.PORT_ERROR
+
+ elif status == OpenRTM_aist.BufferStatus.TIMEOUT:
+ self.onBufferWriteTimeout(data)
+ self.onReceiverTimeout(data)
+ return RTC.BUFFER_TIMEOUT
+
+ else:
+ self.onReceiverError(data)
+ return RTC.UNKNOWN_ERROR
+
+
+ ##
+ # @brief Connector data listener functions
+ #
+ # inline void onBufferWrite(const cdrMemoryStream& data)
+ def onBufferWrite(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE].notify(self._profile, data)
+ return
+
+
+ ## inline void onBufferFull(const cdrMemoryStream& data)
+ def onBufferFull(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_FULL].notify(self._profile, data)
+ return
+
+
+ ## inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ def onBufferWriteTimeout(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE_TIMEOUT].notify(self._profile, data)
+ return
+
+ ## inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
+ def onBufferWriteOverwrite(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_OVERWRITE].notify(self._profile, data)
+ return
+
+
+ ## inline void onReceived(const cdrMemoryStream& data)
+ def onReceived(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED].notify(self._profile, data)
+ return
+
+
+ ## inline void onReceiverFull(const cdrMemoryStream& data)
+ def onReceiverFull(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_FULL].notify(self._profile, data)
+ return
+
+
+ ## inline void onReceiverTimeout(const cdrMemoryStream& data)
+ def onReceiverTimeout(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_TIMEOUT].notify(self._profile, data)
+ return
+
+
+ ## inline void onReceiverError(const cdrMemoryStream& data)
+ def onReceiverError(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_ERROR].notify(self._profile, data)
+ return
+
+
+def InPortDSProviderInit():
+ factory = OpenRTM_aist.InPortProviderFactory.instance()
+ factory.addFactory("data_service",
+ OpenRTM_aist.InPortDSProvider,
+ OpenRTM_aist.Delete)
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -211,20 +211,34 @@
if not self._buffer:
return self.PRECONDITION_NOT_MET
- if type(data) == list:
- ret = self._buffer.read(data)
+ cdr = [""]
+ ret = self._buffer.read(cdr)
+
+
+ if not self._dataType:
+ return self.PRECONDITION_NOT_MET
+ if self._endian is not None:
+ _data = cdrUnmarshal(any.to_any(self._dataType).typecode(),cdr[0],self._endian)
+ if type(data) == list:
+ data[0] = _data
else:
- tmp = [data]
- ret = self._buffer.read(tmp)
+ self._rtcout.RTC_ERROR("unknown endian from connector")
+ return self.PRECONDITION_NOT_MET
+
+
+
+
-
if ret == OpenRTM_aist.BufferStatus.BUFFER_OK:
+ self.onBufferRead(cdr[0])
return self.PORT_OK
elif ret == OpenRTM_aist.BufferStatus.BUFFER_EMPTY:
+ self.onBufferEmpty(cdr[0])
return self.BUFFER_EMPTY
elif ret == OpenRTM_aist.BufferStatus.TIMEOUT:
+ self.onBufferReadTimeout(cdr[0])
return self.BUFFER_TIMEOUT
elif ret == OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET:
@@ -369,19 +383,7 @@
#
# ReturnCode write(const OpenRTM::CdrData& data);
def write(self, data):
- if not self._dataType:
- return OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET
-
- _data = None
- # CDR -> (conversion) -> data
- if self._endian is not None:
- _data = cdrUnmarshal(any.to_any(self._dataType).typecode(),data,self._endian)
-
- else:
- self._rtcout.RTC_ERROR("unknown endian from connector")
- return OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET
-
- return self._buffer.write(_data)
+ return self._buffer.write(data)
##
@@ -407,3 +409,18 @@
if self._listeners and self._profile:
self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_DISCONNECT].notify(self._profile)
return
+
+
+ def onBufferRead(self, data):
+ if self._listeners and self._profile:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ].notify(self._profile, data)
+ return
+ def onBufferEmpty(self, data):
+ if self._listeners and self._profile:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_EMPTY].notify(self._profile, data)
+ return
+ def onBufferReadTimeout(self, data):
+ if self._listeners and self._profile:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ_TIMEOUT].notify(self._profile, data)
+ return
+
\ No newline at end of file
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -15,6 +15,7 @@
import OpenRTM
+
##
# @if jp
# @class InPortSHMProvider
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Macho.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Macho.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Macho.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,939 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Macho.py
+# @brief The Machine Objects class library
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+
+class _EmptyBox:
+ def __init__(self):
+ pass
+
+_EmptyBox.theEmptyBox = _EmptyBox()
+
+
+
+
+class _KeyData:
+ def __init__(self):
+ self.instanceGenerator = None
+ self.childPredicate = None
+ self.name = None
+ self.id = 0
+
+
+class _StateSpecification(object):
+ def __init__(self, instance):
+ self._myStateInstance = instance
+ def isChild(key):
+ return False
+ isChild = staticmethod(isChild)
+
+ def setState(self, S):
+ global _theDefaultInitializer
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _theDefaultInitializer)
+
+ def setState1(self,S,p1):
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _Initializer1(p1))
+
+ def setState2(self,S,p1,p2):
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _Initializer2(p1,p2))
+ def setState3(self,S,p1,p2,p3):
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _Initializer3(p1,p2,p3))
+ def setState4(self,S,p1,p2,p3,p4):
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _Initializer4(p1,p2,p3,p4))
+ def setState5(self,S,p1,p2,p3,p4,p5):
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _Initializer5(p1,p2,p3,p4,p5))
+ def setState6(self,S,p1,p2,p3,p4,p5,p6):
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _Initializer6(p1,p2,p3,p4,p5,p6))
+ def setStateHistory(self, S):
+ global _theHistoryInitializer
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.setPendingState(instance, _theHistoryInitializer)
+ def setStateAlias(self,state):
+ state.setState(self._myStateInstance.machine())
+ def setStateBox(self, SUPERSTATE, S, box=None):
+ global _theDefaultInitializer
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, SUPERSTATE, S)
+ m.myPendingBox = box
+ m.setPendingState(instance, _theDefaultInitializer)
+ def setStateDirect(self, S, box=None):
+ global _theDefaultInitializer
+ m = self._myStateInstance.machine()
+ instance = S._getInstance(m, S.SUPER, S)
+ m.myPendingBox = box
+ m.setPendingState(instance, _theDefaultInitializer)
+ def _restore(self, current):
+ self._myStateInstance.machine().myCurrentState = current
+ def setStateCurrent(self, current):
+ global _theDefaultInitializer
+ self._myStateInstance.machine().setPendingState(current, _theDefaultInitializer)
+ def _shutdown(self):
+ self._myStateInstance.machine().shutdown()
+ def _setHistorySuper(self, instance, deep):
+ pass
+ def exit(self):
+ pass
+ def entry(self):
+ pass
+ def init(self):
+ pass
+ def _getInstance(machine, S=None, C=None):
+ instance = machine.getInstances()
+ if not instance[0]:
+ instance[0] = _RootInstance(machine, 0)
+ return instance[0]
+ _getInstance = staticmethod(_getInstance)
+ def _deleteBox(self, instance):
+ pass
+ def _saveHistory(self, instance, shallow, deep):
+ pass
+
+
+
+
+
+
+
+
+class Link(_StateSpecification):
+ def __init__(self, instance):
+ super(Link,self).__init__(instance)
+ self.super_obj = self.SUPER(self.SUPER._getInstance(instance.machine(), self.SUPER.SUPER, self.SUPER))
+
+ #super_class.__init__(self, instance)
+ #self.SUPER.__init__(self, self.SUPER._getInstance(instance.machine()))
+ self._myStateInstance = instance
+ def key(instance):
+ k = _KeyData()
+ k.instanceGenerator = Link._getInstance
+ k.childPredicate = Link.isChild
+ k.name = instance.SUPER._state_name()
+ k.id = instance.SUPER.StateID
+ return k
+ key = staticmethod(key)
+ def alias():
+ return Alias(Link.key(self))
+ alias = staticmethod(alias)
+ def isChild(other, SUPER):
+ return Link.key(self) == other or SUPER.isChild(other)
+ isChild = staticmethod(isChild)
+ def isParent(other):
+ return other.childPredicate(Link.key(self))
+ isParent = staticmethod(isParent)
+ def isCurrent(machine):
+ return machine.currentState().isChild(Link.key(self))
+ isCurrent = staticmethod(isCurrent)
+ def isCurrentDirect(machine):
+ return Link.key(self) == machine.currentState()
+ isCurrentDirect = staticmethod(isCurrentDirect)
+ def clearHistory(machine, StateID):
+ instance = machine.getInstance(StateID)
+ if instance:
+ instance.setHistory(0)
+ clearHistory = staticmethod(clearHistory)
+ def clearHistoryDeep(machine, StateID):
+ instance = machine.getInstance(StateID)
+ if instance:
+ instance.clearHistoryDeep(Machine.theStateCount,instance)
+ clearHistoryDeep = staticmethod(clearHistoryDeep)
+ def history(machine, StateID):
+ instance = machine.getInstance(StateID)
+ history = 0
+ if instance:
+ history = instance.history()
+ if history:
+ return history.key()
+ else:
+ return Link.key(self)
+ history = staticmethod(history)
+ def entry(self):
+ pass
+ def init(self):
+ pass
+ def exit(self):
+ pass
+ def _box(self):
+
+ return self._myStateInstance.box()
+ def _getInstance(machine, S, C):
+
+ instance = machine.getInstances()
+
+ if not instance[C.StateID]:
+ instance[C.StateID] = _SubstateInstance(machine, S._getInstance(machine, S.SUPER, S), C)
+ return instance[C.StateID]
+ _getInstance = staticmethod(_getInstance)
+ def _deleteBox(self, instance):
+ instance.deleteBox()
+ def _saveHistory(self,instance,shallow,deep):
+ self._setHistorySuper(instance,deep)
+ def __getitem__(self, class_):
+ obj = self
+ while hasattr(obj, "super_obj"):
+ obj = obj.super_obj
+
+ if isinstance(class_, str):
+ if obj.__class__.__name__ == class_:
+ return obj
+ elif type(obj) == class_:
+ return obj
+
+ return None
+
+
+
+class StateID:
+ def __init__(self):
+ pass
+ value = 0
+
+class _StateInstance(object):
+ def __init__(self, machine, parent):
+ self.myMachine = machine
+ self.mySpecification = None
+ self.myHistory = None
+ self.myParent = parent
+
+ self.myBox = None
+ self.myBoxPlace = None
+ def entry(self,previous,first=True):
+ if not self.myParent:
+ return
+ if first or not previous.isChild(self):
+ self.myParent.entry(previous,False)
+ self.createBox()
+ self.mySpecification.entry()
+ def exit(self,next):
+
+ if not self.myParent:
+ return
+
+ if self is next or not next.isChild(self):
+ self.mySpecification.exit()
+ if self.myBox is not _EmptyBox.theEmptyBox:
+ self.mySpecification._deleteBox(self)
+ self.myParent.exit(next)
+
+
+ def init(self, history):
+ global _theDefaultInitializer
+ if history and self.myHistory:
+ self.myMachine.setPendingState(self.myHistory, _theDefaultInitializer)
+ else:
+ self.mySpecification.init()
+ self.myHistory = None
+
+
+ def entry_next(self,next):
+ pass
+ def entry_history(self,history):
+ pass
+ def saveHistory(self,shallow,deep):
+ self.mySpecification._saveHistory(self, shallow, deep)
+ def setHistorySuper(self, deep):
+ if self.myParent:
+ self.myParent.saveHistory(self, deep)
+ def copy(self, original):
+ if original.myHistory:
+ history = self.myMachine.getInstance(original.myHistory.id())
+ self.setHistory(history)
+ if original.myBox:
+ self.cloneBox(original.myBox)
+ def clone(self, newMachine):
+ parent = None
+ if self.myParent:
+ parent = newMachine.createClone(self.myParent.id(), self.myParent)
+ clone = self.create(newMachine, parent)
+
+ def shutdown(self):
+ self.mySpecification._shutdown()
+ def restore(self, instance):
+ self.mySpecification._restore(instance)
+ def id(self):
+ pass
+ def key(self):
+ pass
+ def name(self):
+ pass
+ def create(self, machine, parent):
+ pass
+ def createBox(self):
+ pass
+ def deleteBox(self):
+ pass
+ def cloneBox(self,box):
+ pass
+ def setBox(self,box):
+ if self.myBoxPlace:
+ self.myBoxPlace = None
+ self.myBox = box
+ def isChild(self,instance):
+
+ return self==instance or (self.myParent and self.myParent.isChild(instance))
+ def specification(self):
+ return self.mySpecification
+ def box(self):
+ return self.myBox
+ def machine(self):
+ return self.myMachine
+ def setHistory(self,history):
+ self.myHistory = history
+ def getHistory(self):
+ return self.self.myHistory
+
+
+class _RootInstance(_StateInstance):
+ def __init__(self, machine, parent):
+ super(_RootInstance,self).__init__(machine, parent)
+ self.mySpecification = _StateSpecification(self)
+ def id(self):
+ return 0
+ def key(self):
+ return 0
+ def createBox(self):
+ pass
+ def deleteBox(self):
+ pass
+ def cloneBox(self, box):
+ pass
+ def name(self):
+ return "Root"
+ def create(self, machine, parent):
+ return _RootInstance(machine,parent)
+
+class _SubstateInstance(_StateInstance):
+ def __init__(self, machine, parent, super_class):
+ super(_SubstateInstance, self).__init__(machine, parent)
+ self.mySpecification = super_class(self)
+
+ self.SUPER = super_class
+ def __del__(self):
+ if self.myBox:
+ _deleteBox(self.myBox,self.myBoxPlace)
+ def id(self):
+ return self.SUPER.StateID
+ def key(self):
+ return self.SUPER.key(self)
+ def create(self, machine, parent):
+ _SubstateInstance(machine, parent, self.SUPER)
+ def createBox(self):
+ if not self.myBox:
+ if hasattr(self.SUPER, "Box"):
+ self.myBox = _createBox(self.myBoxPlace,self.SUPER.Box)
+ else:
+ self.myBox = _createBox(self.myBoxPlace)
+ def deleteBox(self):
+ _deleteBox(self.myBox,self.myBoxPlace)
+ def cloneBox(self, box):
+ self.myBox = _cloneBox(box)
+
+class _IEventBase:
+ def __init__(self):
+ pass
+ def dispatch(self, instance):
+ pass
+
+class IEvent(_IEventBase):
+ def __init__(self):
+ pass
+
+class _Event6(IEvent):
+ def __init__(self, handler, p1, p2, p3, p4, p5, p6):
+ self.myHandler = handler
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ self.myParam4 = p4
+ self.myParam5 = p5
+ self.myParam6 = p6
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+ getattr(behaviour,self.myHandler)(self.myParam1,self.myParam2,self.myParam3,self.myParam4,self.myParam5,self.myParam6)
+
+class _Event5(IEvent):
+ def __init__(self, handler, p1, p2, p3, p4, p5):
+ self.myHandler = handler
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ self.myParam4 = p4
+ self.myParam5 = p5
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+ getattr(behaviour,self.myHandler)(self.myParam1,self.myParam2,self.myParam3,self.myParam4,self.myParam5)
+
+
+
+
+class _Event4(IEvent):
+ def __init__(self, handler, p1, p2, p3, p4):
+ self.myHandler = handler
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ self.myParam4 = p4
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+ getattr(behaviour,self.myHandler)(self.myParam1,self.myParam2,self.myParam3,self.myParam4)
+
+
+
+class _Event3(IEvent):
+ def __init__(self, handler, p1, p2, p3):
+ self.myHandler = handler
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+ getattr(behaviour,self.myHandler)(self.myParam1,self.myParam2,self.myParam3)
+
+
+
+class _Event2(IEvent):
+ def __init__(self, handler, p1, p2):
+ self.myHandler = handler
+ self.myParam1 = p1
+ self.myParam2 = p2
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+ getattr(behaviour,self.myHandler)(self.myParam1,self.myParam2)
+
+
+
+
+class _Event1(IEvent):
+ def __init__(self, handler, p1):
+ self.myHandler = handler
+ self.myParam1 = p1
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+ getattr(behaviour,self.myHandler)(self.myParam1)
+
+
+
+class _Event0(IEvent):
+ def __init__(self, handler):
+ self.myHandler = handler
+ def dispatch(self, instance):
+ behaviour = instance.specification()
+
+ getattr(behaviour,self.myHandler)()
+
+
+
+def Event6(R,p1,p2,p3,p4,p5,p6):
+ return _Event6(R,p1,p2,p3,p4,p5,p6)
+
+
+def Event5(R,p1,p2,p3,p4,p5):
+ return _Event5(R,p1,p2,p3,p4,p5)
+
+def Event4(R,p1,p2,p3,p4):
+ return _Event4(R,p1,p2,p3,p4)
+
+def Event3(R,p1,p2,p3):
+ return _Event3(R,p1,p2,p3)
+
+def Event2(R,p1,p2):
+ return _Event2(R,p1,p2)
+
+def Event1(R,p1):
+ return _Event1(R,p1)
+
+def Event0(R):
+ return _Event0(R)
+
+
+def execute1(instance, p1):
+ behaviour = instance.specification()
+ behaviour.init(p1)
+
+def execute2(instance, p1, p2):
+ behaviour = instance.specification()
+ behaviour.init(p1, p2)
+
+def execute3(instance, p1, p2, p3):
+ behaviour = instance.specification()
+ behaviour.init(p1, p2, p3)
+
+def execute4(instance, p1, p2, p3, p4):
+ behaviour = instance.specification()
+ behaviour.init(p1, p2, p3, p4)
+
+def execute5(instance, p1, p2, p3, p4, p5):
+ behaviour = instance.specification()
+ behaviour.init(p1, p2, p3, p4, p5)
+
+def execute6(instance, p1, p2, p3, p4, p5, p6):
+ behaviour = instance.specification()
+ behaviour.init(p1, p2, p3, p4, p5, p6)
+
+
+class _Initializer:
+ def __init__(self):
+ pass
+ def clone(self):
+ pass
+ def destroy(self):
+ pass
+ def adapt(self, key):
+ return key
+ def execute(self, instance):
+ pass
+
+class _StaticInitializer(_Initializer):
+ def __init__(self):
+ pass
+ def clone(self):
+ return self
+ def destroy(self):
+ pass
+
+
+class _DefaultInitializer(_StaticInitializer):
+ def __init__(self):
+ pass
+ def execute(self, instance):
+ instance.init(False)
+
+
+
+
+class _HistoryInitializer(_StaticInitializer):
+ def __init__(self):
+ pass
+ def execute(self, instance):
+ instance.init(True)
+
+
+class _AdaptingInitializer(_Initializer):
+ def __init__(self, machine):
+ self.myMachine = machine
+ def execute(self, instance):
+ instance.init(False)
+ def clone(self):
+ return _AdaptingInitializer(self.myMachine)
+ def adapt(self, key):
+ id = key.id
+ instance = self.myMachine.getInstance(id)
+ history = None
+ if instance:
+ history = instance.history()
+ if history:
+ return history.key()
+ else:
+ return key
+
+
+class _Initializer1(_Initializer):
+ def __init__(self, p1):
+ self.myParam1 = p1
+ def clone(self):
+ return _Initializer1(self.myParam1)
+ def execute(self, instance):
+ execute1(instance, self.myParam1)
+
+
+class _Initializer2(_Initializer):
+ def __init__(self, p1, p2):
+ self.myParam1 = p1
+ self.myParam2 = p2
+ def clone(self):
+ return _Initializer2(self.myParam1,self.myParam2)
+ def execute(self, instance):
+ execute2(instance, self.myParam1,self.myParam2)
+
+
+
+class _Initializer3(_Initializer):
+ def __init__(self, p1, p2, p3):
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ def clone(self):
+ return _Initializer3(self.myParam1,self.myParam2,self.myParam3)
+ def execute(self, instance):
+ execute3(instance, self.myParam1,self.myParam2,self.myParam3)
+
+
+
+
+class _Initializer4(_Initializer):
+ def __init__(self, p1, p2, p3, p4):
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ self.myParam4 = p4
+ def clone(self):
+ return _Initializer4(self.myParam1,self.myParam2,self.myParam3,self.myParam4)
+ def execute(self, instance):
+ execute4(instance, self.myParam1,self.myParam2,self.myParam3,self.myParam4)
+
+
+
+
+class _Initializer5(_Initializer):
+ def __init__(self, p1, p2, p3, p4, p5):
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ self.myParam4 = p4
+ self.myParam5 = p5
+ def clone(self):
+ return _Initializer5(self.myParam1,self.myParam2,self.myParam3,self.myParam4,self.myParam5)
+ def execute(self, instance):
+ execute5(instance, self.myParam1,self.myParam2,self.myParam3,self.myParam4,self.myParam5)
+
+
+
+
+
+
+class _Initializer6(_Initializer):
+ def __init__(self, p1, p2, p3, p4, p5, p6):
+ self.myParam1 = p1
+ self.myParam2 = p2
+ self.myParam3 = p3
+ self.myParam4 = p4
+ self.myParam5 = p5
+ self.myParam6 = p6
+ def clone(self):
+ return _Initializer6(self.myParam1,self.myParam2,self.myParam3,self.myParam4,self.myParam5,self.myParam6)
+ def execute(self, instance):
+ execute6(instance, self.myParam1,self.myParam2,self.myParam3,self.myParam4,self.myParam5,self.myParam6)
+
+
+
+_theDefaultInitializer = _DefaultInitializer()
+_theHistoryInitializer = _HistoryInitializer()
+
+
+
+class _MachineBase(object):
+ def __init__(self):
+ self.myCurrentState = None
+ self.myPendingState = None
+ self.myPendingInit = None
+ self.myPendingBox = None
+ self.myPendingEvent = None
+ self.myInstances = None
+ def currentState(self):
+ return self.myCurrentState.key()
+ def setState(self, instance, init):
+ self.setPendingState(instance, init)
+ self.rattleOn()
+ def setStateAlias(self, state):
+ state.setState(self)
+ self.rattleOn()
+ def setPendingState(self, instance, init):
+ self.myPendingState = instance
+ self.myPendingInit = init
+ def setPendingEvent(self, event):
+ self.myPendingEvent = event
+ def rattleOn(self):
+ while self.myPendingState or self.myPendingEvent:
+ while self.myPendingState:
+
+ self.myCurrentState.exit(self.myPendingState)
+ self.myCurrentState.setHistorySuper(self.myCurrentState)
+ previous = self.myCurrentState
+
+ self.myCurrentState = self.myPendingState
+ if self.myPendingBox:
+ self.myCurrentState.setBox(self.myPendingBox)
+ self.myPendingBox = None
+
+
+ self.myCurrentState.entry(previous)
+ self.myPendingState = None
+ self.myPendingInit.execute(self.myCurrentState)
+
+ if self.myPendingEvent:
+ event = self.myPendingEvent
+ self.myPendingEvent = None
+ event.dispatch(self.myCurrentState)
+ self.myPendingInit = None
+ def getInstances(self):
+ return self.myInstances
+ def start(self, instance):
+ global _theDefaultInitializer
+ self.myCurrentState = _StateSpecification._getInstance(self)
+ self.setState(instance, _theDefaultInitializer)
+ def startAlias(self, state):
+ self.myCurrentState = _StateSpecification._getInstance(self)
+ self.setStateAlias(state)
+ def shutdown(self):
+ global _theDefaultInitializer
+ self.setState(_StateSpecification._getInstance(self), _theDefaultInitializer)
+ self.myCurrentState = None
+ def allocate(self, count):
+
+ self.myInstances = [None]*count
+
+ def free(self, count):
+ i = count
+ while i > 0:
+ i -=1
+ self.myInstances[i] = None
+
+ def clearHistoryDeep(self, count, instance):
+ for i in range(count):
+ s = self.myInstances[i]
+ if s and s.isChild(instance):
+ s.setHistory(0)
+ def copy(self, other, count):
+ for i in range(count):
+ state = self.myInstances[i]
+ if state:
+ state.copy(other[i])
+ def createClone(self, id, original):
+ clone = self.getInstances
+ if not clone[id] and original:
+ clone[id] = original.clone(self)
+ return clone[id]
+
+
+class Alias:
+ def __init__(self):
+ self.myInitializer = None
+ self.myStateKey = 0
+ def __del__(self):
+ self.myInitializer.destroy()
+ def init_history(self, key, history=False):
+ global _theHistoryInitializer
+ global _theDefaultInitializer
+ self.myStateKey = key
+ if history:
+ self.myInitializer = _theHistoryInitializer
+ else:
+ self.myInitializer = _theDefaultInitializer
+ def init_Initializer(self, key, init):
+ self.myStateKey = key
+ self.myInitializer = init
+ def init_Alias(self, other):
+ self.myStateKey = key
+ self.myInitializer = other.myInitializer.clone()
+ def equal(self, other):
+ if self is other:
+ return self
+ self.myInitializer.destroy()
+ self.myStateKey = other.childPredicate
+ self.myInitializer = other.childPredicate
+
+ def Key(self):
+ return self.key()
+ def isChild(self, k):
+ return self.key().childPredicate(k)
+ def isParent(self, k):
+ return self.key().childPredicate(k)
+ def name(self):
+ return self.key().name()
+ def id(self):
+ return self.key().id
+ def key(self):
+ return self.myInitializer.adapt(self.myStateKey)
+ def setState(self, machine):
+ machine.setPendingState(self.key().instanceGenerator(machine), self.myInitializer.clone())
+
+
+def State(S):
+ return Alias(S.key())
+
+def State1(S,p1):
+ return Alias(S.key(), _Initializer1(p1))
+
+def State2(S,p1,p2):
+ return Alias(S.key(), _Initializer2(p1,p2))
+
+
+def State3(S,p1,p2,p3):
+ return Alias(S.key(), _Initializer3(p1,p2,p3))
+
+
+def State4(S,p1,p2,p3,p4):
+ return Alias(S.key(), _Initializer4(p1,p2,p3,p4))
+
+
+def State5(S,p1,p2,p3,p4,p5):
+ return Alias(S.key(), _Initializer5(p1,p2,p3,p4,p5))
+
+
+def State6(S,p1,p2,p3,p4,p5,p6):
+ return Alias(S.key(), _Initializer6(p1,p2,p3,p4,p5,p6))
+
+
+def StateHistory(S, machine):
+ return Alias(S.key(), _AdaptingInitializer(machine))
+
+
+class Snapshot(_MachineBase):
+ def __init__(self, machine):
+ super(Snapshot,self).__init__()
+ self.allocate(Machine.theStateCount)
+ self.copy(machine.myInstances, Machine.theStateCounta)
+ self.myCurrentState = self.getInstances[machine.myCurrentState.id()]
+
+ def __del__(self):
+ self.free(Machine.theStateCount)
+
+class AfterAdvice:
+ def __init__(self, m):
+ self.myMachine = m
+ def __del__(self):
+ pass
+ #self.myMachine.rattleOn()
+ def __call__(self, func, *args):
+ spec = self.myMachine.myCurrentState.specification()
+ ret = getattr(spec,func)(*args)
+ self.myMachine.rattleOn()
+ return ret
+
+ #return self.myMachine.myCurrentState.specification()
+
+class Machine(_MachineBase):
+ theStateCount = 1
+ def __init__(self, TOP, TopBase):
+ super(Machine,self).__init__()
+ self.TOP = TOP
+ self.TopBase = TopBase
+ def __del__(self):
+ pass
+ def exit(self):
+ self.myCurrentState.shutdown()
+ self.free(Machine.theStateCount)
+ Machine.theStateCount = 1
+ def init(self, box=None):
+ self.allocate(Machine.theStateCount)
+ top = self.TOP._getInstance(self, self.TopBase, self.TOP)
+ if box:
+ top.setBox(box)
+ self.start(top)
+
+ def init_Alias(self, state, box=None):
+ self.allocate(Machine.theStateCount)
+ top = self.TOP._getInstance(self, self.TopBase, self.TOP)
+ if box:
+ top.setBox(box)
+ self.start(state)
+ def init_Snapshot(self, snapshot, box=None):
+ self.allocate(Machine.theStateCount)
+ self.copy(snapshot.myInstances, Machine.theStateCount)
+ def equal(self, snapshot):
+ self.myCurrentState.shutdown()
+ self.free(Machine.theStateCount)
+ self.copy(snapshot.myInstances, Machine.theStateCount)
+ self.myCurrentState = self.getInstance(0)
+ current = self.getInstance(snapshot.myCurrentState.id())
+ current.restore(current)
+ self.rattleOn()
+ return self
+ def __call__(self):
+ return AfterAdvice(self)
+ def dispatch(self, event, destroy=True):
+ event.dispatch(self.myCurrentState)
+ if destroy:
+ del event
+ self.rattleOn()
+
+ def box(self):
+ self.myCurrentState.specification().box()
+
+
+
+
+
+
+def _createBox(place, B=None):
+ if B:
+ return B()
+ else:
+ return _EmptyBox.theEmptyBox
+
+
+def _deleteBox(box, place):
+ pass
+
+def _cloneBox(other):
+ return _EmptyBox.theEmptyBox
+
+
+def TopBase(TOP):
+ class TopBase_(_StateSpecification):
+ SUPER = _StateSpecification
+ StateID = 0
+ def __init__(self, instance):
+ super(TopBase_,self).__init__(instance)
+ self.T = TOP
+ def dispatch(self, event):
+ self._myStateInstance.machine().setPendingEvent(event)
+ def machine(self):
+ return self._myStateInstance.machine()
+
+ return TopBase_
+
+
+def TOPSTATE(TOP):
+ TOP.SUPER = TopBase(TOP)
+ TOP.StateID = Machine.theStateCount
+ Machine.theStateCount += 1
+ TOP._state_name = staticmethod(lambda : TOP.__name__)
+
+ TOP.box = lambda self: self._box()
+
+
+def SUBSTATE(STATE, SUPERSTATE):
+ STATE.SUPER = SUPERSTATE
+ STATE.StateID = Machine.theStateCount
+ Machine.theStateCount += 1
+ STATE._state_name = staticmethod(lambda : STATE.__name__)
+ STATE.box = lambda self: self._box()
+
+def DEEPHISTORY(STATE):
+ def _saveHistory(self,instance,shallow,deep):
+ instance.setHistory(deep)
+ self[self.SUPER]._setHistorySuper(instance,deep)
+
+ STATE._saveHistory = _saveHistory
+
+ STATE._setHistorySuper = lambda self,instance,deep: instance.setHistorySuper(deep)
+
+def HISTORY(STATE):
+ def _saveHistory(self,instance,shallow,deep):
+ instance.setHistory(deep)
+ self[self.SUPER]._setHistorySuper(instance,deep)
+
+ STATE._saveHistory = _saveHistory
+
+ STATE._setHistorySuper = lambda self,instance,deep: instance.setHistorySuper(deep)
+
+
\ No newline at end of file
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPort.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPort.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPort.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -101,6 +101,8 @@
#self._OnUnderflow = None
#self._OnConnect = None
#self._OnDisconnect = None
+ self.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE, OpenRTM_aist.Timestamp("on_write"))
+ self.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_SEND, OpenRTM_aist.Timestamp("on_send"))
def __del__(self, OutPortBase=OpenRTM_aist.OutPortBase):
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -273,6 +273,7 @@
self._rtcout.RTC_DEBUG("available subscription_type: %s", pubs)
self.addProperty("dataport.subscription_type", pubs)
+ self.addProperty("dataport.io_mode", pubs)
self._properties = OpenRTM_aist.Properties()
self._name = name
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -22,6 +22,7 @@
import OpenRTM_aist
import OpenRTM
+
##
# @if jp
# @class OutPortCorbaCdrConsumer
@@ -199,6 +200,7 @@
outportcdr = self.getObject()._narrow(OpenRTM.OutPortCdr)
ret,cdr_data = outportcdr.get()
+
if ret == OpenRTM.PORT_OK:
self._rtcout.RTC_DEBUG("get() successful")
data[0] = cdr_data
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -21,6 +21,7 @@
import OpenRTM_aist
import OpenRTM__POA,OpenRTM
+
##
# @if jp
# @class OutPortCorbaCdrProvider
@@ -304,8 +305,10 @@
self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
return (OpenRTM.UNKNOWN_ERROR, "")
- return self.convertReturn(ret, cdr[0])
+ data = self.convertReturn(ret, cdr[0])
+ return data
+
##
# @if jp
# @brief ON_BUFFER_READ ¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSConsumer.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSConsumer.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSConsumer.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,435 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+
+##
+# @file OutPortDSConsumer.py
+# @brief OutPortDSConsumer class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+from omniORB import any
+import OpenRTM_aist
+import RTC
+
+##
+# @if jp
+# @class OutPortDSConsumer
+#
+# @brief OutPortDSConsumer ¥¯¥é¥¹
+#
+# ÄÌ¿®¼êÃÊ¤Ë CORBA ¤òÍøÍѤ·¤¿½ÐÎϥݡ¼¥È¥³¥ó¥·¥å¡¼¥Þ¤Î¼ÂÁõ¥¯¥é¥¹¡£
+#
+# @param DataType Ëܥݡ¼¥È¤Ë¤Æ°·¤¦¥Ç¡¼¥¿·¿
+#
+# @since 1.2.0
+#
+# @else
+# @class OutPortDSConsumer
+#
+# @brief OutPortDSConsumer class
+#
+# This is an implementation class of the output Consumer
+# that uses CORBA for means of communication.
+#
+# @param DataType Data type for this port
+#
+# @since 1.2.0
+#
+# @endif
+#
+class OutPortDSConsumer(OpenRTM_aist.OutPortConsumer,OpenRTM_aist.CorbaConsumer):
+ """
+ """
+
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param buffer Ëܥݡ¼¥È¤Ë³ä¤êÅö¤Æ¤ë¥Ð¥Ã¥Õ¥¡
+ #
+ # @else
+ # @brief Constructor
+ #
+ # Constructor
+ #
+ # @param buffer Buffer that is attached to this port
+ #
+ # @endif
+ #
+ def __init__(self):
+ OpenRTM_aist.CorbaConsumer.__init__(self)
+ self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("OutPortDSConsumer")
+ self._buffer = None
+ self._profile = None
+ self._listeners = None
+ return
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # @else
+ # @brief Destructor
+ #
+ # Destructor
+ #
+ # @endif
+ #
+ def __del__(self, CorbaConsumer=OpenRTM_aist.CorbaConsumer):
+ self._rtcout.RTC_PARANOID("~OutPortDSConsumer()")
+ CorbaConsumer.__del__(self)
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ÀßÄê½é´ü²½
+ #
+ # OutPortConsumer¤Î³Æ¼ïÀßÄê¤ò¹Ô¤¦¡£¼ÂÁõ¥¯¥é¥¹¤Ç¤Ï¡¢Í¿¤¨¤é¤ì¤¿
+ # Properties¤«¤éɬÍפʾðÊó¤ò¼èÆÀ¤·¤Æ³Æ¼ïÀßÄê¤ò¹Ô¤¦¡£¤³¤Î init() ´Ø
+ # ¿ô¤Ï¡¢OutPortProviderÀ¸À®Ä¾¸å¤ª¤è¤Ó¡¢Àܳ»þ¤Ë¤½¤ì¤¾¤ì¸Æ¤Ð¤ì¤ë²Ä
+ # ǽÀ¤¬¤¢¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢¤³¤Î´Ø¿ô¤ÏÊ£¿ô²ó¸Æ¤Ð¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æµ
+ # ½Ò¤µ¤ì¤ë¤Ù¤¤Ç¤¢¤ë¡£
+ #
+ # @param prop ÀßÄê¾ðÊó
+ #
+ # @else
+ #
+ # @brief Initializing configuration
+ #
+ # This operation would be called to configure in initialization.
+ # In the concrete class, configuration should be performed
+ # getting appropriate information from the given Properties data.
+ # This function might be called right after instantiation and
+ # connection sequence respectivly. Therefore, this function
+ # should be implemented assuming multiple call.
+ #
+ # @param prop Configuration information
+ #
+ # @endif
+ #
+ # virtual void init(coil::Properties& prop);
+ def init(self, prop):
+ self._rtcout.RTC_TRACE("init()")
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ð¥Ã¥Õ¥¡¤ò¥»¥Ã¥È¤¹¤ë
+ #
+ # OutPortConsumer¤¬¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¥Ð¥Ã¥Õ¥¡¤ò¥»¥Ã¥È¤¹¤ë¡£
+ # ¤¹¤Ç¤Ë¥»¥Ã¥È¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤¬¤¢¤ë¾ì¹ç¡¢°ÊÁ°¤Î¥Ð¥Ã¥Õ¥¡¤Ø¤Î
+ # ¥Ý¥¤¥ó¥¿¤ËÂФ·¤Æ¾å½ñ¤¤µ¤ì¤ë¡£
+ # OutPortProvider¤Ï¥Ð¥Ã¥Õ¥¡¤Î½ê͸¢¤ò²¾Äꤷ¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢
+ # ¥Ð¥Ã¥Õ¥¡¤Îºï½ü¤Ï¥æ¡¼¥¶¤ÎÀÕǤ¤Ç¹Ô¤ï¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param buffer OutPortProvider¤¬¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¥Ð¥Ã¥Õ¥¡¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Setting outside buffer's pointer
+ #
+ # A pointer to a buffer from which OutPortProvider retrieve data.
+ # If already buffer is set, previous buffer's pointer will be
+ # overwritten by the given pointer to a buffer. Since
+ # OutPortProvider does not assume ownership of the buffer
+ # pointer, destructor of the buffer should be done by user.
+ #
+ # @param buffer A pointer to a data buffer to be used by OutPortProvider
+ #
+ # @endif
+ #
+ # virtual void setBuffer(CdrBufferBase* buffer);
+ def setBuffer(self, buffer):
+ self._rtcout.RTC_TRACE("setBuffer()")
+ self._buffer = buffer
+ return
+
+
+ # void OutPortDSConsumer::setListener(ConnectorInfo& info,
+ # ConnectorListeners* listeners)
+ def setListener(self, info, listeners):
+ self._rtcout.RTC_TRACE("setListener()")
+ self._listeners = listeners
+ self._profile = info
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¡¼¥¿¤òÆɤ߽Ф¹
+ #
+ # ÀßÄꤵ¤ì¤¿¥Ç¡¼¥¿¤òÆɤ߽Ф¹¡£
+ #
+ # @param data Æɤ߽Ф·¤¿¥Ç¡¼¥¿¤ò¼õ¤±¼è¤ë¥ª¥Ö¥¸¥§¥¯¥È
+ #
+ # @return ¥Ç¡¼¥¿Æɤ߽Ф·½èÍý·ë²Ì(Æɤ߽Ф·À®¸ù:true¡¢Æɤ߽Ф·¼ºÇÔ:false)
+ #
+ # @else
+ # @brief Read data
+ #
+ # Read set data
+ #
+ # @param data Object to receive the read data
+ #
+ # @return Read result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # virtual ReturnCode get(cdrMemoryStream& data);
+ def get(self, data):
+ self._rtcout.RTC_PARANOID("get()")
+
+ try:
+ ds = self.getObject()._narrow(RTC.DataPullService)
+ ret,cdr_data = ds.pull()
+
+ if ret == RTC.PORT_OK:
+ self._rtcout.RTC_DEBUG("get() successful")
+ data[0] = cdr_data
+ self.onReceived(data[0])
+ self.onBufferWrite(data[0])
+
+ if self._buffer.full():
+ self._rtcout.RTC_INFO("InPort buffer is full.")
+ self.onBufferFull(data[0])
+ self.onReceiverFull(data[0])
+
+ self._buffer.put(data[0])
+ self._buffer.advanceWptr()
+ self._buffer.advanceRptr()
+
+ return self.PORT_OK
+ return self.convertReturn(ret,data[0])
+
+ except:
+ self._rtcout.RTC_WARN("Exception caught from OutPort.get().")
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ return self.CONNECTION_LOST
+
+
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¡¼¥¿¼õ¿®ÄÌÃΤؤÎÅÐÏ¿
+ #
+ # »ØÄꤵ¤ì¤¿¥×¥í¥Ñ¥Æ¥£¤Ë´ð¤Å¤¤¤Æ¡¢¥Ç¡¼¥¿¼õ¿®ÄÌÃΤμõ¤±¼è¤ê¤ËÅÐÏ¿¤¹¤ë¡£
+ #
+ # @param properties ÅÐÏ¿¾ðÊó
+ #
+ # @return ÅÐÏ¿½èÍý·ë²Ì(ÅÐÏ¿À®¸ù:true¡¢ÅÐÏ¿¼ºÇÔ:false)
+ #
+ # @else
+ # @brief Subscribe the data receive notification
+ #
+ # Subscribe the data receive notification based on specified property
+ # information
+ #
+ # @param properties Subscription information
+ #
+ # @return Subscription result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # virtual bool subscribeInterface(const SDOPackage::NVList& properties);
+ def subscribeInterface(self, properties):
+ self._rtcout.RTC_TRACE("subscribeInterface()")
+ index = OpenRTM_aist.NVUtil.find_index(properties,"dataport.data_service.outport_ior")
+
+ if index < 0:
+ self._rtcout.RTC_DEBUG("dataport.data_service.outport_ior not found.")
+ return False
+
+ if OpenRTM_aist.NVUtil.isString(properties,"dataport.data_service.outport_ior"):
+ self._rtcout.RTC_DEBUG("dataport.data_service.outport_ior found.")
+ ior = ""
+ #try:
+ ior = any.from_any(properties[index].value, keep_structs=True)
+ #except:
+ # self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ orb = OpenRTM_aist.Manager.instance().getORB()
+ obj = orb.string_to_object(ior)
+ ret = self.setObject(obj)
+ if ret:
+ self._rtcout.RTC_DEBUG("CorbaConsumer was set successfully.")
+ else:
+ self._rtcout.RTC_ERROR("Invalid object reference.")
+
+ return ret
+
+ return False
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¡¼¥¿¼õ¿®ÄÌÃΤ«¤é¤ÎÅÐÏ¿²ò½ü
+ #
+ # ¥Ç¡¼¥¿¼õ¿®ÄÌÃΤμõ¤±¼è¤ê¤«¤éÅÐÏ¿¤ò²ò½ü¤¹¤ë¡£
+ #
+ # @param properties ÅÐÏ¿²ò½ü¾ðÊó
+ #
+ # @else
+ # @brief Unsubscribe the data receive notification
+ #
+ # Unsubscribe the data receive notification.
+ #
+ # @param properties Unsubscription information
+ #
+ # @endif
+ #
+ # virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
+ def unsubscribeInterface(self, properties):
+ self._rtcout.RTC_TRACE("unsubscribeInterface()")
+ index = OpenRTM_aist.NVUtil.find_index(properties,
+ "dataport.data_service.outport_ior")
+ if index < 0:
+ self._rtcout.RTC_DEBUG("dataport.data_service.outport_ior not found.")
+ return
+
+ ior = ""
+
+ try:
+ ior = any.from_any(properties[index].value, keep_structs=True)
+
+ if ior:
+ self._rtcout.RTC_DEBUG("dataport.data_service.outport_ior found.")
+ orb = OpenRTM_aist.Manager.instance().getORB()
+ obj = orb.string_to_object(ior)
+ if self._ptr(True)._is_equivalent(obj):
+ self.releaseObject()
+ self._rtcout.RTC_DEBUG("CorbaConsumer's reference was released.")
+ return
+
+ self._rtcout.RTC_ERROR("hmm. Inconsistent object reference.")
+
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥ê¥¿¡¼¥ó¥³¡¼¥ÉÊÑ´¹ (DataPortStatus -> BufferStatus)
+ # @else
+ # @brief Return codes conversion
+ # @endif
+ #
+ # ReturnCode convertReturn(::OpenRTM::PortStatus status,
+ # const cdrMemoryStream& data)
+ def convertReturn(self, status, data):
+ if status == RTC.PORT_OK:
+ # never comes here
+ return self.PORT_OK
+
+ elif status == RTC.PORT_ERROR:
+ self.onSenderError()
+ return self.PORT_ERROR
+
+ elif status == RTC.BUFFER_FULL:
+ # never comes here
+ return self.BUFFER_FULL
+
+ elif status == RTC.BUFFER_EMPTY:
+ self.onSenderEmpty()
+ return self.BUFFER_EMPTY
+
+ elif status == RTC.BUFFER_TIMEOUT:
+ self.onSenderTimeout()
+ return self.BUFFER_TIMEOUT
+
+ elif status == RTC.UNKNOWN_ERROR:
+ self.onSenderError()
+ return self.UNKNOWN_ERROR
+
+ else:
+ self.onSenderError()
+ return self.UNKNOWN_ERROR
+
+
+
+
+ ##
+ # @brief Connector data listener functions
+ #
+ # inline void onBufferWrite(const cdrMemoryStream& data)
+ def onBufferWrite(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE].notify(self._profile, data)
+
+ return
+
+
+ # inline void onBufferFull(const cdrMemoryStream& data)
+ def onBufferFull(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_FULL].notify(self._profile, data)
+
+ return
+
+
+ # inline void onReceived(const cdrMemoryStream& data)
+ def onReceived(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED].notify(self._profile, data)
+
+ return
+
+
+ # inline void onReceiverFull(const cdrMemoryStream& data)
+ def onReceiverFull(self, data):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_FULL].notify(self._profile, data)
+
+ return
+
+
+ ##
+ # @brief Connector listener functions
+ #
+ # inline void onSenderEmpty()
+ def onSenderEmpty(self):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_SENDER_EMPTY].notify(self._profile)
+
+ return
+
+
+ # inline void onSenderTimeout()
+ def onSenderTimeout(self):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_SENDER_TIMEOUT].notify(self._profile)
+
+ return
+
+
+ # inline void onSenderError()
+ def onSenderError(self):
+ if self._listeners is not None and self._profile is not None:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_SENDER_ERROR].notify(self._profile)
+
+ return
+
+
+def OutPortDSConsumerInit():
+ factory = OpenRTM_aist.OutPortConsumerFactory.instance()
+ factory.addFactory("data_service",
+ OpenRTM_aist.OutPortDSConsumer,
+ OpenRTM_aist.Delete)
+ return
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSProvider.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortDSProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,455 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file OutPortDSProvider.py
+# @brief OutPortDSider class
+# @date $Date: 2017-06-09 07:49:59 $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+import OpenRTM_aist
+import RTC__POA,RTC
+
+##
+# @if jp
+# @class OutPortDSProvider
+# @brief OutPortDSProvider ¥¯¥é¥¹
+#
+# OutPortProvider
+#
+# ¥Ç¡¼¥¿Å¾Á÷¤Ë CORBA ¤Î OpenRTM::DataPullService ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤òÍøÍѤ·
+# ¤¿¡¢pull ·¿¥Ç¡¼¥¿¥Õ¥í¡¼·¿¤ò¼Â¸½¤¹¤ë OutPort ¥×¥í¥Ð¥¤¥À¥¯¥é¥¹¡£
+#
+# @since 1.2.0
+#
+# @else
+# @class OutPortDSProvider
+# @brief OutPortDSProvider class
+#
+# The OutPort provider class which uses the OpenRTM::DataPullService
+# interface in CORBA for data transfer and realizes a pull-type
+# dataflow.
+#
+# @since 1.2.0
+#
+# @endif
+#
+class OutPortDSProvider(OpenRTM_aist.OutPortProvider,
+ RTC__POA.DataPullService):
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param buffer Åö³º¥×¥í¥Ð¥¤¥À¤Ë³ä¤êÅö¤Æ¤ë¥Ð¥Ã¥Õ¥¡¥ª¥Ö¥¸¥§¥¯¥È
+ #
+ # @else
+ # @brief Constructor
+ #
+ # Constructor
+ #
+ # @param buffer Buffer object that is assigned to this provider
+ #
+ # @endif
+ #
+ def __init__(self):
+ OpenRTM_aist.OutPortProvider.__init__(self)
+ self.setInterfaceType("data_service")
+
+ # ConnectorProfile setting
+ self._objref = self._this()
+
+ self._buffer = None
+
+ # set outPort's reference
+ orb = OpenRTM_aist.Manager.instance().getORB()
+
+ self._properties.append(OpenRTM_aist.NVUtil.newNV("dataport.data_service.outport_ior",
+ orb.object_to_string(self._objref)))
+ self._properties.append(OpenRTM_aist.NVUtil.newNV("dataport.data_service.outport_ref",
+ self._objref))
+
+ self._listeners = None
+ self._connector = None
+ self._profile = None
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # @else
+ # @brief Destructor
+ #
+ # Destructor
+ #
+ # @endif
+ #
+ def __del__(self):
+ return
+
+ ##
+ # @if jp
+ # @brief ½ªÎ»½èÍý
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
+ oid = self._default_POA().servant_to_id(self)
+ self._default_POA().deactivate_object(oid)
+
+ ##
+ # @if jp
+ # @brief ÀßÄê½é´ü²½
+ #
+ # InPortConsumer¤Î³Æ¼ïÀßÄê¤ò¹Ô¤¦¡£¼ÂÁõ¥¯¥é¥¹¤Ç¤Ï¡¢Í¿¤¨¤é¤ì¤¿
+ # Properties¤«¤éɬÍפʾðÊó¤ò¼èÆÀ¤·¤Æ³Æ¼ïÀßÄê¤ò¹Ô¤¦¡£¤³¤Î init() ´Ø
+ # ¿ô¤Ï¡¢OutPortProviderÀ¸À®Ä¾¸å¤ª¤è¤Ó¡¢Àܳ»þ¤Ë¤½¤ì¤¾¤ì¸Æ¤Ð¤ì¤ë²Ä
+ # ǽÀ¤¬¤¢¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢¤³¤Î´Ø¿ô¤ÏÊ£¿ô²ó¸Æ¤Ð¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æµ
+ # ½Ò¤µ¤ì¤ë¤Ù¤¤Ç¤¢¤ë¡£
+ #
+ # @param prop ÀßÄê¾ðÊó
+ #
+ # @else
+ #
+ # @brief Initializing configuration
+ #
+ # This operation would be called to configure in initialization.
+ # In the concrete class, configuration should be performed
+ # getting appropriate information from the given Properties data.
+ # This function might be called right after instantiation and
+ # connection sequence respectivly. Therefore, this function
+ # should be implemented assuming multiple call.
+ #
+ # @param prop Configuration information
+ #
+ # @endif
+ #
+ # virtual void init(coil::Properties& prop);
+ def init(self, prop):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ¥Ð¥Ã¥Õ¥¡¤ò¥»¥Ã¥È¤¹¤ë
+ #
+ # OutPortProvider¤¬¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¥Ð¥Ã¥Õ¥¡¤ò¥»¥Ã¥È¤¹¤ë¡£
+ # ¤¹¤Ç¤Ë¥»¥Ã¥È¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤¬¤¢¤ë¾ì¹ç¡¢°ÊÁ°¤Î¥Ð¥Ã¥Õ¥¡¤Ø¤Î
+ # ¥Ý¥¤¥ó¥¿¤ËÂФ·¤Æ¾å½ñ¤¤µ¤ì¤ë¡£
+ # OutPortProvider¤Ï¥Ð¥Ã¥Õ¥¡¤Î½ê͸¢¤ò²¾Äꤷ¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢
+ # ¥Ð¥Ã¥Õ¥¡¤Îºï½ü¤Ï¥æ¡¼¥¶¤ÎÀÕǤ¤Ç¹Ô¤ï¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param buffer OutPortProvider¤¬¥Ç¡¼¥¿¤ò¼è¤ê½Ð¤¹¥Ð¥Ã¥Õ¥¡¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Setting outside buffer's pointer
+ #
+ # A pointer to a buffer from which OutPortProvider retrieve data.
+ # If already buffer is set, previous buffer's pointer will be
+ # overwritten by the given pointer to a buffer. Since
+ # OutPortProvider does not assume ownership of the buffer
+ # pointer, destructor of the buffer should be done by user.
+ #
+ # @param buffer A pointer to a data buffer to be used by OutPortProvider
+ #
+ # @endif
+ #
+ # virtual void setBuffer(BufferBase<cdrMemoryStream>* buffer);
+ def setBuffer(self, buffer):
+ self._buffer = buffer
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # OutPort ¤Ï¥Ç¡¼¥¿Á÷¿®½èÍý¤Ë¤ª¤±¤ë³Æ¼ï¥¤¥Ù¥ó¥È¤ËÂФ·¤ÆÆÃÄê¤Î¥ê¥¹¥Ê
+ # ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥³¡¼¥ë¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯µ¡¹½¤òÄ󶡤¹¤ë¡£¾ÜºÙ¤Ï
+ # ConnectorListener.h ¤Î ConnectorDataListener, ConnectorListener
+ # Åù¤ò»²¾È¤Î¤³¤È¡£OutPortDSProvider ¤Ç¤Ï¡¢°Ê²¼¤Î¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ¤¬Ä󶡤µ¤ì¤ë¡£
+ #
+ # - ON_BUFFER_READ
+ # - ON_SEND
+ # - ON_BUFFER_EMPTY
+ # - ON_BUFFER_READ_TIMEOUT
+ # - ON_SENDER_EMPTY
+ # - ON_SENDER_TIMEOUT
+ # - ON_SENDER_ERROR
+ #
+ # @param info Àܳ¾ðÊó
+ # @param listeners ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È
+ #
+ # @else
+ # @brief Set the listener.
+ #
+ # OutPort provides callback functionality that calls specific
+ # listener objects according to the events in the data publishing
+ # process. For details, see documentation of
+ # ConnectorDataListener class and ConnectorListener class in
+ # ConnectorListener.h. In this OutPortDSProvider provides
+ # the following callbacks.
+ #
+ # - ON_BUFFER_READ
+ # - ON_SEND
+ # - ON_BUFFER_EMPTY
+ # - ON_BUFFER_READ_TIMEOUT
+ # - ON_SENDER_EMPTY
+ # - ON_SENDER_TIMEOUT
+ # - ON_SENDER_ERROR
+ #
+ # @param info Connector information
+ # @param listeners Listener objects
+ #
+ # @endif
+ #
+ # virtual void setListener(ConnectorInfo& info,
+ # ConnectorListeners* listeners);
+ def setListener(self, info, listeners):
+ self._profile = info
+ self._listeners = listeners
+ return
+
+
+ ##
+ # @if jp
+ # @brief Connector¤òÀßÄꤹ¤ë¡£
+ #
+ # OutPort ¤ÏÀܳ³ÎΩ»þ¤Ë OutPortConnector ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¡¢À¸
+ # À®¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ý¥¤¥ó¥¿¤È¶¦¤Ë¤³¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¡£½ê͸¢¤Ï
+ # OutPort ¤¬ÊÝ»ý¤¹¤ë¤Î¤Ç OutPortProvider ¤Ï OutPortConnector ¤òºï
+ # ½ü¤·¤Æ¤Ï¤¤¤±¤Ê¤¤¡£
+ #
+ # @param connector OutPortConnector
+ #
+ # @else
+ # @brief set Connector
+ #
+ # OutPort creates OutPortConnector object when it establishes
+ # connection between OutPort and InPort, and it calls this
+ # function with a pointer to the connector object. Since the
+ # OutPort has the ownership of this connector, OutPortProvider
+ # should not delete it.
+ #
+ # @param connector OutPortConnector
+ #
+ # @endif
+ #
+ # virtual void setConnector(OutPortConnector* connector);
+ def setConnector(self, connector):
+ self._connector = connector
+ return
+
+
+ def get(self):
+ self._rtcout.RTC_PARANOID("OutPortDSProvider.get()")
+ return (RTC.UNKNOWN_ERROR, "")
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ¥Ð¥Ã¥Õ¥¡¤«¤é¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë
+ #
+ # ÀßÄꤵ¤ì¤¿ÆâÉô¥Ð¥Ã¥Õ¥¡¤«¤é¥Ç¡¼¥¿¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @return ¼èÆÀ¥Ç¡¼¥¿
+ #
+ # @else
+ # @brief [CORBA interface] Get data from the buffer
+ #
+ # Get data from the internal buffer.
+ #
+ # @return Data got from the buffer.
+ #
+ # @endif
+ #
+ # virtual ::OpenRTM::PortStatus pull(::RTC::CdrData_out data);
+ def pull(self):
+ self._rtcout.RTC_PARANOID("OutPortDSProvider.pull()")
+ if not self._buffer:
+ self.onSenderError()
+ return (RTC.UNKNOWN_ERROR, "")
+
+ try:
+ if self._buffer.empty():
+ self._rtcout.RTC_ERROR("buffer is empty.")
+ return (RTC.BUFFER_EMPTY, "")
+
+ cdr = [None]
+ ret = self._buffer.read(cdr)
+
+ if ret == OpenRTM_aist.BufferStatus.BUFFER_OK:
+ if not cdr[0]:
+ self._rtcout.RTC_ERROR("buffer is empty.")
+ return (RTC.BUFFER_EMPTY, "")
+
+ except:
+ self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
+ return (RTC.UNKNOWN_ERROR, "")
+
+ return self.convertReturn(ret, cdr[0])
+
+ ##
+ # @if jp
+ # @brief ON_BUFFER_READ ¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @param data cdrMemoryStream
+ # @else
+ # @brief Notify an ON_BUFFER_READ event to listeners
+ # @param data cdrMemoryStream
+ # @endif
+ #
+ # inline void onBufferRead(const cdrMemoryStream& data)
+ def onBufferRead(self, data):
+ if self._listeners and self._profile:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ].notify(self._profile, data)
+ return
+
+ ##
+ # @if jp
+ # @brief ON_SEND ¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @param data cdrMemoryStream
+ # @else
+ # @brief Notify an ON_SEND event to listeners
+ # @param data cdrMemoryStream
+ # @endif
+ #
+ # inline void onSend(const cdrMemoryStream& data)
+ def onSend(self, data):
+ if self._listeners and self._profile:
+ self._listeners.connectorData_[OpenRTM_aist.ConnectorDataListenerType.ON_SEND].notify(self._profile, data)
+ return
+
+ ##
+ # @if jp
+ # @brief ON_BUFFER_EMPTY¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @else
+ # @brief Notify an ON_BUFFER_EMPTY event to listeners
+ # @endif
+ #
+ # inline void onBufferEmpty()
+ def onBufferEmpty(self):
+ if self._listeners and self._profile:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_BUFFER_EMPTY].notify(self._profile)
+ return
+
+ ##
+ # @if jp
+ # @brief ON_BUFFER_READ_TIMEOUT ¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @else
+ # @brief Notify an ON_BUFFER_READ_TIMEOUT event to listeners
+ # @endif
+ #
+ # inline void onBufferReadTimeout()
+ def onBufferReadTimeout(self):
+ if self._listeners and self._profile:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_BUFFER_READ_TIMEOUT].notify(self._profile)
+ return
+
+ ##
+ # @if jp
+ # @brief ON_SENDER_EMPTY¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @else
+ # @brief Notify an ON_SENDER_EMPTY event to listeners
+ # @endif
+ #
+ # inline void onSenderEmpty()
+ def onSenderEmpty(self):
+ if self._listeners and self._profile:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_SENDER_EMPTY].notify(self._profile)
+ return
+
+ ##
+ # @if jp
+ # @brief ON_SENDER_TIMEOUT ¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @else
+ # @brief Notify an ON_SENDER_TIMEOUT event to listeners
+ # @endif
+ #
+ # inline void onSenderTimeout()
+ def onSenderTimeout(self):
+ if self._listeners and self._profile:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_SENDER_TIMEOUT].notify(self._profile)
+ return
+
+ ##
+ # @if jp
+ # @brief ON_SENDER_ERROR¤Î¥ê¥¹¥Ê¤ØÄÌÃΤ¹¤ë¡£
+ # @else
+ # @brief Notify an ON_SENDER_ERROR event to listeners
+ # @endif
+ #
+ # inline void onSenderError()
+ def onSenderError(self):
+ if self._listeners and self._profile:
+ self._listeners.connector_[OpenRTM_aist.ConnectorListenerType.ON_SENDER_ERROR].notify(self._profile)
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥ê¥¿¡¼¥ó¥³¡¼¥ÉÊÑ´¹
+ # @else
+ # @brief Return codes conversion
+ # @endif
+ #
+ # ::OpenRTM::PortStatus convertReturn(BufferStatus::Enum status,
+ # const cdrMemoryStream& data);
+ def convertReturn(self, status, data):
+ if status == OpenRTM_aist.BufferStatus.BUFFER_OK:
+ self.onBufferRead(data)
+ self.onSend(data)
+ return (RTC.PORT_OK, data)
+
+ elif status == OpenRTM_aist.BufferStatus.BUFFER_ERROR:
+ self.onSenderError()
+ return (RTC.PORT_ERROR, data)
+
+ elif status == OpenRTM_aist.BufferStatus.BUFFER_FULL:
+ # never come here
+ return (RTC.BUFFER_FULL, data)
+
+ elif status == OpenRTM_aist.BufferStatus.BUFFER_EMPTY:
+ self.onBufferEmpty()
+ self.onSenderEmpty()
+ return (RTC.BUFFER_EMPTY, data)
+
+ elif status == OpenRTM_aist.BufferStatus.PRECONDITION_NOT_MET:
+ self.onSenderError()
+ return (RTC.PORT_ERROR, data)
+
+ elif status == OpenRTM_aist.BufferStatus.TIMEOUT:
+ self.onBufferReadTimeout()
+ self.onSenderTimeout()
+ return (RTC.BUFFER_TIMEOUT, data)
+
+ else:
+ return (RTC.UNKNOWN_ERROR, data)
+
+
+
+
+def OutPortDSProviderInit():
+ factory = OpenRTM_aist.OutPortProviderFactory.instance()
+ factory.addFactory("data_service",
+ OpenRTM_aist.OutPortDSProvider,
+ OpenRTM_aist.Delete)
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortPushConnector.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortPushConnector.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortPushConnector.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -393,8 +393,17 @@
#
# virtual PublisherBase* createPublisher(ConnectorInfo& info);
def createPublisher(self, info):
- pub_type = info.properties.getProperty("subscription_type","flush")
- pub_type = OpenRTM_aist.normalize([pub_type])
+ pub_type = info.properties.getProperty("io_mode")
+ if not pub_type:
+ pub_type = info.properties.getProperty("subscription_type","flush")
+ if pub_type == "flush":
+ info.properties.setProperty("io_mode","block")
+ elif pub_type == "new":
+ info.properties.setProperty("io_mode","nonblock")
+ else:
+ info.properties.setProperty("io_mode","pub_type")
+
+ pub_type = OpenRTM_aist.normalize([pub_type])
return OpenRTM_aist.PublisherFactory.instance().createObject(pub_type)
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -19,6 +19,7 @@
import threading
+
##
# @if jp
# @class OutPortSHMConsumer
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -15,6 +15,7 @@
import OpenRTM
+
##
# @if jp
# @class OutPortSHMProvider
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherFlush.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherFlush.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherFlush.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -492,3 +492,6 @@
OpenRTM_aist.PublisherFactory.instance().addFactory("flush",
OpenRTM_aist.PublisherFlush,
OpenRTM_aist.Delete)
+ OpenRTM_aist.PublisherFactory.instance().addFactory("block",
+ OpenRTM_aist.PublisherFlush,
+ OpenRTM_aist.Delete)
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -1055,3 +1055,6 @@
OpenRTM_aist.PublisherFactory.instance().addFactory("new",
OpenRTM_aist.PublisherNew,
OpenRTM_aist.Delete)
+ OpenRTM_aist.PublisherFactory.instance().addFactory("nonblock",
+ OpenRTM_aist.PublisherNew,
+ OpenRTM_aist.Delete)
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort.idl
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort.idl 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort.idl 2017-06-12 04:45:32 UTC (rev 836)
@@ -1,48 +1,35 @@
-// -*- IDL -*-
-/*!
- * @file DataPort.idl
- * @brief DataPort interface definition
- * @date $Date: 2007-01-09 15:40:14 $
- * @author Noriaki Ando <n-ando at aist.go.jp>
- *
- * Copyright (C) 2006
- * Noriaki Ando
- * Task-intelligence Research Group,
- * Intelligent Systems Research Institute,
- * National Institute of
- * Advanced Industrial Science and Technology (AIST), Japan
- *
- * All rights reserved.
- *
- * $Id: DataPort.idl 1597 2009-12-22 02:26:17Z n-ando $
- *
- */
-
-#ifndef DataInPort_idl
-#define DataInPort_idl
-
-module OpenRTM
-{
- enum PortStatus
- {
- PORT_OK,
- PORT_ERROR,
- BUFFER_FULL,
- BUFFER_EMPTY,
- BUFFER_TIMEOUT,
- UNKNOWN_ERROR
- };
-
- typedef sequence<octet> CdrData;
-
- interface InPortCdr
- {
- PortStatus put(in CdrData data);
- };
-
- interface OutPortCdr
- {
- PortStatus get(out CdrData data);
- };
-};
-#endif
+#ifndef _DATA_PORT_IDL_
+#define _DATA_PORT_IDL_
+
+#pragma prefix "omg.org"
+
+module RTC
+{
+ enum PortStatus
+ {
+ PORT_OK,
+ PORT_ERROR,
+ BUFFER_FULL,
+ BUFFER_EMPTY,
+ BUFFER_TIMEOUT,
+ UNKNOWN_ERROR
+ };
+ #pragma version PortStatus 1.0
+
+ typedef sequence<octet> OctetSeq;
+
+ interface DataPushService
+ {
+ PortStatus push(in OctetSeq data);
+ };
+ #pragma version DataPushService 1.0
+
+ interface DataPullService
+ {
+ PortStatus pull(out OctetSeq data);
+ };
+ #pragma version DataPullService 1.0
+};
+
+#endif // _DATA_PORT_IDL_
+
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort_OpenRTM.idl
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort_OpenRTM.idl (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/DataPort_OpenRTM.idl 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,48 @@
+// -*- IDL -*-
+/*!
+ * @file DataPort.idl
+ * @brief DataPort interface definition
+ * @date $Date: 2007-01-09 15:40:14 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2006
+ * Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ *
+ * All rights reserved.
+ *
+ * $Id: DataPort.idl 1597 2009-12-22 02:26:17Z n-ando $
+ *
+ */
+
+#ifndef DataInPort_idl
+#define DataInPort_idl
+
+module OpenRTM
+{
+ enum PortStatus
+ {
+ PORT_OK,
+ PORT_ERROR,
+ BUFFER_FULL,
+ BUFFER_EMPTY,
+ BUFFER_TIMEOUT,
+ UNKNOWN_ERROR
+ };
+
+ typedef sequence<octet> CdrData;
+
+ interface InPortCdr
+ {
+ PortStatus put(in CdrData data);
+ };
+
+ interface OutPortCdr
+ {
+ PortStatus get(out CdrData data);
+ };
+};
+#endif
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/ExtendedFsmService.idl
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/ExtendedFsmService.idl (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/ExtendedFsmService.idl 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,37 @@
+#ifndef _EXTENDED_FSM_SERVICE_IDL_
+#define _EXTENDED_FSM_SERVICE_IDL_
+
+#include <RTC.idl>
+
+#pragma prefix "omg.org"
+
+module RTC
+{
+ struct FsmEventProfile
+ {
+ string name;
+ string data_type;
+ };
+ #pragma version FsmEventProfile 1.0
+ typedef sequence<FsmEventProfile> FsmEventProfileList;
+
+ struct FsmStructure
+ {
+ string name;
+ string structure;
+ FsmEventProfileList event_profiles;
+ NVList properties;
+ };
+ #pragma version FsmStructure 1.0
+
+ interface ExtendedFsmService : SDOPackage::SDOService
+ {
+ string get_current_state();
+ ReturnCode_t set_fsm_structure(in FsmStructure fsm_structure);
+ ReturnCode_t get_fsm_structure(out FsmStructure fsm_structure);
+ };
+ #pragma version ExtendedFsmService 1.0
+};
+
+#endif // _EXTENDED_FSM_SERVICE_IDL_
+
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/OpenRTM.idl
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/OpenRTM.idl 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTM_IDL/OpenRTM.idl 2017-06-12 04:45:32 UTC (rev 836)
@@ -28,10 +28,10 @@
{
};
-// interface FiniteStateMachineComponent
-// : RTC::RTObject, RTC::FsmParticipant
-// {
-// };
+ interface FiniteStateMachineComponent
+ : RTC::RTObject, RTC::FsmParticipant
+ {
+ };
//
// interface DataFlowFiniteStateMachineComponent
// : RTC::RTObject, RTC::DataFlowComponent, RTC::FsmParticipant
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -17,7 +17,6 @@
-
import copy
from omniORB import any
@@ -65,7 +64,7 @@
# @else
#
# @endif
-class RTObject_impl(OpenRTM__POA.DataFlowComponent):
+class RTObject_impl:
"""
"""
@@ -131,6 +130,7 @@
self._outports = []
self._actionListeners = OpenRTM_aist.ComponentActionListeners()
self._portconnListeners = OpenRTM_aist.PortConnectListeners()
+ self._fsmActionListeners = OpenRTM_aist.FsmActionListeners()
return
@@ -441,6 +441,25 @@
# @endif
def onRateChanged(self, ec_id):
self._rtcout.RTC_TRACE("onRatechanged(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onAction(self, ec_id):
+ self._rtcout.RTC_TRACE("onAction(%d)",ec_id)
return RTC.RTC_OK
@@ -838,7 +857,7 @@
return execlist
- #
+ ##
# @if jp
# @brief [CORBA interface] ExecutionContext ¤Î¥Ï¥ó¥É¥ë¤òÊÖ¤¹
#
@@ -1513,167 +1532,14 @@
return ret
- ##
- # @if jp
- #
- # @brief [DataFlowComponentAction CORBA interface] RTC ¤ÎÄê¾ï½èÍý(Âè°ì¼þ´ü)
- #
- # °Ê²¼¤Î¾õÂÖ¤¬ÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢ÀßÄꤵ¤ì¤¿¼þ´ü¤ÇÄê´üŪ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
- # - RTC ¤Ï Alive ¾õÂ֤Ǥ¢¤ë¡£
- # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤¬ Running ¾õÂ֤Ǥ¢¤ë¡£
- # ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢Two-Pass Execution ¤ÎÂè°ì¼þ´ü¤Ç¼Â¹Ô¤µ¤ì¤ë¡£
- # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onExecute() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ó
- # ½Ð¤µ¤ì¤ë¡£
- #
- # À©Ìó
- # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Î ExecutionKind ¤Ï¡¢ PERIODIC ¤Ç¤Ê¤±¤ì¤Ð¤Ê
- # ¤é¤Ê¤¤
- #
- # @param self
- # @param ec_id Äê¾ï½èÍýÂÐ¾Ý ExecutionContext ¤Î ID
- #
- # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
- #
- # @else
- #
- # @brief [DataFlowComponentAction CORBA interface] Primary Periodic
- # Operation of RTC
- #
- # This operation will be invoked periodically at the rate of the given
- # execution context as long as the following conditions hold:
- # - The RTC is Active.
- # - The given execution context is Running
- # This callback occurs during the first execution pass.
- #
- # Constraints
- # - The execution context of the given context shall be PERIODIC.
- #
- # @param ec_id
- #
- # @return
- #
- # @endif
- def on_execute(self, ec_id):
- self._rtcout.RTC_TRACE("on_execute(%d)", ec_id)
- ret = RTC.RTC_ERROR
- try:
- self.preOnExecute(ec_id)
- if self._readAll:
- self.readAll()
-
- ret = self.onExecute(ec_id)
- if self._writeAll:
- self.writeAll()
-
- except:
- self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- ret = RTC.RTC_ERROR
- self.postOnExecute(ec_id, ret)
- return ret
- ##
- # @if jp
- #
- # @brief [DataFlowComponentAction CORBA interface] RTC ¤ÎÄê¾ï½èÍý(ÂèÆó¼þ´ü)
- #
- # °Ê²¼¤Î¾õÂÖ¤¬ÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¡¢ÀßÄꤵ¤ì¤¿¼þ´ü¤ÇÄê´üŪ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
- # - RTC ¤Ï Alive ¾õÂ֤Ǥ¢¤ë¡£
- # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤¬ Running ¾õÂ֤Ǥ¢¤ë¡£
- # ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢Two-Pass Execution ¤ÎÂèÆó¼þ´ü¤Ç¼Â¹Ô¤µ¤ì¤ë¡£
- # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onStateUpdate() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
- # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
- #
- # À©Ìó
- # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Î ExecutionKind ¤Ï¡¢ PERIODIC ¤Ç¤Ê¤±¤ì¤Ð¤Ê
- # ¤é¤Ê¤¤
- #
- # @param self
- # @param ec_id Äê¾ï½èÍýÂÐ¾Ý ExecutionContext ¤Î ID
- #
- # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
- #
- # @else
- #
- # @brief [DataFlowComponentAction CORBA interface] Secondary Periodic
- # Operation of RTC
- #
- # This operation will be invoked periodically at the rate of the given
- # execution context as long as the following conditions hold:
- # - The RTC is Active.
- # - The given execution context is Running
- # This callback occurs during the second execution pass.
- #
- # Constraints
- # - The execution context of the given context shall be PERIODIC.
- #
- # @param ec_id
- #
- # @return
- #
- # @endif
- def on_state_update(self, ec_id):
- self._rtcout.RTC_TRACE("on_state_update(%d)", ec_id)
- ret = RTC.RTC_ERROR
- try:
- self.preOnStateUpdate(ec_id)
- ret = self.onStateUpdate(ec_id)
- self._configsets.update()
- except:
- self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- ret = RTC.RTC_ERROR
- self.postOnStateUpdate(ec_id, ret)
- return ret
- ##
- # @if jp
- #
- # @brief [DataFlowComponentAction CORBA interface] ¼Â¹Ô¼þ´üÊѹ¹ÄÌÃÎ
- #
- # ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢ExecutionContext ¤Î¼Â¹Ô¼þ´ü¤¬Êѹ¹¤µ¤ì¤¿¤³¤È¤òÄÌÃΤ¹¤ë
- # ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
- # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onRateChanged() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
- # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
- #
- # À©Ìó
- # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Î ExecutionKind ¤Ï¡¢ PERIODIC ¤Ç¤Ê¤±¤ì¤Ð¤Ê
- # ¤é¤Ê¤¤
- #
- # @param self
- # @param ec_id Äê¾ï½èÍýÂÐ¾Ý ExecutionContext ¤Î ID
- #
- # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
- #
- # @else
- #
- # @brief [DataFlowComponentAction CORBA interface] Notify rate chenged
- #
- # This operation is a notification that the rate of the indicated execution
- # context has changed.
- #
- # Constraints
- # - The execution context of the given context shall be PERIODIC.
- #
- # @param ec_id
- #
- # @return
- #
- # @endif
- def on_rate_changed(self, ec_id):
- self._rtcout.RTC_TRACE("on_rate_changed(%d)", ec_id)
- ret = RTC.RTC_ERROR
- try:
- self.preOnRateChanged(ec_id)
- ret = self.onRateChanged(ec_id)
- except:
- self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
- ret = RTC.RTC_ERROR
- self.postOnRateChanged(ec_id, ret)
- return ret
+
#============================================================
# SDOPackage::SdoSystemElement
#============================================================
@@ -4474,10 +4340,436 @@
self._configsets.removeConfigurationSetNameListener(type, listener)
return
+ ##
+ # @if jp
+ # @brief PreFsmActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # FsmAction ¼ÂÁõ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·Ä¾Á°¤Î¥¤¥Ù¥ó¥È¤Ë´ØÏ¢¤¹¤ë³Æ¼ï¥ê
+ # ¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - PRE_ON_INITIALIZE: onInitialize ľÁ°
+ # - PRE_ON_FINALIZE: onFinalize ľÁ°
+ # - PRE_ON_STARTUP: onStartup ľÁ°
+ # - PRE_ON_SHUTDOWN: onShutdown ľÁ°
+ # - PRE_ON_ACTIVATED: onActivated ľÁ°
+ # - PRE_ON_DEACTIVATED: onDeactivated ľÁ°
+ # - PRE_ON_ABORTED: onAborted ľÁ°
+ # - PRE_ON_ERROR: onError ľÁ°
+ # - PRE_ON_RESET: onReset ľÁ°
+ # - PRE_ON_EXECUTE: onExecute ľÁ°
+ # - PRE_ON_STATE_UPDATE: onStateUpdate ľÁ°
+ #
+ # ¥ê¥¹¥Ê¤Ï PreFsmActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PreFsmActionListener::operator()(UniqueId ec_id)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePreFsmActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PreFsmAction type listener
+ #
+ # This operation adds certain listeners related to FsmActions
+ # pre events.
+ # The following listener types are available.
+ #
+ # - PRE_ON_INITIALIZE: before onInitialize
+ # - PRE_ON_FINALIZE: before onFinalize
+ # - PRE_ON_STARTUP: before onStartup
+ # - PRE_ON_SHUTDOWN: before onShutdown
+ # - PRE_ON_ACTIVATED: before onActivated
+ # - PRE_ON_DEACTIVATED: before onDeactivated
+ # - PRE_ON_ABORTED: before onAborted
+ # - PRE_ON_ERROR: before onError
+ # - PRE_ON_RESET: before onReset
+ # - PRE_ON_EXECUTE: before onExecute
+ # - PRE_ON_STATE_UPDATE: before onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PreFsmActionListener::operator()(UniqueId ec_id)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePreFsmActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addPreFsmActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PreFsmActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+ def __call__(self, state):
+ self._memfunc(state)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.preaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
##
# @if jp
+ # @brief PreFsmActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
#
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PreFsmAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removePreFsmActionListener(self, listener_type, listener):
+ self._fsmActionListeners.preaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PostFsmActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # FsmAction ¼ÂÁõ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·Ä¾¸å¤Î¥¤¥Ù¥ó¥È¤Ë´ØÏ¢¤¹¤ë³Æ¼ï¥ê
+ # ¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - POST_ON_INITIALIZE: onInitialize ľ¸å
+ # - POST_ON_FINALIZE: onFinalize ľ¸å
+ # - POST_ON_STARTUP: onStartup ľ¸å
+ # - POST_ON_SHUTDOWN: onShutdown ľ¸å
+ # - POST_ON_ACTIVATED: onActivated ľ¸å
+ # - POST_ON_DEACTIVATED: onDeactivated ľ¸å
+ # - POST_ON_ABORTED: onAborted ľ¸å
+ # - POST_ON_ERROR: onError ľ¸å
+ # - POST_ON_RESET: onReset ľ¸å
+ # - POST_ON_EXECUTE: onExecute ľ¸å
+ # - POST_ON_STATE_UPDATE: onStateUpdate ľ¸å
+ #
+ # ¥ê¥¹¥Ê¤Ï PostFsmActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PostFsmActionListener::operator()(const char* state, ReturnCode_t ret)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePostFsmActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PostFsmAction type listener
+ #
+ # This operation adds certain listeners related to FsmActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - POST_ON_INITIALIZE: after onInitialize
+ # - POST_ON_FINALIZE: after onFinalize
+ # - POST_ON_STARTUP: after onStartup
+ # - POST_ON_SHUTDOWN: after onShutdown
+ # - POST_ON_ACTIVATED: after onActivated
+ # - POST_ON_DEACTIVATED: after onDeactivated
+ # - POST_ON_ABORTED: after onAborted
+ # - POST_ON_ERROR: after onError
+ # - POST_ON_RESET: after onReset
+ # - POST_ON_EXECUTE: after onExecute
+ # - POST_ON_STATE_UPDATE: after onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PostFsmActionListener::operator()(const char* state, ReturnCode_t ret)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePostFsmActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addPostFsmActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PostFsmActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, state, ret):
+ self._memfunc(state, ret)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.postaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+
+ ##
+ # @if jp
+ # @brief PostFsmActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PostFsmActionListener type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removePostFsmActionListener(self, listener_type, listener):
+ self._fsmActionListeners.postaction_[listener_type].removeListener(listener)
+ return
+
+
+
+ ##
+ # @if jp
+ # @brief FsmProfileListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # FSM¤Ø¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ÎÀßÄê¡¢¼èÆÀ»þ¡¢¤Þ¤¿FSM¼«ÂΤؤξõÂÖ¤äÁ«°Ü¡¢¥¤
+ # ¥Ù¥ó¥È¤ÎÄɲúï½ü»þ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - SET_FSM_PROFILE : FSM ProfileÀßÄê»þ
+ # - GET_FSM_PROFILE : FSM Profile¼èÆÀ»þ
+ # - ADD_FSM_STATE : FSM¤ËState¤¬Äɲ䵤줿
+ # - REMOVE_FSM_STATE : FSM¤«¤éState¤¬ºï½ü¤µ¤ì¤¿
+ # - ADD_FSM_TRANSITION : FSM¤ËÁ«°Ü¤¬Äɲ䵤줿
+ # - REMOVE_FSM_TRANSITION : FSM¤«¤éÁ«°Ü¤¬ºï½ü¤µ¤ì¤¿
+ # - BIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+ # - UNBIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥¢¥ó¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+ #
+ # ¥ê¥¹¥Ê¤Ï FsmProfileListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # FsmProfileListener::operator()(RTC::FsmProfile& pprof)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removeFsmProfileListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding FsmProfile type listener
+ #
+ # This operation adds certain listeners that is called when
+ # setting/getting FsmProfile and stae/transition/event add/remove
+ # to/from the FSM itself.
+ #
+ # The following listener types are available.
+ #
+ # - SET_FSM_PROFILE : Setting FSM Profile
+ # - GET_FSM_PROFILE : Getting FSM Profile
+ # - ADD_FSM_STATE : A State added to the FSM
+ # - REMOVE_FSM_STATE : A State removed from FSM
+ # - ADD_FSM_TRANSITION : A transition added to the FSM
+ # - REMOVE_FSM_TRANSITION : A transition removed from FSM
+ # - BIND_FSM_EVENT : An event bounded to the FSM
+ # - UNBIND_FSM_EVENT : An event unbounded to the FSM
+ #
+ # Listeners should have the following function operator().
+ #
+ # FsmProfileListener::operator()(RTC::PortProfile pprof)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removeFsmProfileListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addFsmProfileListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.FsmProfileListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, pprofile):
+ self._memfunc(pprofile)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.profile_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+
+ ##
+ # @if jp
+ # @brief FsmProfileListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing FsmProfileListener type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removeFsmProfileListener(self, listener_type, listener):
+ self._fsmActionListeners.profile_[listener_type].removeListener(listener)
+ return
+
+ ##
+ # @if jp
+ # @brief FsmStructureListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # ExtendedFsmService ¤Ë´ØÏ¢¤¹¤ë FSM structure ¤ÎÀßÄꡦ¼èÆÀ»þ¤Ë¥³¡¼
+ # ¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - SET_FSM_STRUCTURE: FSM¹½Â¤¤ÎÀßÄê
+ # - GET_FSM_STRUCTURE: FSM¹½Â¤¤Î¼èÆÀ
+ #
+ # ¥ê¥¹¥Ê¤Ï FsmStructureListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # FsmStructureListener::operator()(FsmStructure& structure)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removeFsmStructureListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding FsmStructure type listener
+ #
+ # This operation adds certain listeners related to FSM structure
+ # data which are handled by ExtendedFsmService.
+ #
+ # The following listener types are available.
+ #
+ # - SET_FSM_STRUCTURE: Setting FSM structure
+ # - GET_FSM_STRUCTURE: Getting FSM structure
+ #
+ # Listeners should have the following function operator().
+ #
+ # FsmStructureListener::operator()(RTC::FsmStructure structure)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removeFsmStructureListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addFsmStructureListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.FsmStructureListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, pprofile):
+ self._memfunc(pprofile)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.structure_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief FsmStructureListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing FsmStructureListener type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removeFsmStructureListener(self, listener_type, listener):
+ self._fsmActionListeners.structure_[listener_type].removeListener(listener)
+ return
+
+ ##
+ # @if jp
+ #
# @brief RTC ¤ò½ªÎ»¤¹¤ë
#
# RTC ¤Î½ªÎ»½èÍý¤ò¼Â¹Ô¤¹¤ë¡£
@@ -4668,6 +4960,39 @@
return
+
+ def preOnFsmInit(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_INIT].notify(state)
+ return
+ def preOnFsmEntry(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_ENTRY].notify(state)
+ return
+ def preOnFsmDo(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_DO].notify(state)
+ return
+ def preOnFsmExit(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_EXIT].notify(state)
+ return
+ def preOnFsmStateChange(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_STATE_CHANGE].notify(state)
+ return
+ def postOnFsmInit(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_INIT].notify(state, ret)
+ return
+ def postOnFsmEntry(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_ENTRY].notify(state, ret)
+ return
+ def postOnFsmDo(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_DO].notify(state, ret)
+ return
+ def postOnFsmExit(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_EXIT].notify(state, ret)
+ return
+ def postOnFsmStateChange(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_STATE_CHANGE].notify(state, ret)
+ return
+
+
# ReturnCode_t getInheritedECOptions(coil::Properties& default_opts);
def getInheritedECOptions(self, default_opts):
inherited_opts_ = ["sync_transition",
@@ -5062,3 +5387,5 @@
return ret
"""
+
+
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectBase.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectBase.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectBase.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5390 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file RTObjectBase.py
+# @brief RT Object base class
+# @date $Date: $
+# @author Noriaki Ando <n-ando at aist.go.jp> and Shinji Kurihara
+#
+# Copyright (C) 2006-2008
+# Task-intelligence Research Group,
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+
+
+
+
+import copy
+
+from omniORB import any
+from omniORB import CORBA
+
+import OpenRTM__POA
+import RTC
+import SDOPackage
+import OpenRTM_aist
+
+ECOTHER_OFFSET = 1000
+
+default_conf = [
+ "implementation_id","",
+ "type_name", "",
+ "description", "",
+ "version", "",
+ "vendor", "",
+ "category", "",
+ "activity_type", "",
+ "max_instance", "",
+ "language", "",
+ "lang_type", "",
+ "conf", "",
+ "" ]
+
+
+
+##
+# @if jp
+# @brief RT¥³¥ó¥Ý¡¼¥Í¥ó¥È¥¯¥é¥¹
+#
+# ³ÆRT¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥Ù¡¼¥¹¤È¤Ê¤ë¥¯¥é¥¹¡£
+# Robotic Technology Component »ÅÍÍÃæ¤Î lightweightRTComponent¤Î¼ÂÁõ¥¯¥é¥¹¡£
+# ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Îµ¡Ç½¤òÄ󶡤¹¤ë ComponentAction ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤È
+# ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥é¥¤¥Õ¥µ¥¤¥¯¥ë´ÉÍý¤ò¹Ô¤¦¤¿¤á¤Î LightweightRTObject ¤Î¼ÂÁõ¤ò
+# Ä󶡤¹¤ë¡£
+# ¼ÂºÝ¤Ë¥æ¡¼¥¶¤¬¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òºîÀ®¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢Execution Semantics ¤ËÂбþ
+# ¤·¤¿³Æ¥µ¥Ö¥¯¥é¥¹¤òÍøÍѤ¹¤ë¡£<BR>
+# (¸½¾õ¤Î¼ÂÁõ¤Ç¤Ï Periodic Sampled Data Processing ¤Î¤ß¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤¿¤á¡¢
+# dataFlowComponent ¤òľÀܷѾµ¤·¤Æ¤¤¤ë)
+#
+# @since 0.2.0
+#
+# @else
+#
+# @endif
+class RTObjectBase:
+ """
+ """
+
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # ¥³¥ó¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ # @param manager ¥Þ¥Í¡¼¥¸¥ã¥ª¥Ö¥¸¥§¥¯¥È(¥Ç¥Õ¥©¥ë¥ÈÃÍ:None)
+ # @param orb ORB(¥Ç¥Õ¥©¥ë¥ÈÃÍ:None)
+ # @param poa POA(¥Ç¥Õ¥©¥ë¥ÈÃÍ:None)
+ #
+ # @else
+ #
+ # @brief Consructor
+ #
+ # @param orb ORB
+ # @param poa POA
+ #
+ # @endif
+ def __init__(self, manager=None, orb=None, poa=None):
+ if manager:
+ self._manager = manager
+ self._orb = self._manager.getORB()
+ self._poa = self._manager.getPOA()
+ self._portAdmin = OpenRTM_aist.PortAdmin(self._manager.getORB(),self._manager.getPOA())
+ else:
+ self._manager = None
+ self._orb = orb
+ self._poa = poa
+ self._portAdmin = OpenRTM_aist.PortAdmin(self._orb,self._poa)
+
+ if self._manager:
+ self._rtcout = self._manager.getLogbuf("rtobject")
+ else:
+ self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("rtobject")
+
+ self._created = True
+ self._properties = OpenRTM_aist.Properties(defaults_str=default_conf)
+ self._configsets = OpenRTM_aist.ConfigAdmin(self._properties.getNode("conf"))
+ self._profile = RTC.ComponentProfile("","","","","","",[],None,[])
+
+ self._sdoservice = OpenRTM_aist.SdoServiceAdmin(self)
+ self._SdoConfigImpl = OpenRTM_aist.Configuration_impl(self._configsets,self._sdoservice)
+ self._SdoConfig = self._SdoConfigImpl.getObjRef()
+ self._execContexts = []
+ self._objref = self._this()
+ self._sdoOwnedOrganizations = [] #SDOPackage.OrganizationList()
+ self._sdoSvcProfiles = [] #SDOPackage.ServiceProfileList()
+ self._sdoOrganizations = [] #SDOPackage.OrganizationList()
+ self._sdoStatus = [] #SDOPackage.NVList()
+ self._ecMine = []
+ self._ecOther = []
+ self._eclist = []
+ self._exiting = False
+ self._readAll = False
+ self._writeAll = False
+ self._readAllCompletion = False
+ self._writeAllCompletion = False
+ self._inports = []
+ self._outports = []
+ self._actionListeners = OpenRTM_aist.ComponentActionListeners()
+ self._portconnListeners = OpenRTM_aist.PortConnectListeners()
+ self._fsmActionListeners = OpenRTM_aist.FsmActionListeners()
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @brief destructor
+ #
+ # @endif
+ def __del__(self):
+ return
+
+
+ #============================================================
+ # Overridden functions
+ #============================================================
+
+ ##
+ # @if jp
+ #
+ # @brief ½é´ü²½½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_initialize ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î½é´ü²½½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onInitialize(self):
+ self._rtcout.RTC_TRACE("onInitialize()")
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ½ªÎ»½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_finalize ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î½ªÎ»½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onFinalize(self):
+ self._rtcout.RTC_TRACE("onFinalize()")
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ³«»Ï½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_startup ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î³«»Ï½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onStartup(self, ec_id):
+ self._rtcout.RTC_TRACE("onStartup(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief Ää»ß½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_shutdown ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤ÎÄä»ß½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onShutdown(self, ec_id):
+ self._rtcout.RTC_TRACE("onShutdown(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ³èÀ²½½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_activated ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î³èÀ²½½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onActivated(self, ec_id):
+ self._rtcout.RTC_TRACE("onActivated(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief Èó³èÀ²½½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_deactivated ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤ÎÈó³èÀ²½½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onDeactivated(self, ec_id):
+ self._rtcout.RTC_TRACE("onDeactivated(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¼þ´ü½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # DataFlowComponentAction::on_execute ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë
+ # ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î¼þ´ü½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£<BR>
+ # ËÜ´Ø¿ô¤Ï Periodic Sampled Data Processing ¤Ë¤ª¤±¤ë Two-Pass Execution¤Î
+ # £±²óÌܤμ¹ԥѥ¹¤È¤·¤ÆÄê´üŪ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onExecute(self, ec_id):
+ self._rtcout.RTC_TRACE("onExecute(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ÃæÃǽèÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_aborting ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯
+ # ´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤ÎÃæÃǽèÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onAborting(self, ec_id):
+ self._rtcout.RTC_TRACE("onAborting(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥¨¥é¡¼½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_error ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î¥¨¥é¡¼½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onError(self, ec_id):
+ self._rtcout.RTC_TRACE("onError(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥ê¥»¥Ã¥È½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # ComponentAction::on_reset ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î¥ê¥»¥Ã¥È½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onReset(self, ec_id):
+ self._rtcout.RTC_TRACE("onReset(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¾õÂÖÊѹ¹½èÍýÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # DataFlowComponentAction::on_state_update ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë
+ # ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î¾õÂÖÊѹ¹½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£<BR>
+ # ËÜ´Ø¿ô¤Ï Periodic Sampled Data Processing ¤Ë¤ª¤±¤ë Two-Pass Execution¤Î
+ # £²²óÌܤμ¹ԥѥ¹¤È¤·¤ÆÄê´üŪ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onStateUpdate(self, ec_id):
+ self._rtcout.RTC_TRACE("onStateupdate(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief Æ°ºî¼þ´üÊѹ¹ÄÌÃÎÍÑ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+ #
+ # DataFlowComponentAction::on_rate_changed ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¼Â¹Ô¤µ¤ì¤ë
+ # ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¡£<BR>
+ # ËÜ´Ø¿ô¤Ï̵¾ò·ï¤Ë RTC::RTC_OK ¤òÊÖ¤¹¤è¤¦¤Ë¥À¥ß¡¼¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¡¢
+ # ³Æ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¼ÂºÝ¤Î¾õÂÖÊѹ¹½èÍý¤Ï¡¢ËÜ´Ø¿ô¤ò¥ª¡¼¥Ð¡¼¥é¥¤¥É¤·¤Æ¼ÂÁõ¤¹¤ë
+ # ɬÍפ¬¤¢¤ë¡£<BR>
+ # ËÜ´Ø¿ô¤Ï Periodic Sampled Data Processing ¤Ë¤ª¤¤¤Æ ExecutionContext ¤Î
+ # ¼Â¹Ô¤¬¹¹¿·¤µ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onRateChanged(self, ec_id):
+ self._rtcout.RTC_TRACE("onRatechanged(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief
+ #
+ # @param self
+ # @param ec_id »²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @endif
+ def onAction(self, ec_id):
+ self._rtcout.RTC_TRACE("onAction(%d)",ec_id)
+ return RTC.RTC_OK
+
+
+ #============================================================
+ # RTC::LightweightRTObject
+ #============================================================
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC¤ò½é´ü²½¤¹¤ë
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ¡¢ComponentAction::on_initialize
+ # ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¡£
+ #
+ # À©Ìó
+ # - RTC ¤Ï Created¾õÂ֤ξì¹ç¤ß½é´ü²½¤¬¹Ô¤ï¤ì¤ë¡£Â¾¤Î¾õÂ֤ˤ¤¤ë¾ì¹ç¤Ë¤Ï
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤¬ÊÖ¤µ¤ì¸Æ¤Ó½Ð¤·¤Ï¼ºÇÔ¤¹¤ë¡£
+ # - ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï RTC ¤Î¥ß¥É¥ë¥¦¥¨¥¢¤«¤é¸Æ¤Ð¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤ª¤ê¡¢
+ # ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¼Ô¤ÏľÀܤ³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ò¸Æ¤Ö¤³¤È¤ÏÁÛÄê
+ # ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief Initialize the RTC that realizes this interface.
+ #
+ # The invocation of this operation shall result in the invocation of the
+ # callback ComponentAction::on_initialize.
+ #
+ # Constraints
+ # - An RTC may be initialized only while it is in the Created state. Any
+ # attempt to invoke this operation while in another state shall fail
+ # with ReturnCode_t::PRECONDITION_NOT_MET.
+ # - Application developers are not expected to call this operation
+ # directly; it exists for use by the RTC infrastructure.
+ #
+ # @return
+ #
+ # @endif
+ def initialize(self):
+ self._rtcout.RTC_TRACE("initialize()")
+
+ # EC creation
+ ec_args_ = []
+ if self.getContextOptions(ec_args_) != RTC.RTC_OK:
+ self._rtcout.RTC_ERROR("Valid EC options are not available. Aborting")
+ return RTC.BAD_PARAMETER
+
+ if self.createContexts(ec_args_) != RTC.RTC_OK:
+ self._rtcout.RTC_ERROR("EC creation failed. Maybe out of resources. Aborting.")
+ return RTC.OUT_OF_RESOURCES
+
+
+ # -- entering alive state --
+ toSTR_ = lambda x: " was" if len(x) == 1 else "s were"
+ self._rtcout.RTC_INFO("%d execution context%s created.",
+ (len(self._ecMine), toSTR_(self._ecMine)))
+
+ ret_ = self.on_initialize()
+ self._created = False
+ if ret_ != RTC.RTC_OK:
+ self._rtcout.RTC_ERROR("on_initialize() failed.")
+ return ret_
+
+ self._rtcout.RTC_DEBUG("on_initialize() was properly done.")
+ for (idx_, ec_) in enumerate(self._ecMine):
+ self._rtcout.RTC_DEBUG("EC[%d] starting.", idx_)
+ ec_.start()
+
+ # ret must be RTC_OK
+ #assert(ret_ == RTC.RTC_OK)
+ self._sdoservice.init(self)
+
+ return ret_
+
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC ¤ò½ªÎ»¤¹¤ë
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ ComponentAction::on_finalize()
+ # ¤ò¸Æ¤Ó½Ð¤¹¡£
+ #
+ # À©Ìó
+ # - RTC ¤¬ ExecutionContext ¤Ë½ê°¤·¤Æ¤¤¤ë´Ö¤Ï½ªÎ»¤µ¤ì¤Ê¤¤¡£¤³¤Î¾ì¹ç¤Ï¡¢
+ # ¤Þ¤ººÇ½é¤Ë ExecutionContextOperations::remove_component ¤Ë¤è¤Ã¤Æ»²²Ã¤ò
+ # ²ò½ü¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Ï
+ # ¤¤¤«¤Ê¤ë¾ì¹ç¤â ReturnCode_t::PRECONDITION_NOT_ME ¤Ç¼ºÇÔ¤¹¤ë¡£
+ # - RTC ¤¬ Created ¾õÂ֤Ǥ¢¤ë¾ì¹ç¡¢½ªÎ»½èÍý¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
+ # ¤³¤Î¾ì¹ç¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Ï¤¤¤«¤Ê¤ë¾ì¹ç¤â
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤Ç¼ºÇÔ¤¹¤ë¡£
+ # - ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ÏRTC¤Î¥ß¥É¥ë¥¦¥¨¥¢¤«¤é¸Æ¤Ð¤ì¤ë¤³¤È¤òÁÛÄꤷ¤Æ¤ª¤ê¡¢
+ # ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó³«È¯¼Ô¤ÏľÀܤ³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ò¸Æ¤Ö¤³¤È¤ÏÁÛÄê
+ # ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief Finalize the RTC for preparing it for destruction
+ #
+ # This invocation of this operation shall result in the invocation of the
+ # callback ComponentAction::on_finalize.
+ #
+ # Constraints
+ # - An RTC may not be finalized while it is participating in any execution
+ # context. It must first be removed with
+ # ExecutionContextOperations::remove_component. Otherwise, this operation
+ # shall fail with ReturnCode_t::PRECONDITION_NOT_MET.
+ # - An RTC may not be finalized while it is in the Created state. Any
+ # attempt to invoke this operation while in that state shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ # - Application developers are not expected to call this operation directly;
+ # it exists for use by the RTC infrastructure.
+ #
+ # @return
+ #
+ # @endif
+ def finalize(self):
+ self._rtcout.RTC_TRACE("finalize()")
+
+ if self._created or not self._exiting:
+ return RTC.PRECONDITION_NOT_MET
+
+ # Return RTC::PRECONDITION_NOT_MET,
+ # When the component is registered in ExecutionContext.
+ if len(self._ecOther) != 0:
+ #for ec in self._ecOther:
+ #if not CORBA.is_nil(ec):
+ #return RTC.PRECONDITION_NOT_MET
+
+ self._ecOther = []
+
+ ret = self.on_finalize()
+ self.shutdown()
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC ¤¬¥ª¡¼¥Ê¡¼¤Ç¤¢¤ë ExecutionContext ¤ò
+ # Ää»ß¤µ¤»¡¢¤½¤Î¥³¥ó¥Æ¥ó¥Ä¤È¶¦¤Ë½ªÎ»¤µ¤»¤ë
+ #
+ # ¤³¤Î RTC ¤¬¥ª¡¼¥Ê¡¼¤Ç¤¢¤ë¤¹¤Ù¤Æ¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤òÄä»ß¤¹¤ë¡£
+ # ¤³¤Î RTC ¤¬Â¾¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤ò½êͤ¹¤ë RTC ¤Ë°¤¹¤ë¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È
+ # (i.e. ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤ò½êͤ¹¤ë RTC ¤Ï¤¹¤Ê¤ï¤Á¤½¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î
+ # ¥ª¡¼¥Ê¡¼¤Ç¤¢¤ë¡£)¤Ë»²²Ã¤·¤Æ¤¤¤ë¾ì¹ç¡¢Åö³º RTC ¤Ï¤½¤ì¤é¤Î¥³¥ó¥Æ¥¥¹¥È¾å
+ # ¤ÇÈó³èÀ²½¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ # RTC ¤¬¼Â¹ÔÃæ¤Î¤É¤Î ExecutionContext ¤Ç¤â Active ¾õÂ֤ǤϤʤ¯¤Ê¤Ã¤¿¸å¡¢
+ # ¤³¤Î RTC ¤È¤³¤ì¤Ë´Þ¤Þ¤ì¤ë RTC ¤¬½ªÎ»¤¹¤ë¡£
+ #
+ # À©Ìó
+ # - RTC ¤¬½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢½ªÎ»¤µ¤»¤ë¤³¤È¤Ï¤Ç¤¤Ê¤¤¡£
+ # Created ¾õÂ֤ˤ¢¤ë RTC ¤Ë exit() ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¡¢
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤Ç¼ºÇÔ¤¹¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief Stop the RTC's execution context(s) and finalize it along with its
+ # contents.
+ #
+ # Any execution contexts for which the RTC is the owner shall be stopped.
+ # If the RTC participates in any execution contexts belonging to another
+ # RTC that contains it, directly or indirectly (i.e. the containing RTC
+ # is the owner of the ExecutionContext), it shall be deactivated in those
+ # contexts.
+ # After the RTC is no longer Active in any Running execution context, it
+ # and any RTCs contained transitively within it shall be finalized.
+ #
+ # Constraints
+ # - An RTC cannot be exited if it has not yet been initialized. Any
+ # attempt to exit an RTC that is in the Created state shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ #
+ # @return
+ #
+ # @endif
+ def exit(self):
+ self._rtcout.RTC_TRACE("exit()")
+ if self._created:
+ return RTC.PRECONDITION_NOT_MET
+ if self._exiting:
+ return RTC.RTC_OK
+
+ # deactivate myself on owned EC
+ OpenRTM_aist.CORBA_SeqUtil.for_each(self._ecMine,
+ self.deactivate_comps(self._objref))
+ # deactivate myself on other EC
+ OpenRTM_aist.CORBA_SeqUtil.for_each(self._ecOther,
+ self.deactivate_comps(self._objref))
+
+ # stop and detach myself from owned EC
+ #for ec in self._ecMine:
+ # if not CORBA.is_nil(ec) or not ec._non_existent():
+ # ret = ec.stop()
+ # ec.remove_component(self._this())
+ # pass
+
+
+ # detach myself from other EC
+ for ec in self._ecOther:
+ try:
+ if not CORBA.is_nil(ec) or not ec._non_existent():
+ # ec.stop()
+ ec.remove_component(self._this())
+ except:
+ pass
+
+
+ self._exiting = True
+ return self.finalize()
+
+
+ ##
+ # @if jp
+ #
+ # @brief [CORBA interface] RTC ¤¬ Alive ¾õÂ֤Ǥ¢¤ë¤«¤É¤¦¤«³Îǧ¤¹¤ë¡£
+ #
+ # RTC ¤¬»ØÄꤷ¤¿ ExecutionContext ¤ËÂФ·¤Æ Alive¾õÂ֤Ǥ¢¤ë¤«¤É¤¦¤«³Îǧ¤¹¤ë¡£
+ # RTC ¤Î¾õÂÖ¤¬ Active ¤Ç¤¢¤ë¤«¡¢Inactive ¤Ç¤¢¤ë¤«¡¢Error ¤Ç¤¢¤ë¤«¤Ï¼Â¹ÔÃæ¤Î
+ # ExecutionContext ¤Ë°Í¸¤¹¤ë¡£¤¹¤Ê¤ï¤Á¡¢¤¢¤ë ExecutionContext ¤ËÂФ·¤Æ¤Ï
+ # Active ¾õÂ֤Ǥ¢¤Ã¤Æ¤â¡¢Â¾¤Î ExecutionContext ¤ËÂФ·¤Æ¤Ï Inactive ¾õÂÖ¤È
+ # ¤Ê¤ë¾ì¹ç¤â¤¢¤ê¤¨¤ë¡£½¾¤Ã¤Æ¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï»ØÄꤵ¤ì¤¿
+ # ExecutionContext ¤ËÌ䤤¹ç¤ï¤»¤Æ¡¢¤³¤Î RTC ¤Î¾õÂÖ¤¬ Active¡¢Inactive¡¢
+ # Error ¤Î¾ì¹ç¤Ë¤Ï Alive ¾õÂ֤Ȥ·¤ÆÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @param exec_context ¼èÆÀÂÐ¾Ý ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @return Alive ¾õÂÖ³Îǧ·ë²Ì
+ #
+ # @else
+ #
+ # @brief Confirm whether RTC is an Alive state or NOT.
+ #
+ # A component is alive or not regardless of the execution context from
+ # which it is observed. However, whether or not it is Active, Inactive,
+ # or in Error is dependent on the execution context(s) in which it is
+ # running. That is, it may be Active in one context but Inactive in
+ # another. Therefore, this operation shall report whether this RTC is
+ # either Active, Inactive or in Error; which of those states a component
+ # is in with respect to a particular context may be queried from the
+ # context itself.
+ #
+ # @return Result of Alive state confirmation
+ #
+ # @endif
+ # virtual CORBA::Boolean is_alive(ExecutionContext_ptr exec_context)
+ def is_alive(self, exec_context):
+ self._rtcout.RTC_TRACE("is_alive()")
+ for ec in self._ecMine:
+ if exec_context._is_equivalent(ec):
+ return True
+
+ for ec in self._ecOther:
+ if not CORBA.is_nil(ec):
+ if exec_context._is_equivalent(ec):
+ return True
+
+ return False
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContextList¤ò¼èÆÀ¤¹¤ë
+ #
+ # ¤³¤Î RTC ¤¬½êͤ¹¤ë ExecutionContext ¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @param self
+ #
+ # @return ExecutionContext ¥ê¥¹¥È
+ #
+ # @else
+ # @brief [CORBA interface] Get ExecutionContextList.
+ #
+ # This operation returns a list of all execution contexts owned by this RTC.
+ #
+ # @return ExecutionContext List
+ #
+ # @endif
+ #def get_contexts(self):
+ # execlist = []
+ # OpenRTM_aist.CORBA_SeqUtil.for_each(self._execContexts, self.ec_copy(execlist))
+ # return execlist
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤ò¼èÆÀ¤¹¤ë
+ #
+ # »ØÄꤷ¤¿¥Ï¥ó¥É¥ë¤Î ExecutionContext ¤ò¼èÆÀ¤¹¤ë¡£
+ # ¥Ï¥ó¥É¥ë¤«¤é ExecutionContext ¤Ø¤Î¥Þ¥Ã¥Ô¥ó¥°¤Ï¡¢ÆÃÄê¤Î RTC ¥¤¥ó¥¹¥¿¥ó¥¹¤Ë
+ # ¸ÇͤǤ¢¤ë¡£¥Ï¥ó¥É¥ë¤Ï¤³¤Î RTC ¤ò attach_context ¤·¤¿ºÝ¤Ë¼èÆÀ¤Ç¤¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¼èÆÀÂÐ¾Ý ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @return ExecutionContext
+ #
+ # @else
+ # @brief [CORBA interface] Get ExecutionContext.
+ #
+ # Obtain a reference to the execution context represented by the given
+ # handle.
+ # The mapping from handle to context is specific to a particular RTC
+ # instance. The given handle must have been obtained by a previous call to
+ # attach_context on this RTC.
+ #
+ # @param ec_id ExecutionContext handle
+ #
+ # @return ExecutionContext
+ #
+ # @endif
+ # virtual ExecutionContext_ptr get_context(UniqueId exec_handle)
+ def get_context(self, ec_id):
+ global ECOTHER_OFFSET
+
+ self._rtcout.RTC_TRACE("get_context(%d)", ec_id)
+ # owned EC
+ if ec_id < ECOTHER_OFFSET:
+ if ec_id < len(self._ecMine):
+ return self._ecMine[ec_id]
+ else:
+ return RTC.ExecutionContext._nil
+
+ # participating EC
+ index = ec_id - ECOTHER_OFFSET
+
+ if index < len(self._ecOther):
+ if not CORBA.is_nil(self._ecOther[index]):
+ return self._ecOther[index]
+
+ return RTC.ExecutionContext._nil
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ½êͤ¹¤ë ExecutionContextList¤ò ¼èÆÀ¤¹¤ë
+ #
+ # ¤³¤Î RTC ¤¬½êͤ¹¤ë ExecutionContext ¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @return ExecutionContext ¥ê¥¹¥È
+ #
+ # @else
+ # @brief [CORBA interface] Get ExecutionContextList.
+ #
+ # This operation returns a list of all execution contexts owned by this
+ # RTC.
+ #
+ # @return ExecutionContext List
+ #
+ # @endif
+ # virtual ExecutionContextList* get_owned_contexts()
+ def get_owned_contexts(self):
+ self._rtcout.RTC_TRACE("get_owned_contexts()")
+ execlist = []
+ OpenRTM_aist.CORBA_SeqUtil.for_each(self._ecMine, self.ec_copy(execlist))
+ return execlist
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] »²²Ã¤·¤Æ¤¤¤ë ExecutionContextList ¤ò¼èÆÀ¤¹¤ë
+ #
+ # ¤³¤Î RTC ¤¬»²²Ã¤·¤Æ¤¤¤ë ExecutionContext ¤Î¥ê¥¹¥È¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @return ExecutionContext ¥ê¥¹¥È
+ #
+ # @else
+ # @brief [CORBA interface] Get participating ExecutionContextList.
+ #
+ # This operation returns a list of all execution contexts in
+ # which this RTC participates.
+ #
+ # @return ExecutionContext List
+ #
+ # @endif
+ # virtual ExecutionContextList* get_participating_contexts()
+ def get_participating_contexts(self):
+ self._rtcout.RTC_TRACE("get_participating_contexts()")
+ execlist = []
+ OpenRTM_aist.CORBA_SeqUtil.for_each(self._ecOther, self.ec_copy(execlist))
+ return execlist
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext ¤Î¥Ï¥ó¥É¥ë¤òÊÖ¤¹
+ #
+ # @param ExecutionContext ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È
+ #
+ # @return ExecutionContextHandle
+ #
+ # Í¿¤¨¤é¤ì¤¿¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥Ï¥ó¥É¥ë¤òÊÖ¤¹¡£
+ #
+ # @else
+ # @brief [CORBA interface] Return a handle of a ExecutionContext
+ #
+ # @param ExecutionContext
+ #
+ # @return ExecutionContextHandle
+ #
+ # This operation returns a handle that is associated with the given
+ # execution context.
+ #
+ # @endif
+ #
+ # virtual ExecutionContextHandle_t
+ # get_context_handle(ExecutionContext_ptr cxt)
+ def get_context_handle(self, cxt):
+ self._rtcout.RTC_TRACE("get_context_handle()")
+
+ num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecMine, self.ec_find(cxt))
+ if num != -1:
+ return int(num)
+
+ num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecOther, self.ec_find(cxt))
+ if num != -1:
+ return int(num) + 1000
+
+ return int(-1)
+
+
+ #============================================================
+ # RTC::RTObject
+ #============================================================
+
+ ##
+ # @if jp
+ #
+ # @brief [RTObject CORBA interface] ¥³¥ó¥Ý¡¼¥Í¥ó¥È¥×¥í¥Õ¥¡¥¤¥ë¤ò¼èÆÀ¤¹¤ë
+ #
+ # Åö³º¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¾ðÊó¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥³¥ó¥Ý¡¼¥Í¥ó¥È¥×¥í¥Õ¥¡¥¤¥ë
+ #
+ # @else
+ #
+ # @brief [RTObject CORBA interface] Get RTC's profile
+ #
+ # This operation returns the ComponentProfile of the RTC
+ #
+ # @return ComponentProfile
+ #
+ # @endif
+ # virtual ComponentProfile* get_component_profile()
+ def get_component_profile(self):
+ self._rtcout.RTC_TRACE("get_component_profile()")
+ prop_ = RTC.ComponentProfile(self._properties.getProperty("instance_name"),
+ self._properties.getProperty("type_name"),
+ self._properties.getProperty("description"),
+ self._properties.getProperty("version"),
+ self._properties.getProperty("vendor"),
+ self._properties.getProperty("category"),
+ self._portAdmin.getPortProfileList(),
+ self._profile.parent,
+ self._profile.properties)
+ OpenRTM_aist.NVUtil.copyFromProperties(self._profile.properties, self._properties)
+ return prop_
+ # return RTC.ComponentProfile(self._profile.instance_name,
+ # self._profile.type_name,
+ # self._profile.description,
+ # self._profile.version,
+ # self._profile.vendor,
+ # self._profile.category,
+ # self._portAdmin.getPortProfileList(),
+ # self._profile.parent,
+ # self._profile.properties)
+
+ #except:
+ # self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+
+ #return None
+
+
+ ##
+ # @if jp
+ #
+ # @brief [RTObject CORBA interface] ¥Ý¡¼¥È¤ò¼èÆÀ¤¹¤ë
+ #
+ # Åö³º¥³¥ó¥Ý¡¼¥Í¥ó¥È¤¬ÊÝͤ¹¤ë¥Ý¡¼¥È¤Î»²¾È¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥Ý¡¼¥È¥ê¥¹¥È
+ #
+ # @else
+ #
+ # @brief [RTObject CORBA interface] Get Ports
+ #
+ # This operation returns a list of the RTCs ports.
+ #
+ # @return PortList
+ #
+ # @endif
+ # virtual PortServiceList* get_ports()
+ def get_ports(self):
+ self._rtcout.RTC_TRACE("get_ports()")
+
+ return self._portAdmin.getPortServiceList()
+
+
+
+
+
+ # RTC::ComponentAction
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤òattach¤¹¤ë
+ #
+ # »ØÄꤷ¤¿ ExecutionContext ¤Ë¤³¤Î RTC ¤ò½ê°¤µ¤»¤ë¡£¤³¤Î RTC ¤È´ØÏ¢¤¹¤ë
+ # ExecutionContext ¤Î¥Ï¥ó¥É¥ë¤òÊÖ¤¹¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢ExecutionContextOperations::add_component ¤¬¸Æ¤Ð¤ì¤¿
+ # ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£ÊÖ¤µ¤ì¤¿¥Ï¥ó¥É¥ë¤Ï¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤Ç»ÈÍѤ¹¤ë¤³¤È¤òÁÛÄê
+ # ¤·¤Æ¤¤¤Ê¤¤¡£
+ #
+ # @param self
+ # @param exec_context ½ê°Àè ExecutionContext
+ #
+ # @return ExecutionContext ¥Ï¥ó¥É¥ë
+ #
+ # @else
+ # @brief [CORBA interface] Attach ExecutionContext.
+ #
+ # Inform this RTC that it is participating in the given execution context.
+ # Return a handle that represents the association of this RTC with the
+ # context.
+ # This operation is intended to be invoked by
+ # ExecutionContextOperations::add_component. It is not intended for use by
+ # other clients.
+ #
+ # @param exec_context Prticipating ExecutionContext
+ #
+ # @return ExecutionContext Handle
+ #
+ # @endif
+ # UniqueId attach_context(ExecutionContext_ptr exec_context)
+ def attach_context(self, exec_context):
+ global ECOTHER_OFFSET
+ self._rtcout.RTC_TRACE("attach_context()")
+ # ID: 0 - (offset-1) : owned ec
+ # ID: offset - : participating ec
+ # owned ec index = ID
+ # participate ec index = ID - offset
+ ecs = exec_context._narrow(RTC.ExecutionContextService)
+ if CORBA.is_nil(ecs):
+ return -1
+
+ # if m_ecOther has nil element, insert attached ec to there.
+ for i in range(len(self._ecOther)):
+ if CORBA.is_nil(self._ecOther[i]):
+ self._ecOther[i] = ecs
+ ec_id = i + ECOTHER_OFFSET
+ self.onAttachExecutionContext(ec_id)
+ return ec_id
+
+ # no space in the list, push back ec to the last.
+ OpenRTM_aist.CORBA_SeqUtil.push_back(self._ecOther,ecs)
+ ec_id = int(len(self._ecOther) - 1 + ECOTHER_OFFSET)
+ self.onAttachExecutionContext(ec_id)
+ return ec_id
+
+
+ # UniqueId bindContext(ExecutionContext_ptr exec_context);
+ def bindContext(self, exec_context):
+ global ECOTHER_OFFSET
+ self._rtcout.RTC_TRACE("bindContext()")
+ # ID: 0 - (offset-1) : owned ec
+ # ID: offset - : participating ec
+ # owned ec index = ID
+ # participate ec index = ID - offset
+ ecs = exec_context._narrow(RTC.ExecutionContextService)
+
+ if CORBA.is_nil(ecs):
+ return -1
+
+ # if m_ecMine has nil element, insert attached ec to there.
+ for i in range(len(self._ecMine)):
+ if CORBA.is_nil(self._ecMine[i]):
+ self._ecMine[i] = ecs
+ self.onAttachExecutionContext(i)
+ return i
+ #return i + ECOTHER_OFFSET
+
+ # no space in the list, push back ec to the last.
+ OpenRTM_aist.CORBA_SeqUtil.push_back(self._ecMine,ecs)
+
+ return int(len(self._ecMine) - 1)
+ #return int(len(self._ecMine) - 1 + ECOTHER_OFFSET)
+
+
+ ##
+ # @if jp
+ # @brief [CORBA interface] ExecutionContext¤òdetach¤¹¤ë
+ #
+ # »ØÄꤷ¤¿ ExecutionContext ¤«¤é¤³¤Î RTC ¤Î½ê°¤ò²ò½ü¤¹¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï¡¢ExecutionContextOperations::remove_component ¤¬¸Æ¤Ð
+ # ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£ÊÖ¤µ¤ì¤¿¥Ï¥ó¥É¥ë¤Ï¾¤Î¥¯¥é¥¤¥¢¥ó¥È¤Ç»ÈÍѤ¹¤ë¤³¤È¤ò
+ # ÁÛÄꤷ¤Æ¤¤¤Ê¤¤¡£
+ #
+ # À©Ìó
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Ë RTC ¤¬¤¹¤Ç¤Ë½ê°¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢
+ # ReturnCode_t::PRECONDITION_NOT_MET ¤¬ÊÖ¤µ¤ì¤ë¡£
+ # - »ØÄꤵ¤ì¤¿ ExecutionContext ¤Ë¤¿¤·¤¤¤ÆÂФ·¤Æ RTC ¤¬Active ¾õÂ֤Ǥ¢¤ë¾ì
+ # ¹ç¤Ë¤Ï¡¢ ReturnCode_t::PRECONDITION_NOT_MET ¤¬ÊÖ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ²ò½üÂÐ¾Ý ExecutionContext¥Ï¥ó¥É¥ë
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ # @brief [CORBA interface] Attach ExecutionContext.
+ #
+ # Inform this RTC that it is no longer participating in the given execution
+ # context.
+ # This operation is intended to be invoked by
+ # ExecutionContextOperations::remove_component. It is not intended for use
+ # by other clients.
+ # Constraints
+ # - This operation may not be invoked if this RTC is not already
+ # participating in the execution context. Such a call shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ # - This operation may not be invoked if this RTC is Active in the indicated
+ # execution context. Otherwise, it shall fail with
+ # ReturnCode_t::PRECONDITION_NOT_MET.
+ #
+ # @param ec_id Dettaching ExecutionContext Handle
+ #
+ # @return
+ #
+ # @endif
+ # ReturnCode_t detach_context(UniqueId exec_handle)
+ def detach_context(self, ec_id):
+ global ECOTHER_OFFSET
+ self._rtcout.RTC_TRACE("detach_context(%d)", ec_id)
+ len_ = len(self._ecOther)
+
+ # ID: 0 - (offset-1) : owned ec
+ # ID: offset - : participating ec
+ # owned ec index = ID
+ # participate ec index = ID - offset
+ if (int(ec_id) < int(ECOTHER_OFFSET)) or \
+ (int(ec_id - ECOTHER_OFFSET) > len_):
+ return RTC.BAD_PARAMETER
+
+ index = int(ec_id - ECOTHER_OFFSET)
+
+ if index < 0 or CORBA.is_nil(self._ecOther[index]):
+ return RTC.BAD_PARAMETER
+
+ #OpenRTM_aist.CORBA_SeqUtil.erase(self._ecOther, index)
+ self._ecOther[index] = RTC.ExecutionContextService._nil
+ self.onDetachExecutionContext(ec_id)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î½é´ü²½
+ #
+ # RTC ¤¬½é´ü²½¤µ¤ì¡¢Alive ¾õÂÖ¤ËÁ«°Ü¤¹¤ë¡£
+ # RTC ¸Çͤνé´ü²½½èÍý¤Ï¤³¤³¤Ç¼Â¹Ô¤¹¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onInitialize() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Initialize RTC
+ #
+ # The RTC has been initialized and entered the Alive state.
+ # Any RTC-specific initialization logic should be performed here.
+ #
+ # @return
+ #
+ # @endif
+ def on_initialize(self):
+ self._rtcout.RTC_TRACE("on_initialize()")
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnInitialize(0)
+ self._rtcout.RTC_DEBUG("Calling onInitialize().")
+ ret = self.onInitialize()
+ if ret != RTC.RTC_OK:
+ self._rtcout.RTC_ERROR("onInitialize() returns an ERROR (%d)", ret._v)
+ else:
+ self._rtcout.RTC_DEBUG("onInitialize() succeeded.")
+
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+
+ active_set = self._properties.getProperty("configuration.active_config",
+ "default")
+
+ if self._configsets.haveConfig(active_set):
+ self._rtcout.RTC_DEBUG("Active configuration set: %s exists.", active_set)
+ self._configsets.activateConfigurationSet(active_set)
+ self._configsets.update(active_set)
+ self._rtcout.RTC_INFO("Initial active configuration set is %s.", active_set)
+ else:
+ self._rtcout.RTC_DEBUG("Active configuration set: %s does not exists.", active_set)
+ self._configsets.activateConfigurationSet("default")
+ self._configsets.update("default")
+ self._rtcout.RTC_INFO("Initial active configuration set is default-set.")
+
+ self.postOnInitialize(0,ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î½ªÎ»
+ #
+ # RTC ¤¬ÇË´þ¤µ¤ì¤ë¡£
+ # RTC ¸ÇͤνªÎ»½èÍý¤Ï¤³¤³¤Ç¼Â¹Ô¤¹¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onFinalize() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Finalize RTC
+ #
+ # The RTC is being destroyed.
+ # Any final RTC-specific tear-down logic should be performed here.
+ #
+ # @return
+ #
+ # @endif
+ def on_finalize(self):
+ self._rtcout.RTC_TRACE("on_finalize()")
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnFinalize(0)
+ ret = self.onFinalize()
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnFinalize(0, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î³«»Ï
+ #
+ # RTC ¤¬½ê°¤¹¤ë ExecutionContext ¤¬ Stopped ¾õÂÖ¤«¤é Running ¾õÂÖ¤ØÁ«°Ü
+ # ¤·¤¿¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onStartup() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¾õÂÖÁ«°Ü¤·¤¿ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] StartUp RTC
+ #
+ # The given execution context, in which the RTC is participating, has
+ # transitioned from Stopped to Running.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_startup(self, ec_id):
+ self._rtcout.RTC_TRACE("on_startup(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnStartup(ec_id)
+ ret = self.onStartup(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnStartup(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤ÎÄä»ß
+ #
+ # RTC ¤¬½ê°¤¹¤ë ExecutionContext ¤¬ Running ¾õÂÖ¤«¤é Stopped ¾õÂÖ¤ØÁ«°Ü
+ # ¤·¤¿¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onShutdown() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¾õÂÖÁ«°Ü¤·¤¿ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] ShutDown RTC
+ #
+ # The given execution context, in which the RTC is participating, has
+ # transitioned from Running to Stopped.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_shutdown(self, ec_id):
+ self._rtcout.RTC_TRACE("on_shutdown(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnShutdown(ec_id)
+ ret = self.onShutdown(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnShutdown(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î³èÀ²½
+ #
+ # ½ê°¤¹¤ë ExecutionContext ¤«¤é RTC ¤¬³èÀ²½¤µ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onActivated() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ³èÀ²½ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Activate RTC
+ #
+ # The RTC has been activated in the given execution context.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_activated(self, ec_id):
+ self._rtcout.RTC_TRACE("on_activated(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnActivated(ec_id)
+ self._configsets.update()
+ ret = self.onActivated(ec_id)
+ self._portAdmin.activatePorts()
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnActivated(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤ÎÈó³èÀ²½
+ #
+ # ½ê°¤¹¤ë ExecutionContext ¤«¤é RTC ¤¬Èó³èÀ²½¤µ¤ì¤¿ºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onDeactivated() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id Èó³èÀ²½ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Deactivate RTC
+ #
+ # The RTC has been deactivated in the given execution context.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_deactivated(self, ec_id):
+ self._rtcout.RTC_TRACE("on_deactivated(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnDeactivated(ec_id)
+ self._portAdmin.deactivatePorts()
+ ret = self.onDeactivated(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnDeactivated(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î¥¨¥é¡¼¾õÂ֤ؤÎÁ«°Ü
+ #
+ # RTC ¤¬½ê°¤¹¤ë ExecutionContext ¤¬ Active ¾õÂÖ¤«¤é Error ¾õÂÖ¤ØÁ«°Ü¤·¤¿
+ # ¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï RTC ¤¬ Error ¾õÂÖ¤ËÁ«°Ü¤·¤¿ºÝ¤Ë°ìÅÙ¤À¤±¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onAborting() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬
+ # ¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¾õÂÖÁ«°Ü¤·¤¿ ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Transition Error State
+ #
+ # The RTC is transitioning from the Active state to the Error state in some
+ # execution context.
+ # This callback is invoked only a single time for time that the RTC
+ # transitions into the Error state from another state. This behavior is in
+ # contrast to that of on_error.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_aborting(self, ec_id):
+ self._rtcout.RTC_TRACE("on_aborting(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnAborting(ec_id)
+ ret = self.onAborting(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnAborting(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î¥¨¥é¡¼½èÍý
+ #
+ # RTC ¤¬¥¨¥é¡¼¾õÂ֤ˤ¤¤ëºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # RTC ¤¬¥¨¥é¡¼¾õÂ֤ξì¹ç¤Ë¡¢ÂоݤȤʤë ExecutionContext ¤ÎExecutionKind ¤Ë
+ # ±þ¤¸¤¿¥¿¥¤¥ß¥ó¥°¤Ç¸Æ¤Ó½Ð¤µ¤ì¤ë¡£Î㤨¤Ð¡¢
+ # - ExecutionKind ¤¬ PERIODIC ¤Î¾ì¹ç¡¢ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï
+ # DataFlowComponentAction::on_execute ¤È on_state_update ¤ÎÂؤï¤ê¤Ë¡¢
+ # ÀßÄꤵ¤ì¤¿½çÈÖ¡¢ÀßÄꤵ¤ì¤¿¼þ´ü¤Ç¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # - ExecutionKind ¤¬ EVENT_DRIVEN ¤Î¾ì¹ç¡¢ËÜ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï
+ # FsmParticipantAction::on_action ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¡¢Âؤï¤ê¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onError() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ó½Ð
+ # ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Error Processing of RTC
+ #
+ # The RTC remains in the Error state.
+ # If the RTC is in the Error state relative to some execution context when
+ # it would otherwise be invoked from that context (according to the
+ # context¡Çs ExecutionKind), this callback shall be invoked instead.
+ # For example,
+ # - If the ExecutionKind is PERIODIC, this operation shall be invoked in
+ # sorted order at the rate of the context instead of
+ # DataFlowComponentAction::on_execute and on_state_update.
+ # - If the ExecutionKind is EVENT_DRIVEN, this operation shall be invoked
+ # whenever FsmParticipantAction::on_action would otherwise have been
+ # invoked.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_error(self, ec_id):
+ self._rtcout.RTC_TRACE("on_error(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnError(ec_id)
+ ret = self.onError(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self._configsets.update()
+ self.postOnError(ec_id, ret)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [ComponentAction CORBA interface] RTC ¤Î¥ê¥»¥Ã¥È
+ #
+ # Error ¾õÂ֤ˤ¢¤ë RTC ¤Î¥ê¥«¥Ð¥ê½èÍý¤ò¼Â¹Ô¤·¡¢Inactive ¾õÂÖ¤ËÉüµ¢¤µ¤»¤ë
+ # ¾ì¹ç¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # RTC ¤Î¥ê¥«¥Ð¥ê½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¤Ï Inactive ¾õÂÖ¤ËÉüµ¢¤¹¤ë¤¬¡¢¤½¤ì°Ê³°¤Î
+ # ¾ì¹ç¤Ë¤Ï Error ¾õÂÖ¤Ëα¤Þ¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¸Æ¤Ó½Ð¤·¤Î·ë²Ì¤È¤·¤Æ onReset() ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ó
+ # ½Ð¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param ec_id ¥ê¥»¥Ã¥ÈÂÐ¾Ý ExecutionContext ¤Î ID
+ #
+ # @return ReturnCode_t ·¿¤Î¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [ComponentAction CORBA interface] Resetting RTC
+ #
+ # The RTC is in the Error state. An attempt is being made to recover it such
+ # that it can return to the Inactive state.
+ # If the RTC was successfully recovered and can safely return to the
+ # Inactive state, this method shall complete with ReturnCode_t::OK. Any
+ # other result shall indicate that the RTC should remain in the Error state.
+ #
+ # @param ec_id
+ #
+ # @return
+ #
+ # @endif
+ def on_reset(self, ec_id):
+ self._rtcout.RTC_TRACE("on_reset(%d)", ec_id)
+ ret = RTC.RTC_ERROR
+ try:
+ self.preOnReset(ec_id)
+ ret = self.onReset(ec_id)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ ret = RTC.RTC_ERROR
+ self.postOnReset(ec_id, ret)
+ return ret
+
+
+
+
+
+
+
+
+
+
+ #============================================================
+ # SDOPackage::SdoSystemElement
+ #============================================================
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] Organization ¥ê¥¹¥È¤Î¼èÆÀ
+ #
+ # SDOSystemElement ¤Ï0¸Ä¤â¤·¤¯¤Ï¤½¤ì°Ê¾å¤Î Organization ¤ò½êͤ¹¤ë¤³¤È¤¬
+ # ½ÐÍè¤ë¡£ SDOSystemElement ¤¬1¤Ä°Ê¾å¤Î Organization ¤ò½êͤ·¤Æ¤¤¤ë¾ì¹ç
+ # ¤Ë¤Ï¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï½êͤ¹¤ë Organization ¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£
+ # ¤â¤·Organization¤ò°ì¤Ä¤â½êͤ·¤Æ¤¤¤Ê¤¤¤±¤ì¤Ð¶õ¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ½êͤ·¤Æ¤¤¤ë Organization ¥ê¥¹¥È
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting Organizations
+ #
+ # SDOSystemElement can be the owner of zero or more organizations.
+ # If the SDOSystemElement owns one or more Organizations, this operation
+ # returns the list of Organizations that the SDOSystemElement owns.
+ # If it does not own any Organization, it returns empty list.
+ #
+ # @return Owned Organization List
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable if the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError if the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual SDOPackage::OrganizationList* get_owned_organizations()
+ def get_owned_organizations(self):
+ self._rtcout.RTC_TRACE("get_owned_organizations()")
+
+ return self._sdoOwnedOrganizations
+
+
+
+ #============================================================
+ # SDOPackage::SDO
+ #============================================================
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] SDO ID ¤Î¼èÆÀ
+ #
+ # SDO ID ¤òÊÖ¤¹¥ª¥Ú¥ì¡¼¥·¥ç¥ó¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï°Ê²¼¤Î·¿¤ÎÎã³°¤òȯÀ¸¤µ¤»¤ë¡£
+ #
+ # @param self
+ #
+ # @return ¥ê¥½¡¼¥¹¥Ç¡¼¥¿¥â¥Ç¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë SDO ¤Î ID
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting SDO ID
+ #
+ # This operation returns id of the SDO.
+ # This operation throws SDOException with one of the following types.
+ #
+ # @return id of the SDO defined in the resource data model.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable if the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError if the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual char* get_sdo_id()
+ def get_sdo_id(self):
+ self._rtcout.RTC_TRACE("get_sdo_id()")
+
+ return self._profile.instance_name
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] SDO ¥¿¥¤¥×¤Î¼èÆÀ
+ #
+ # SDO Type ¤òÊÖ¤¹¥ª¥Ú¥ì¡¼¥·¥ç¥ó¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï°Ê²¼¤Î·¿¤ÎÎã³°¤òȯÀ¸¤µ¤»¤ë¡£
+ #
+ # @param self
+ #
+ # @return ¥ê¥½¡¼¥¹¥Ç¡¼¥¿¥â¥Ç¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë SDO ¤Î Type
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting SDO type
+ #
+ # This operation returns sdoType of the SDO.
+ # This operation throws SDOException with one of the following types.
+ #
+ # @return Type of the SDO defined in the resource data model.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable if the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError if the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual char* get_sdo_type()
+ def get_sdo_type(self):
+ self._rtcout.RTC_TRACE("get_sdo_type()")
+
+ return self._profile.description
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] SDO DeviceProfile ¥ê¥¹¥È¤Î¼èÆÀ
+ #
+ # SDO ¤Î DeviceProfile ¤òÊÖ¤¹¥ª¥Ú¥ì¡¼¥·¥ç¥ó¡£ SDO ¤¬¥Ï¡¼¥É¥¦¥¨¥¢¥Ç¥Ð¥¤¥¹
+ # ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¶õ¤Î DeviceProfile ¤¬ÊÖ¤µ¤ì¤ë¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï°Ê²¼¤Î·¿¤ÎÎã³°¤òȯÀ¸¤µ¤»¤ë¡£
+ #
+ # @param self
+ #
+ # @return SDO DeviceProfile
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting SDO DeviceProfile
+ #
+ # This operation returns the DeviceProfile of the SDO. If the SDO does not
+ # represent any hardware device, then a DeviceProfile with empty values
+ # are returned.
+ # This operation throws SDOException with one of the following types.
+ #
+ # @return The DeviceProfile of the SDO.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable if the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError if the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual SDOPackage::DeviceProfile* get_device_profile()
+ def get_device_profile(self):
+ self._rtcout.RTC_TRACE("get_device_profile()")
+
+ return self._SdoConfigImpl.getDeviceProfile()
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] SDO ServiceProfile ¤Î¼èÆÀ
+ #
+ # SDO ¤¬½êͤ·¤Æ¤¤¤ë Service ¤Î ServiceProfile ¤òÊÖ¤¹¥ª¥Ú¥ì¡¼¥·¥ç¥ó¡£
+ # SDO ¤¬¥µ¡¼¥Ó¥¹¤ò°ì¤Ä¤â½êͤ·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¶õ¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï°Ê²¼¤Î·¿¤ÎÎã³°¤òȯÀ¸¤µ¤»¤ë¡£
+ #
+ # @param self
+ #
+ # @return SDO ¤¬Ä󶡤¹¤ëÁ´¤Æ¤Î Service ¤Î ServiceProfile¡£
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting SDO ServiceProfile
+ #
+ # This operation returns a list of ServiceProfiles that the SDO has.
+ # If the SDO does not provide any service, then an empty list is returned.
+ # This operation throws SDOException with one of the following types.
+ #
+ # @return List of ServiceProfiles of all the services the SDO is
+ # providing.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable if the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError if the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual SDOPackage::ServiceProfileList* get_service_profiles()
+ def get_service_profiles(self):
+ self._rtcout.RTC_TRACE("get_service_profiles()")
+ self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles()
+
+ return self._sdoSvcProfiles
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] ÆÃÄê¤ÎServiceProfile¤Î¼èÆÀ
+ #
+ # °ú¿ô "id" ¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤Î¥µ¡¼¥Ó¥¹¤Î ServiceProfile ¤òÊÖ¤¹¡£
+ #
+ # @param self
+ # @param _id SDO Service ¤Î ServiceProfile ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¼±Ê̻ҡ£
+ #
+ # @return »ØÄꤵ¤ì¤¿ SDO Service ¤Î ServiceProfile¡£
+ #
+ # @exception InvalidParameter "id" ¤Ç»ØÄꤷ¤¿ ServiceProfile ¤¬Â¸ºß¤·¤Ê¤¤¡£
+ # "id" ¤¬ null¡£
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting Organizations
+ #
+ # This operation returns the ServiceProfile that is specified by the
+ # argument "id."
+ #
+ # @param _id The identifier referring to one of the ServiceProfiles.
+ #
+ # @return The profile of the specified service.
+ #
+ # @exception InvalidParameter if the ServiceProfile that is specified by
+ # the argument 'id' does not exist or if 'id'
+ # is 'null.'
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable If the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError If the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual SDOPackage::ServiceProfile* get_service_profile(const char* id)
+ def get_service_profile(self, _id):
+ self._rtcout.RTC_TRACE("get_service_profile(%s)", _id)
+ self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles()
+ if not _id:
+ raise SDOPackage.InvalidParameter("get_service_profile(): Empty name.")
+
+ try:
+ index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoSvcProfiles, self.svc_name(_id))
+
+ if index < 0:
+ raise SDOPackage.InvalidParameter("get_service_profile(): Not found")
+
+ return self._sdoSvcProfiles[index]
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ raise SDOPackage.InternalError("get_service_profile()")
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] »ØÄꤵ¤ì¤¿ SDO Service ¤Î¼èÆÀ
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï°ú¿ô "id" ¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤Ë¤è¤Ã¤Æ¶èÊ̤µ¤ì¤ë
+ # SDO ¤Î Service ¤Ø¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤òÊÖ¤¹¡£ SDO ¤Ë¤è¤êÄ󶡤µ¤ì¤ë
+ # Service ¤Ï¤½¤ì¤¾¤ì°ì°Õ¤Î¼±Ê̻Ҥˤè¤ê¶èÊ̤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param _id SDO Service ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¼±Ê̻ҡ£
+ #
+ # @return Í׵ᤵ¤ì¤¿ SDO Service ¤Ø¤Î»²¾È¡£
+ #
+ #
+ # @exception InvalidParameter "id" ¤Ç»ØÄꤷ¤¿ ServiceProfile ¤¬Â¸ºß¤·¤Ê¤¤¡£
+ # "id" ¤¬ null¡£
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting specified SDO Service's reference
+ #
+ # This operation returns an object implementing an SDO's service that
+ # is identified by the identifier specified as an argument. Different
+ # services provided by an SDO are distinguished with different
+ # identifiers. See OMG SDO specification Section 2.2.8, "ServiceProfile,"
+ # on page 2-12 for more details.
+ #
+ # @param _id The identifier referring to one of the SDO Service
+ # @return The object implementing the requested service.
+ # @exception InvalidParameter if argument ¡Èid¡É is null, or if the
+ # ServiceProfile that is specified by argument
+ # ¡Èid¡É does not exist.
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable If the target SDO is reachable but cannot
+ # respond.
+ # @exception InternalError If the target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual SDOPackage::SDOService_ptr get_sdo_service(const char* id)
+ def get_sdo_service(self, _id):
+ self._rtcout.RTC_TRACE("get_sdo_service(%s)", _id)
+ self._sdoSvcProfiles = self._SdoConfigImpl.getServiceProfiles()
+
+ if not _id:
+ raise SDOPackage.InvalidParameter("get_service(): Empty name.")
+
+ index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoSvcProfiles, self.svc_name(_id))
+
+ if index < 0:
+ raise SDOPackage.InvalidParameter("get_service(): Not found")
+
+
+ return self._sdoSvcProfiles[index].service
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] Configuration ¥ª¥Ö¥¸¥§¥¯¥È¤Î¼èÆÀ
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï Configuration interface ¤Ø¤Î»²¾È¤òÊÖ¤¹¡£
+ # Configuration interface ¤Ï³Æ SDO ¤ò´ÉÍý¤¹¤ë¤¿¤á¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î
+ # ¤Ò¤È¤Ä¤Ç¤¢¤ë¡£¤³¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ï DeviceProfile, ServiceProfile,
+ # Organization ¤ÇÄêµÁ¤µ¤ì¤¿ SDO ¤Î°ÀÃͤòÀßÄꤹ¤ë¤¿¤á¤Ë»ÈÍѤµ¤ì¤ë¡£
+ # Configuration ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢OMG SDO specification
+ # ¤Î 2.3.5Àá, p.2-24 ¤ò»²¾È¤Î¤³¤È¡£
+ #
+ # @param self
+ #
+ # @return SDO ¤Î Configuration ¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ø¤Î»²¾È
+ #
+ # @exception InterfaceNotImplemented SDO¤ÏConfiguration¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤ò
+ # »ý¤¿¤Ê¤¤¡£
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Getting Configuration object
+ #
+ # This operation returns an object implementing the Configuration
+ # interface. The Configuration interface is one of the interfaces that
+ # each SDO maintains. The interface is used to configure the attributes
+ # defined in DeviceProfile, ServiceProfile, and Organization.
+ # See OMG SDO specification Section 2.3.5, "Configuration Interface,"
+ # on page 2-24 for more details about the Configuration interface.
+ #
+ # @return The Configuration interface of an SDO.
+ #
+ # @exception InterfaceNotImplemented The target SDO has no Configuration
+ # interface.
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable The target SDO is reachable but cannot respond.
+ # @exception InternalError The target SDO cannot execute the operation
+ # completely due to some internal error.
+ # @endif
+ # virtual SDOPackage::Configuration_ptr get_configuration()
+ def get_configuration(self):
+ self._rtcout.RTC_TRACE("get_configuration()")
+ if self._SdoConfig is None:
+ raise SDOPackage.InterfaceNotImplemented("InterfaceNotImplemented: get_configuration")
+
+ return self._SdoConfig
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] Monitoring ¥ª¥Ö¥¸¥§¥¯¥È¤Î¼èÆÀ
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï Monitoring interface ¤Ø¤Î»²¾È¤òÊÖ¤¹¡£
+ # Monitoring interface ¤Ï SDO ¤¬´ÉÍý¤¹¤ë¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î°ì¤Ä¤Ç¤¢¤ë¡£
+ # ¤³¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ï SDO ¤Î¥×¥í¥Ñ¥Æ¥£¤ò¥â¥Ë¥¿¥ê¥ó¥°¤¹¤ë¤¿¤á¤Ë
+ # »ÈÍѤµ¤ì¤ë¡£
+ # Monitoring interface ¤Î¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï OMG SDO specification ¤Î
+ # 2.3.7Àá "Monitoring Interface" p.2-35 ¤ò»²¾È¤Î¤³¤È¡£
+ #
+ # @param self
+ #
+ # @return SDO ¤Î Monitoring interface ¤Ø¤Î»²¾È
+ #
+ # @exception InterfaceNotImplemented SDO¤ÏConfiguration¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤ò
+ # »ý¤¿¤Ê¤¤¡£
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Get Monitoring object
+ #
+ # This operation returns an object implementing the Monitoring interface.
+ # The Monitoring interface is one of the interfaces that each SDO
+ # maintains. The interface is used to monitor the properties of an SDO.
+ # See OMG SDO specification Section 2.3.7, "Monitoring Interface," on
+ # page 2-35 for more details about the Monitoring interface.
+ #
+ # @return The Monitoring interface of an SDO.
+ #
+ # @exception InterfaceNotImplemented The target SDO has no Configuration
+ # interface.
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable The target SDO is reachable but cannot respond.
+ # @exception InternalError The target SDO cannot execute the operation
+ # completely due to some internal error.
+ # @endif
+ # virtual SDOPackage::Monitoring_ptr get_monitoring()
+ def get_monitoring(self):
+ self._rtcout.RTC_TRACE("get_monitoring()")
+ raise SDOPackage.InterfaceNotImplemented("Exception: get_monitoring")
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] Organization ¥ê¥¹¥È¤Î¼èÆÀ
+ #
+ # SDO ¤Ï0¸Ä°Ê¾å¤Î Organization (ÁÈ¿¥)¤Ë½ê°¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£ ¤â¤· SDO ¤¬
+ # 1¸Ä°Ê¾å¤Î Organization ¤Ë½ê°¤·¤Æ¤¤¤ë¾ì¹ç¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï½ê°¤¹¤ë
+ # Organization ¤Î¥ê¥¹¥È¤òÊÖ¤¹¡£SDO ¤¬ ¤É¤Î Organization ¤Ë¤â½ê°¤·¤Æ¤¤¤Ê¤¤
+ # ¾ì¹ç¤Ë¤Ï¡¢¶õ¤Î¥ê¥¹¥È¤¬ÊÖ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ #
+ # @return SDO ¤¬½ê°¤¹¤ë Organization ¤Î¥ê¥¹¥È¡£
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ # @else
+ #
+ # @brief [SDO interface] Getting Organizations
+ #
+ # An SDO belongs to zero or more organizations. If the SDO belongs to one
+ # or more organizations, this operation returns the list of organizations
+ # that the SDO belongs to. An empty list is returned if the SDO does not
+ # belong to any Organizations.
+ #
+ # @return The list of Organizations that the SDO belong to.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable The target SDO is reachable but cannot respond.
+ # @exception InternalError The target SDO cannot execute the operation
+ # completely due to some internal error.
+ # @endif
+ # virtual SDOPackage::OrganizationList* get_organizations()
+ def get_organizations(self):
+ self._rtcout.RTC_TRACE("get_organizations()")
+ self._sdoOrganizations = self._SdoConfigImpl.getOrganizations()
+
+ return self._sdoOrganizations
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] SDO Status ¥ê¥¹¥È¤Î¼èÆÀ
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ï SDO ¤Î¥¹¥Æ¡¼¥¿¥¹¤òɽ¤¹ NVList ¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return SDO ¤Î¥¹¥Æ¡¼¥¿¥¹¡£
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ #
+ # @else
+ #
+ # @brief [SDO interface] Get SDO Status
+ #
+ # This operation returns an NVlist describing the status of an SDO.
+ #
+ # @return The actual status of an SDO.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable The target SDO is reachable but cannot respond.
+ # @exception InternalError The target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ # @endif
+ # virtual SDOPackage::NVList* get_status_list()
+ def get_status_list(self):
+ self._rtcout.RTC_TRACE("get_status_list()")
+
+ return self._sdoStatus
+
+
+
+
+ ##
+ # @if jp
+ #
+ # @brief [SDO interface] SDO Status ¤Î¼èÆÀ
+ #
+ # This operation returns the value of the specified status parameter.
+ #
+ # @param self
+ # @param name SDO ¤Î¥¹¥Æ¡¼¥¿¥¹¤òÄêµÁ¤¹¤ë¥Ñ¥é¥á¡¼¥¿¡£
+ #
+ # @return »ØÄꤵ¤ì¤¿¥Ñ¥é¥á¡¼¥¿¤Î¥¹¥Æ¡¼¥¿¥¹ÃÍ¡£
+ #
+ # @exception SDONotExists ¥¿¡¼¥²¥Ã¥È¤ÎSDO¤¬Â¸ºß¤·¤Ê¤¤¡£(ËÜÎã³°¤Ï¡¢CORBAɸ½à
+ # ¥·¥¹¥Æ¥àÎã³°¤ÎOBJECT_NOT_EXIST¤Ë¥Þ¥Ã¥Ô¥ó¥°¤µ¤ì¤ë)
+ # @exception NotAvailable SDO¤Ï¸ºß¤¹¤ë¤¬±þÅú¤¬¤Ê¤¤¡£
+ # @exception InvalidParameter °ú¿ô "name" ¤¬ null ¤¢¤ë¤¤¤Ï¸ºß¤·¤Ê¤¤¡£
+ # @exception InternalError ÆâÉôŪ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
+ # @else
+ #
+ # @brief [SDO interface] Get SDO Status
+ #
+ # @param name One of the parameters defining the "status" of an SDO.
+ #
+ # @return The value of the specified status parameter.
+ #
+ # @exception SDONotExists if the target SDO does not exist.(This exception
+ # is mapped to CORBA standard system exception
+ # OBJECT_NOT_EXIST.)
+ # @exception NotAvailable The target SDO is reachable but cannot respond.
+ # @exception InvalidParameter The parameter defined by "name" is null or
+ # does not exist.
+ # @exception InternalError The target SDO cannot execute the operation
+ # completely due to some internal error.
+ #
+ #
+ # @endif
+ # virtual CORBA::Any* get_status(const char* name)
+ def get_status(self, name):
+ self._rtcout.RTC_TRACE("get_status(%s)", name)
+ index = OpenRTM_aist.CORBA_SeqUtil.find(self._sdoStatus, self.nv_name(name))
+ if index < 0:
+ raise SDOPackage.InvalidParameter("get_status(): Not found")
+
+ try:
+ return any.to_any(self._sdoStatus[index].value)
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ raise SDOPackage.InternalError("get_status()")
+
+
+
+ #============================================================
+ # Local interfaces
+ #============================================================
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥¤¥ó¥¹¥¿¥ó¥¹Ì¾¤Î¼èÆÀ
+ #
+ # ComponentProfile ¤ËÀßÄꤵ¤ì¤¿¥¤¥ó¥¹¥¿¥ó¥¹Ì¾¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥¤¥ó¥¹¥¿¥ó¥¹Ì¾
+ #
+ # @else
+ #
+ # @endif
+ # const char* getInstanceName()
+ def getInstanceName(self):
+ self._rtcout.RTC_TRACE("getInstanceName()")
+ return self._profile.instance_name
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥¤¥ó¥¹¥¿¥ó¥¹Ì¾¤ÎÀßÄê
+ #
+ # ComponentProfile ¤Ë»ØÄꤵ¤ì¤¿¥¤¥ó¥¹¥¿¥ó¥¹Ì¾¤òÀßÄꤹ¤ë¡£
+ #
+ # @param self
+ #
+ # @param instance_name ¥¤¥ó¥¹¥¿¥ó¥¹Ì¾
+ #
+ # @else
+ #
+ # @endif
+ # void setInstanceName(const char* instance_name);
+ def setInstanceName(self, instance_name):
+ self._rtcout.RTC_TRACE("setInstanceName(%s)", instance_name)
+ self._properties.setProperty("instance_name",instance_name)
+ self._profile.instance_name = self._properties.getProperty("instance_name")
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ·¿Ì¾¤Î¼èÆÀ
+ #
+ # ComponentProfile ¤ËÀßÄꤵ¤ì¤¿·¿Ì¾¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ·¿Ì¾
+ #
+ # @else
+ #
+ # @endif
+ # const char* getTypeName()
+ def getTypeName(self):
+ self._rtcout.RTC_TRACE("getTypeName()")
+ return self._profile.type_name
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] Description ¤Î¼èÆÀ
+ #
+ # ComponentProfile ¤ËÀßÄꤵ¤ì¤¿ Description ¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return Description
+ #
+ # @else
+ #
+ # @endif
+ # const char* getDescription()
+ def getDescription(self):
+ self._rtcout.RTC_TRACE("getDescription()")
+ return self._profile.description
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤Î¼èÆÀ
+ #
+ # ComponentProfile ¤ËÀßÄꤵ¤ì¤¿¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥Ð¡¼¥¸¥ç¥ó¾ðÊó
+ #
+ # @else
+ #
+ # @endif
+ # const char* getVersion()
+ def getVersion(self):
+ self._rtcout.RTC_TRACE("getVersion()")
+ return self._profile.version
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥Ù¥ó¥À¡¼¾ðÊó¤Î¼èÆÀ
+ #
+ # ComponentProfile ¤ËÀßÄꤵ¤ì¤¿¥Ù¥ó¥À¡¼¾ðÊó¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥Ù¥ó¥À¡¼¾ðÊó
+ #
+ # @else
+ #
+ # @endif
+ # const char* getVendor()
+ def getVendor(self):
+ self._rtcout.RTC_TRACE("getVendor()")
+ return self._profile.vendor
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥«¥Æ¥´¥ê¾ðÊó¤Î¼èÆÀ
+ #
+ # ComponentProfile ¤ËÀßÄꤵ¤ì¤¿¥«¥Æ¥´¥ê¾ðÊó¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return ¥«¥Æ¥´¥ê¾ðÊó
+ #
+ # @else
+ #
+ # @endif
+ # const char* getCategory()
+ def getCategory(self):
+ self._rtcout.RTC_TRACE("getCategory()")
+ return self._profile.category
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] Naming Server ¾ðÊó¤Î¼èÆÀ
+ #
+ # ÀßÄꤵ¤ì¤¿ Naming Server ¾ðÊó¤òÊÖ¤¹¡£
+ #
+ # @param self
+ #
+ # @return Naming Server ¥ê¥¹¥È
+ #
+ # @else
+ #
+ # @endif
+ # std::vector<std::string> getNamingNames();
+ def getNamingNames(self):
+ self._rtcout.RTC_TRACE("getNamingNames()")
+ return [s.strip() for s in self._properties.getProperty("naming.names").split(",")]
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹¤ÎÀßÄê
+ #
+ # RTC ¤Î CORBA ¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹¤òÀßÄꤹ¤ë¡£
+ #
+ # @param self
+ # @param rtobj ¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹
+ #
+ # @else
+ #
+ # @endif
+ # void setObjRef(const RTObject_ptr rtobj);
+ def setObjRef(self, rtobj):
+ self._rtcout.RTC_TRACE("setObjRef()")
+ self._objref = rtobj
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹¤Î¼èÆÀ
+ #
+ # ÀßÄꤵ¤ì¤¿ CORBA ¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹¤ò¼èÆÀ¤¹¤ë¡£
+ #
+ # @param self
+ #
+ # @return ¥ª¥Ö¥¸¥§¥¯¥È¥ê¥Õ¥¡¥ì¥ó¥¹
+ #
+ # @else
+ #
+ # @endif
+ # RTObject_ptr getObjRef() const;
+ def getObjRef(self):
+ self._rtcout.RTC_TRACE("getObjRef()")
+ return self._objref
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] RTC ¤Î¥×¥í¥Ñ¥Æ¥£¤òÀßÄꤹ¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤Ù¤¥×¥í¥Ñ¥Æ¥£¤òÀßÄꤹ¤ë¡£Í¿¤¨¤é¤ì¤ë¥×¥í¥Ñ¥Æ¥£¤Ï¡¢
+ # ComponentProfile Åù¤ËÀßÄꤵ¤ì¤ë¤Ù¤¾ðÊó¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ÏÄ̾ï RTC ¤¬½é´ü²½¤µ¤ì¤ëºÝ¤Ë Manager ¤«¤é
+ # ¸Æ¤Ð¤ì¤ë¤³¤È¤ò°Õ¿Þ¤·¤Æ¤¤¤ë¡£
+ #
+ # @param self
+ # @param prop RTC ¤Î¥×¥í¥Ñ¥Æ¥£
+ #
+ # @else
+ #
+ # @brief [local interface] Set RTC property
+ #
+ # This operation sets the properties to the RTC. The given property
+ # values should include information for ComponentProfile.
+ # Generally, this operation is designed to be called from Manager, when
+ # RTC is initialized
+ #
+ # @param prop Property for RTC.
+ #
+ # @endif
+ # void setProperties(const coil::Properties& prop);
+ def setProperties(self, prop):
+ self._rtcout.RTC_TRACE("setProperties()")
+ self._properties.mergeProperties(prop)
+ self._profile.instance_name = self._properties.getProperty("instance_name")
+ self._profile.type_name = self._properties.getProperty("type_name")
+ self._profile.description = self._properties.getProperty("description")
+ self._profile.version = self._properties.getProperty("version")
+ self._profile.vendor = self._properties.getProperty("vendor")
+ self._profile.category = self._properties.getProperty("category")
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] RTC ¤Î¥×¥í¥Ñ¥Æ¥£¤ò¼èÆÀ¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤·¤Æ¤¤¤ë¥×¥í¥Ñ¥Æ¥£¤òÊÖ¤¹¡£
+ # RTC¤¬¥×¥í¥Ñ¥Æ¥£¤ò»ý¤¿¤Ê¤¤¾ì¹ç¤Ï¶õ¤Î¥×¥í¥Ñ¥Æ¥£¤¬ÊÖ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ #
+ # @return RTC ¤Î¥×¥í¥Ñ¥Æ¥£
+ #
+ # @else
+ #
+ # @brief [local interface] Get RTC property
+ #
+ # This operation returns the properties of the RTC.
+ # Empty property would be returned, if RTC has no property.
+ #
+ # @return Property for RTC.
+ #
+ # @endif
+ # coil::Properties& getProperties();
+ def getProperties(self):
+ self._rtcout.RTC_TRACE("getProperties()")
+ return self._properties
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤ÎÀßÄê
+ #
+ # ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤ÈÊÑ¿ô¤ò¥Ð¥¤¥ó¥É¤¹¤ë
+ # \<VarType\>¤È¤·¤Æ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤Î¥Ç¡¼¥¿·¿¤ò»ØÄꤹ¤ë¡£
+ #
+ # @param self
+ # @param param_name ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿Ì¾
+ # @param var ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿³ÊǼÍÑÊÑ¿ô
+ # @param def_val ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¥Ç¥Õ¥©¥ë¥ÈÃÍ
+ # @param trans ʸ»úÎóÊÑ´¹ÍÑ´Ø¿ô(¥Ç¥Õ¥©¥ë¥ÈÃÍ:None)
+ #
+ # @return ÀßÄê·ë²Ì(ÀßÄêÀ®¸ù:true¡¤ÀßÄ꼺ÇÔ:false)
+ #
+ # @else
+ #
+ # @endif
+ # template <typename VarType>
+ # bool bindParameter(const char* param_name, VarType& var,
+ # const char* def_val,
+ # bool (*trans)(VarType&, const char*) = coil::stringTo)
+ def bindParameter(self, param_name, var,
+ def_val, trans=None):
+ self._rtcout.RTC_TRACE("bindParameter()")
+ if trans is None:
+ trans_ = OpenRTM_aist.stringTo
+ else:
+ trans_ = trans
+ self._configsets.bindParameter(param_name, var, def_val, trans_)
+ return True
+
+
+ ##
+ # @if jp
+ #
+ # @brief ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥µ¡¼¥Ó¥¹¤ò¼èÆÀ¤¹¤ë
+ #
+ # ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥µ¡¼¥Ó¥¹¥ª¥Ö¥¸¥§¥¯¥È¤ò¼èÆÀ¤¹¤ë¡£¤³¤Î¥µ¡¼¥Ó
+ # ¥¹¥ª¥Ö¥¸¥§¥¯¥È¤òÍøÍѤ·¤Æ¡¢¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤ÎÁàºî
+ # ¤ò¹Ô¤¦¤³¤È¤¬¤Ç¤¤ë¡£¼ç¤ÊÁàºî¤È¤·¤Æ¤Ï¡¢
+ #
+ # - unbindParameter(): ¥Ñ¥é¥á¡¼¥¿¤Î¥¢¥ó¥Ð¥¤¥ó¥É
+ # - update(): ¥Ñ¥é¥á¡¼¥¿¤Î¹¹¿·
+ # - update(set_name): ÆÃÄê¤Î¥»¥Ã¥È¤Î¹¹¿·
+ # - update(set_name, param_name): ÆÃÄê¤Î¥»¥Ã¥È¤Î¥Ñ¥é¥á¡¼¥¿¤Î¹¹¿·
+ # - isExist(): ¥Ñ¥é¥á¡¼¥¿¤Î¸ºß³Îǧ
+ # - isChanged(): ¥Ñ¥é¥á¡¼¥¿¤¬Êѹ¹¤µ¤ì¤¿¤«¤Î³Îǧ
+ # - changedParameters(): Êѹ¹¤µ¤ì¤¿¥Ñ¥é¥á¡¼¥¿¤Î¥ê¥¹¥È
+ # - getActiveId(): ¥¢¥¯¥Æ¥£¥Ö¥»¥Ã¥È̾¤Î¼èÆÀ
+ # - haveConfig(config_id): ¥³¥ó¥Õ¥£¥°¥»¥Ã¥È¤ò»ý¤Ã¤Æ¤¤¤ë¤«¤É¤¦¤«
+ # - getConfigurationSets(): Á´¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥»¥Ã¥È¤Î¼èÆÀ
+ # - getConfigurationSet(set_id): ÆÃÄꥻ¥Ã¥È¤ò¼èÆÀ
+ #
+ # ¥³¡¼¥ë¥Ð¥Ã¥¯´ØÏ¢
+ # - addConfigurationParamListener(): ¥ê¥¹¥Ê¤ÎÄɲÃ
+ # - removeConfigurationParamListener(): ¥ê¥¹¥Ê¤Îºï½ü
+ # - addConfigurationSetListener(): ¥ê¥¹¥Ê¤ÎÄɲÃ
+ # - removeConfigurationSetListener(): ¥ê¥¹¥Ê¤Îºï½ü
+ # - addConfigurationSetNameListener(): ¥ê¥¹¥Ê¤ÎÄɲÃ
+ # - removeConfigurationSetNameListener(): ¥ê¥¹¥Ê¤Îºï½ü
+ #
+ # ¾ÜºÙ¤ÏConfigAdmin¥¯¥é¥¹¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»²¾È¤Î¤³¤È¡£
+ #
+ # @return ConfigAdmin object
+ #
+ # @else
+ #
+ # @brief Getting configuration service
+ #
+ # This operation returns configuration service object. By using
+ # this service, user can manipulate configuration
+ # parameters. Mainly the following operations are supported.
+ #
+ # - unbindParameter(): Unbinding parameters
+ # - update(): Updateing parameters
+ # - update(set_name): Updating a specific configuration set
+ # - update(set_name, param_name): Updating specific parameter in a set
+ # - isExist(): Checking existence of a parameter
+ # - isChanged(): Check if a parameter was updated
+ # - changedParameters(): Getting changed parameter list
+ # - getActiveId(): Getting active configuration set name
+ # - haveConfig(config_id): Checking if having a specified configuration set
+ # - getConfigurationSets(): getting all the configuration sets
+ # - getConfigurationSet(set_id): Getting a configuration set
+ #
+ # Callback related member functions
+ # - addConfigurationParamListener(): Adding listener
+ # - removeConfigurationParamListener(): Removing listener
+ # - addConfigurationSetListener(): Adding listener
+ # - removeConfigurationSetListener(): Removing listener
+ # - addConfigurationSetNameListener(): Adding listener
+ # - removeConfigurationSetNameListener(): Removing listener
+ #
+ # See details in the ConfigAdmin class reference
+ #
+ # @return ConfigAdmin object
+ #
+ # @endif
+ #
+ # ConfigAdmin& getConfigService() { return m_configsets; }
+ def getConfigService(self):
+ return self._configsets
+
+ ##
+ # @if jp
+ #
+ # @brief ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤Î¹¹¿·(ID»ØÄê)
+ #
+ # »ØÄꤷ¤¿ID¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥»¥Ã¥È¤ËÀßÄꤷ¤¿Ãͤǡ¢
+ # ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Ñ¥é¥á¡¼¥¿¤ÎÃͤò¹¹¿·¤¹¤ë
+ #
+ # @param self
+ # @param config_set ÀßÄêÂоݤΥ³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥»¥Ã¥ÈID
+ #
+ # @else
+ #
+ # @endif
+ # void updateParameters(const char* config_set);
+ def updateParameters(self, config_set):
+ self._rtcout.RTC_TRACE("updateParameters(%s)", config_set)
+ self._configsets.update(config_set)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] Port ¤òÅÐÏ¿¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëPort¤òÅÐÏ¿¤¹¤ë¡£
+ # Port ¤ò³°Éô¤«¤é¥¢¥¯¥»¥¹²Äǽ¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤Ë¤è¤ê
+ # ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ÅÐÏ¿¤µ¤ì¤ë Port ¤Ï¤³¤Î RTC ÆâÉô¤Ë¤ª¤¤¤Æ
+ # PortProfile.name ¤Ë¤è¤ê¶èÊ̤µ¤ì¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢Port ¤Ï RTC Æâ¤Ë¤ª¤¤¤Æ¡¢
+ # ¥æ¥Ë¡¼¥¯¤Ê PortProfile.name ¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ # ÅÐÏ¿¤µ¤ì¤¿ Port ¤ÏÆâÉô¤ÇŬÀڤ˥¢¥¯¥Æ¥£¥Ö²½¤µ¤ì¤¿¸å¡¢¤½¤Î»²¾È¤È
+ # ¥ª¥Ö¥¸¥§¥¯¥È»²¾È¤¬¥ê¥¹¥ÈÆâ¤ËÊݸ¤µ¤ì¤ë¡£
+ #
+ # @param self
+ # @param port RTC ¤ËÅÐÏ¿¤¹¤ë Port
+ # @param port_type if port is PortBase, port_type is None,
+ # if port is PortService, port_type is True
+ #
+ # @else
+ #
+ # @brief [local interface] Register Port
+ #
+ # This operation registers a Port to be held by this RTC.
+ # In order to enable access to the Port from outside of RTC, the Port
+ # must be registered by this operation. The Port that is registered by
+ # this operation would be identified by PortProfile.name in the inside of
+ # RTC. Therefore, the Port should have unique PortProfile.name in the RTC.
+ # The registering Port would be activated properly, and the reference
+ # and the object reference would be stored in lists in RTC.
+ #
+ # @param port Port which is registered in the RTC
+ #
+ # @endif
+ # void registerPort(PortBase& port);
+ def registerPort(self, port):
+ self._rtcout.RTC_TRACE("registerPort()")
+ if not self.addPort(port):
+ self._rtcout.RTC_ERROR("addPort(PortBase&) failed.")
+ return
+
+ # void registerPort(PortService_ptr port);
+ # def registerPortByReference(self, port_ref):
+ # self._rtcout.RTC_TRACE("registerPortByReference()")
+ # self.addPortByReference(port_ref)
+ # return
+
+ # new interface. since 1.0.0-RELEASE
+ # void addPort(PortBase& port);
+ def addPort(self, port):
+ self._rtcout.RTC_TRACE("addPort()")
+ if isinstance(port, OpenRTM_aist.CorbaPort):
+ self._rtcout.RTC_TRACE("addPort(CorbaPort)")
+ propkey = "port.corbaport."
+ prop = self._properties.getNode(propkey)
+ if prop:
+ self._properties.getNode(propkey).mergeProperties(self._properties.getNode("port.corba"))
+ port.init(self._properties.getNode(propkey))
+ port.setOwner(self.getObjRef())
+
+ elif isinstance(port, OpenRTM_aist.PortBase):
+ self._rtcout.RTC_TRACE("addPort(PortBase)")
+ port.setOwner(self.getObjRef())
+ port.setPortConnectListenerHolder(self._portconnListeners)
+ self.onAddPort(port.getPortProfile())
+
+ elif isinstance(port, RTC._objref_PortService):
+ self._rtcout.RTC_TRACE("addPort(PortService)")
+ return self._portAdmin.addPort(port)
+
+
+ # new interface. since 1.0.0-RELEASE
+ # void addPort(PortService_ptr port);
+ # def addPortByReference(self, port_ref):
+ # self._rtcout.RTC_TRACE("addPortByReference()")
+ # self._portAdmin.registerPortByReference(port_ref)
+ # return
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] DataInPort ¤òÅÐÏ¿¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ë DataInPort ¤òÅÐÏ¿¤¹¤ë¡£
+ # Port ¤Î¥×¥í¥Ñ¥Æ¥£¤Ë¥Ç¡¼¥¿¥Ý¡¼¥È¤Ç¤¢¤ë¤³¤È("port.dataport")¡¢
+ # TCP¤ò»ÈÍѤ¹¤ë¤³¤È("tcp_any")¤òÀßÄꤹ¤ë¤È¤È¤â¤Ë¡¢ DataInPort ¤Î
+ # ¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¡¢ÅÐÏ¿¤¹¤ë¡£
+ #
+ # @param self
+ # @param name port ̾¾Î
+ # @param inport ÅÐÏ¿ÂÐ¾Ý DataInPort
+ #
+ # @else
+ #
+ # @endif
+ def registerInPort(self, name, inport):
+ self._rtcout.RTC_TRACE("registerInPort(%s)", name)
+ if not self.addInPort(name, inport):
+ self._rtcout.RTC_ERROR("addInPort(%s) failed.", name)
+ return
+
+ # new interface. since 1.0.0-RELEASE
+ def addInPort(self, name, inport):
+ self._rtcout.RTC_TRACE("addInPort(%s)", name)
+
+ propkey = "port.inport." + name
+ prop_ = copy.copy(self._properties.getNode(propkey))
+ prop_.mergeProperties(self._properties.getNode("port.inport.dataport"))
+
+ ret = self.addPort(inport)
+
+ if not ret:
+ self._rtcout.RTC_ERROR("addInPort() failed.")
+ return ret
+
+ inport.init(self._properties.getNode(propkey))
+ self._inports.append(inport)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] DataOutPort ¤òÅÐÏ¿¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ë DataOutPor t¤òÅÐÏ¿¤¹¤ë¡£
+ # Port ¤Î¥×¥í¥Ñ¥Æ¥£¤Ë¥Ç¡¼¥¿¥Ý¡¼¥È¤Ç¤¢¤ë¤³¤È("port.dataport")¡¢
+ # TCP¤ò»ÈÍѤ¹¤ë¤³¤È("tcp_any")¤òÀßÄꤹ¤ë¤È¤È¤â¤Ë¡¢ DataOutPort ¤Î
+ # ¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¡¢ÅÐÏ¿¤¹¤ë¡£
+ #
+ # @param self
+ # @param name port ̾¾Î
+ # @param outport ÅÐÏ¿ÂÐ¾Ý DataInPort
+ #
+ # @else
+ #
+ # @endif
+ # void registerOutPort(const char* name, OutPortBase& outport);
+ def registerOutPort(self, name, outport):
+ self._rtcout.RTC_TRACE("registerOutPort(%s)", name)
+ if not self.addOutPort(name, outport):
+ self._rtcout.RTC_ERROR("addOutPort(%s) failed.", name)
+ return
+
+ # new interface. since 1.0.0-RELEASE
+ # void addOutPort(const char* name, OutPortBase& outport);
+ def addOutPort(self, name, outport):
+ self._rtcout.RTC_TRACE("addOutPort(%s)", name)
+
+ propkey = "port.outport." + name
+ prop_ = copy.copy(self._properties.getNode(propkey))
+ prop_.mergeProperties(self._properties.getNode("port.outport.dataport"))
+
+ ret = self.addPort(outport)
+
+ if not ret:
+ self._rtcout.RTC_ERROR("addOutPort() failed.")
+ return ret
+
+ outport.init(self._properties.getNode(propkey))
+ self._outports.append(outport)
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] InPort ¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëInPort¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë¡£
+ #
+ # @param port ºï½üÂÐ¾Ý Port
+ # @return ºï½ü·ë²Ì(ºï½üÀ®¸ù:true¡¤ºï½ü¼ºÇÔ:false)
+ #
+ # @else
+ #
+ # @brief [local interface] Unregister InPort
+ #
+ # This operation unregisters a InPort held by this RTC.
+ #
+ # @param port Port which is unregistered
+ # @return Unregister result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # bool removeInPort(InPortBase& port);
+ def removeInPort(self, port):
+ self._rtcout.RTC_TRACE("removeInPort()")
+ ret = self.removePort(port)
+
+ if ret:
+ for inport in self._inports:
+ if port == inport:
+
+ self._inports.remove(port)
+
+ return True
+
+ return False
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] OutPort ¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëOutPort¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë¡£
+ #
+ # @param port ºï½üÂÐ¾Ý Port
+ # @return ºï½ü·ë²Ì(ºï½üÀ®¸ù:true¡¤ºï½ü¼ºÇÔ:false)
+ #
+ # @else
+ #
+ # @brief [local interface] Unregister OutPort
+ #
+ # This operation unregisters a OutPort held by this RTC.
+ #
+ # @param port Port which is unregistered
+ # @return Unregister result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # bool removeOutPort(OutPortBase& port);
+ def removeOutPort(self, port):
+ self._rtcout.RTC_TRACE("removeOutPort()")
+ ret = self.removePort(port)
+
+ if ret:
+ for outport in self._outports:
+ if port == outport:
+
+ self._outports.remove(port)
+
+ return True
+
+ return False
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] Port ¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëPort¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë¡£
+ #
+ # @param self
+ # @param port ºï½üÂÐ¾Ý Port
+ #
+ # @else
+ #
+ # @brief [local interface] Unregister Port
+ #
+ # This operation unregisters a Port to be held by this RTC.
+ #
+ # @param port Port which is unregistered in the RTC
+ #
+ # @endif
+ # void RTObject_impl::deletePort(PortBase& port)
+ def deletePort(self, port):
+ self._rtcout.RTC_TRACE("deletePort()")
+ if not self.removePort(port):
+ self._rtcout.RTC_ERROR("removePort() failed.")
+ return
+
+ # new interface. since 1.0.0-RELEASE
+ def removePort(self, port):
+ self._rtcout.RTC_TRACE("removePort()")
+ if isinstance(port, OpenRTM_aist.PortBase) or isinstance(port, OpenRTM_aist.CorbaPort):
+ self.onRemovePort(port.getPortProfile())
+ return self._portAdmin.removePort(port)
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ̾Á°»ØÄê¤Ë¤è¤ê Port ¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë
+ #
+ # ̾¾Î¤ò»ØÄꤷ¤Æ RTC ¤¬ÊÝ»ý¤¹¤ëPort¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë¡£
+ #
+ # @param self
+ # @param port_name ºï½üÂÐ¾Ý Port ̾
+ #
+ # @else
+ #
+ # @endif
+ def deletePortByName(self, port_name):
+ self._rtcout.RTC_TRACE("deletePortByName(%s)", port_name)
+ self._portAdmin.deletePortByName(port_name)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤ò¼èÆÀ¤¹¤ë
+ #
+ # get_context() ¤ÈƱ¤¸µ¡Ç½¤Î¥í¡¼¥«¥ëÈÇ¡£°ã¤¤¤Ï¤Ê¤¤¡£
+ # ¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î´Ø¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¤³¤ì¤é¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ #
+ # @else
+ #
+ # @brief [local interface] Getting current execution context
+ #
+ # This function is the local version of get_context(). completely
+ # same as get_context() function. This function is assumed to be
+ # called from the following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ #
+ # @endif
+ #
+ # ExecutionContext_ptr getExecutionContext(RTC::UniqueId ec_id);
+ def getExecutionContext(self, ec_id):
+ return self.get_context(ec_id)
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î¼Â¹Ô¥ì¡¼¥È¤ò¼èÆÀ¤¹¤ë
+ #
+ # ¸½ºß¼Â¹ÔÃæ¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î¼Â¹Ô¥ì¡¼¥È¤ò¼èÆÀ¤¹¤ë¡£¼Â¹Ô¥³¥ó¥Æ¥
+ # ¥¹¥È¤ÎKind¤¬PERIODIC°Ê³°¤Î¾ì¹ç¤ÎÆ°ºî¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê
+ # ²¼¤Î´Ø¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¤³¤ì¤é¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ #
+ # @else
+ #
+ # @brief [local interface] Getting current context' execution rate
+ #
+ # This function returns current execution rate in this
+ # context. If this context's kind is not PERIODC, behavior is not
+ # defined. This function is assumed to be called from the
+ # following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ #
+ # @endif
+ #
+ # double getExecutionRate(RTC::UniqueId ec_id);
+ def getExecutionRate(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return 0.0
+
+ return ec.get_rate()
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î¼Â¹Ô¥ì¡¼¥È¤òÀßÄꤹ¤ë
+ #
+ # ¸½ºß¼Â¹ÔÃæ¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î¼Â¹Ô¥ì¡¼¥È¤òÀßÄꤹ¤ë¡£¼Â¹Ô¥³¥ó¥Æ¥
+ # ¥¹¥È¤ÎKind¤¬PERIODIC°Ê³°¤Î¾ì¹ç¤ÎÆ°ºî¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê
+ # ²¼¤Î´Ø¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¤³¤ì¤é¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ # @param rate ¼Â¹Ô¥ì¡¼¥È¤ò [Hz] ¤ÇÍ¿¤¨¤ë
+ #
+ # @else
+ #
+ # @brief [local interface] Setting current context' execution rate
+ #
+ # This function sets a execution rate in the context. If this
+ # context's kind is not PERIODC, behavior is not defined. This
+ # function is assumed to be called from the following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @param rate Execution rate in [Hz].
+ #
+ # @endif
+ #
+ # ReturnCode_t setExecutionRate(RTC::UniqueId ec_id, double rate);
+ def setExecutionRate(self, ec_id, rate):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ ec.set_rate(rate)
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î½ê͸¢¤òÄ´¤Ù¤ë
+ #
+ # ¸½ºß¼Â¹ÔÃæ¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¤Î½ê͸¢¤òÄ´¤Ù¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î´Ø
+ # ¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¤³¤ì¤é¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ # @return true: ¼«¿È¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È¡¢false: ¾¤Î¼Â¹Ô¥³¥ó¥Æ¥¥¹¥È
+ #
+ # @else
+ #
+ # @brief [local interface] Checking if the current context is own context
+ #
+ # This function checks if the current context is own execution
+ # context. This function is assumed to be called from the
+ # following functions.
+ #
+ # - onStartup()
+ # - onShutdown()
+ # - onActivated()
+ # - onDeactivated()
+ # - onExecute()
+ # - onAborting()
+ # - onError()
+ # - onReset()
+ # - onStateUpdate()
+ # - onRateChanged()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above functions.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return true: Own context, false: other's context
+ #
+ # @endif
+ #
+ # bool isOwnExecutionContext(RTC::UniqueId ec_id);
+ def isOwnExecutionContext(self, ec_id):
+ global ECOTHER_OFFSET
+ if ec_id < ECOTHER_OFFSET:
+ return True
+ return False
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¾õÂÖ¤ò Inactive ¤ËÁ«°Ü¤µ¤»¤ë
+ #
+ # ¾õÂÖ¤ò Active ¤«¤é Inactive ¤ËÁ«°Ü¤µ¤»¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î´Ø
+ # ¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onActivated()
+ # - onExecute()
+ # - onStateUpdate()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¾åµ¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ # @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [local interface] Make transition to Inactive state
+ #
+ # This function makes transition from Active to Inactive
+ # state. This function is assumed to be called from the following
+ # functions.
+ #
+ # - onActivated()
+ # - onExecute()
+ # - onStateUpdate()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above function.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return Return code
+ #
+ # @endif
+ #
+ # ReturnCode_t deactivate(RTC::UniqueId ec_id);
+ def deactivate(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ return ec.deactivate_component(self.getObjRef())
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¾õÂÖ¤ò Active ¤ËÁ«°Ü¤µ¤»¤ë
+ #
+ # ¾õÂÖ¤ò Inactive ¤«¤é Active ¤ËÁ«°Ü¤µ¤»¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î´Ø
+ # ¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onStartup()
+ # - onDeactivated()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¾åµ¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ # @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [local interface] Make transition to Active state
+ #
+ # This function makes transition from Inactive to Active
+ # state. This function is assumed to be called from the following
+ # functions.
+ #
+ # - onStartup()
+ # - onDeactivated()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above function.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return Return code
+ #
+ # @endif
+ #
+ # ReturnCode_t activate(RTC::UniqueId ec_id);
+ def activate(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ return ec.activate_component(self.getObjRef())
+
+
+ ##
+ # @if jp
+ #
+ # @brief [local interface] ¾õÂÖ¤ò¥ê¥»¥Ã¥È¤· Inactive ¤ËÁ«°Ü¤µ¤»¤ë
+ #
+ # ¾õÂÖ¤ò Error ¤«¤é Inactive ¤ËÁ«°Ü¤µ¤»¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î´Ø
+ # ¿ôÆâ¤Ç¸Æ¤Ð¤ì¤ë¤³¤È¤òÁ°Äó¤È¤·¤Æ¤¤¤ë¡£
+ #
+ # - onError()
+ #
+ # ¤³¤Î´Ø¿ô¤Î°ú¿ô¤Ï¾åµ¤Î´Ø¿ô¤Î°ú¿ô UniquieID exec_handle ¤Ç¤Ê¤±
+ # ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+ #
+ # @param ec_id ¾åµ´Ø¿ô¤ÎÂè1°ú¿ô exec_handle ¤òÅϤ¹É¬Íפ¬¤¢¤ë¡£
+ # @return ¥ê¥¿¡¼¥ó¥³¡¼¥É
+ #
+ # @else
+ #
+ # @brief [local interface] Resetting and go to Inactive state
+ #
+ # This function reset RTC and makes transition from Error to Inactive
+ # state. This function is assumed to be called from the following
+ # functions.
+ #
+ # - onError()
+ #
+ # The argument of this function should be the first argument
+ # (UniqueId ec_id) of the above function.
+ #
+ # @param ec_id The above functions' first argument "exec_handle."
+ # @return Return code
+ #
+ # @endif
+ #
+ # ReturnCode_t reset(RTC::UniqueId ec_id);
+ def reset(self, ec_id):
+ ec = self.getExecutionContext(ec_id)
+ if CORBA.is_nil(ec):
+ return RTC.RTC_ERROR
+ return ec.reset_component(self.getObjRef())
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service provider ¤ò¥»¥Ã¥È¤¹¤ë
+ # @else
+ # @brief [local interface] Set a SDO service provider
+ # @endif
+ #
+ # bool addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ # SdoServiceProviderBase* provider);
+ def addSdoServiceProvider(self, prof, provider):
+ return self._sdoservice.addSdoServiceProvider(prof, provider)
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service provider ¤òºï½ü¤¹¤ë
+ # @else
+ # @brief [local interface] Remove a SDO service provider
+ # @endif
+ #
+ # bool removeSdoServiceProvider(const char* id);
+ def removeSdoServiceProvider(self, id):
+ return self._sdoservice.removeSdoServiceProvider(id)
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service consumer ¤ò¥»¥Ã¥È¤¹¤ë
+ # @else
+ # @brief [local interface] Set a SDO service consumer
+ # @endif
+ #
+ # bool addSdoServiceConsumer(const SDOPackage::ServiceProfile& prof);
+ def addSdoServiceConsumer(self, prof):
+ return self._sdoservice.addSdoServiceConsumer(prof)
+
+
+ ##
+ # @if jp
+ # @brief [local interface] SDO service consumer ¤òºï½ü¤¹¤ë
+ # @else
+ # @brief [local interface] Remove a SDO service consumer
+ # @endif
+ #
+ # bool removeSdoServiceConsumer(const char* id);
+ def removeSdoServiceConsumer(self, id):
+ return self._sdoservice.removeSdoServiceConsumer(id)
+
+
+ ##
+ # @if jp
+ #
+ # @brief Á´ InPort ¤Î¥Ç¡¼¥¿¤òÆɤ߹þ¤à¡£
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëÁ´¤Æ¤Î InPort ¤Î¥Ç¡¼¥¿¤òÆɤ߹þ¤à¡£
+ #
+ # @return Æɤ߹þ¤ß·ë²Ì(Á´¥Ý¡¼¥È¤ÎÆɤ߹þ¤ßÀ®¸ù:true¡¤¼ºÇÔ:false)
+ #
+ # @else
+ #
+ # @brief Readout the value from All InPorts.
+ #
+ # This operation read the value from all InPort
+ # registered in the RTC.
+ #
+ # @return result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # bool readAll();
+ def readAll(self):
+ self._rtcout.RTC_TRACE("readAll()")
+ ret = True
+ for inport in self._inports:
+ if not inport.read():
+ self._rtcout.RTC_DEBUG("The error occurred in readAll().")
+ ret = False
+ if not self._readAllCompletion:
+ return False
+
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief Á´ OutPort ¤Îwrite()¥á¥½¥Ã¥É¤ò¥³¡¼¥ë¤¹¤ë¡£
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëÁ´¤Æ¤Î OutPort ¤Îwrite()¥á¥½¥Ã¥É¤ò¥³¡¼¥ë¤¹¤ë¡£
+ #
+ # @return Æɤ߹þ¤ß·ë²Ì(Á´¥Ý¡¼¥È¤Ø¤Î½ñ¤¹þ¤ßÀ®¸ù:true¡¤¼ºÇÔ:false)
+ #
+ # @else
+ #
+ # @brief The write() method of all OutPort is called.
+ #
+ # This operation call the write() method of all OutPort
+ # registered in the RTC.
+ #
+ # @return result (Successful:true, Failed:false)
+ #
+ # @endif
+ #
+ # bool writeAll();
+ def writeAll(self):
+ self._rtcout.RTC_TRACE("writeAll()")
+ ret = True
+ for outport in self._outports:
+ if not outport.write():
+ self._rtcout.RTC_DEBUG("The error occurred in writeAll().")
+ ret = False
+ if not self._writeAllCompletion:
+ return False
+
+ return ret
+
+
+ ##
+ # @if jp
+ #
+ # @brief onExecute()¼Â¹ÔÁ°¤Ç¤ÎreadAll()¥á¥½¥Ã¥É¤Î¸Æ½Ð¤ò͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
+ #
+ # ¤³¤Î¥á¥½¥Ã¥É¤ò¥Ñ¥é¥á¡¼¥¿¤òtrue¤È¤·¤Æ¸Æ¤Ö»ö¤Ë¤è¤ê¡¢onExecute()¼Â¹ÔÁ°¤Ë
+ # readAll()¤¬¸Æ½Ð¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
+ # ¥Ñ¥é¥á¡¼¥¿¤¬false¤Î¾ì¹ç¤Ï¡¢readAll()¸Æ½Ð¤ò̵¸ú¤Ë¤¹¤ë¡£
+ #
+ # @param read(default:true)
+ # (readAll()¥á¥½¥Ã¥É¸Æ½Ð¤¢¤ê:true, readAll()¥á¥½¥Ã¥É¸Æ½Ð¤Ê¤·:false)
+ #
+ # @param completion(default:false)
+ # readAll()¤Ë¤Æ¡¢¤É¤ì¤«¤Î°ì¤Ä¤ÎInPort¤Îread()¤¬¼ºÇÔ¤·¤Æ¤âÁ´¤Æ¤ÎInPort¤Îread()¤ò¸Æ¤Ó½Ð¤¹:true,
+ # readAll()¤Ë¤Æ¡¢¤É¤ì¤«¤Î°ì¤Ä¤ÎInPort¤Îread()¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢¤¹¤°¤Ëfalse¤ÇÈ´¤±¤ë:false
+ #
+ # @else
+ #
+ # @brief Set whether to execute the readAll() method.
+ #
+ # Set whether to execute the readAll() method.
+ #
+ # @param read(default:true)
+ # (readAll() is called:true, readAll() isn't called:false)
+ #
+ # @param completion(default:false)
+ # All InPort::read() calls are completed.:true,
+ # If one InPort::read() is False, return false.:false
+ #
+ # @param completion(default:false)
+ #
+ # @endif
+ #
+ # void setReadAll(bool read=true, bool completion=false);
+ def setReadAll(self, read=True, completion=False):
+ self._readAll = read
+ self._readAllCompletion = completion
+
+
+ ##
+ # @if jp
+ #
+ # @brief onExecute()¼Â¹Ô¸å¤ËwriteAll()¥á¥½¥Ã¥É¤Î¸Æ½Ð¤ò͸ú¤Þ¤¿¤Ï̵¸ú¤Ë¤¹¤ë¡£
+ #
+ # ¤³¤Î¥á¥½¥Ã¥É¤ò¥Ñ¥é¥á¡¼¥¿¤òtrue¤È¤·¤Æ¸Æ¤Ö»ö¤Ë¤è¤ê¡¢onExecute()¼Â¹Ô¸å¤Ë
+ # writeAll()¤¬¸Æ½Ð¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
+ # ¥Ñ¥é¥á¡¼¥¿¤¬false¤Î¾ì¹ç¤Ï¡¢writeAll()¸Æ½Ð¤ò̵¸ú¤Ë¤¹¤ë¡£
+ #
+ # @param write(default:true)
+ # (writeAll()¥á¥½¥Ã¥É¸Æ½Ð¤¢¤ê:true, writeAll()¥á¥½¥Ã¥É¸Æ½Ð¤Ê¤·:false)
+ #
+ # @param completion(default:false)
+ # writeAll()¤Ë¤Æ¡¢¤É¤ì¤«¤Î°ì¤Ä¤ÎOutPort¤Îwrite()¤¬¼ºÇÔ¤·¤Æ¤âÁ´¤Æ¤ÎOutPort¤Îwrite()¤ò¸Æ¤Ó½Ð¤·¤ò¹Ô¤¦:true,
+ # writeAll()¤Ë¤Æ¡¢¤É¤ì¤«¤Î°ì¤Ä¤ÎOutPort¤Îwrite()¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢¤¹¤°¤Ëfalse¤ÇÈ´¤±¤ë:false
+ #
+ # @else
+ #
+ # @brief Set whether to execute the writeAll() method.
+ #
+ # Set whether to execute the writeAll() method.
+ #
+ # @param write(default:true)
+ # (writeAll() is called:true, writeAll() isn't called:false)
+ #
+ # @param completion(default:false)
+ # All OutPort::write() calls are completed.:true,
+ # If one OutPort::write() is False, return false.:false
+ #
+ # @endif
+ #
+ # void setWriteAll(bool write=true, bool completion=false);
+ def setWriteAll(self, write=True, completion=False):
+ self._writeAll = write
+ self._writeAllCompletion = completion
+
+
+ ##
+ # @if jp
+ #
+ # @brief Á´ Port ¤ÎÅÐÏ¿¤òºï½ü¤¹¤ë
+ #
+ # RTC ¤¬ÊÝ»ý¤¹¤ëÁ´¤Æ¤Î Port ¤òºï½ü¤¹¤ë¡£
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @brief Unregister the All Portse
+ #
+ # This operation deactivates the all Port and deletes the all Port's
+ # registrations in the RTC..
+ #
+ # @endif
+ def finalizePorts(self):
+ self._rtcout.RTC_TRACE("finalizePorts()")
+ self._portAdmin.finalizePorts()
+ self._inports = []
+ self._outports = []
+ return
+
+
+ def finalizeContexts(self):
+ self._rtcout.RTC_TRACE("finalizeContexts()")
+ len_ = len(self._eclist)
+ for i in range(len_):
+ idx = (len_ - 1) - i
+ self._eclist[idx].stop()
+ try:
+ self._poa.deactivate_object(self._poa.servant_to_id(self._eclist[idx]))
+ except:
+ self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
+ del self._eclist[idx]
+
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief PreComponentActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # ComponentAction ¼ÂÁõ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·Ä¾Á°¤Î¥¤¥Ù¥ó¥È¤Ë´ØÏ¢¤¹¤ë³Æ¼ï¥ê
+ # ¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - PRE_ON_INITIALIZE: onInitialize ľÁ°
+ # - PRE_ON_FINALIZE: onFinalize ľÁ°
+ # - PRE_ON_STARTUP: onStartup ľÁ°
+ # - PRE_ON_SHUTDOWN: onShutdown ľÁ°
+ # - PRE_ON_ACTIVATED: onActivated ľÁ°
+ # - PRE_ON_DEACTIVATED: onDeactivated ľÁ°
+ # - PRE_ON_ABORTING: onAborted ľÁ°
+ # - PRE_ON_ERROR: onError ľÁ°
+ # - PRE_ON_RESET: onReset ľÁ°
+ # - PRE_ON_EXECUTE: onExecute ľÁ°
+ # - PRE_ON_STATE_UPDATE: onStateUpdate ľÁ°
+ #
+ # ¥ê¥¹¥Ê¤Ï PreComponentActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PreComponentActionListener::operator()(UniqueId ec_id)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePreComponentActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PreComponentAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # pre events.
+ # The following listener types are available.
+ #
+ # - PRE_ON_INITIALIZE: before onInitialize
+ # - PRE_ON_FINALIZE: before onFinalize
+ # - PRE_ON_STARTUP: before onStartup
+ # - PRE_ON_SHUTDOWN: before onShutdown
+ # - PRE_ON_ACTIVATED: before onActivated
+ # - PRE_ON_DEACTIVATED: before onDeactivated
+ # - PRE_ON_ABORTING: before onAborted
+ # - PRE_ON_ERROR: before onError
+ # - PRE_ON_RESET: before onReset
+ # - PRE_ON_EXECUTE: before onExecute
+ # - PRE_ON_STATE_UPDATE: before onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PreComponentActionListener::operator()(UniqueId ec_id)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePreComponentActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PreComponentActionListener*
+ # addPreComponentActionListener(PreCompActionListenerType listener_type,
+ # void (Listener::*memfunc)(UniqueId ec_id),
+ # bool autoclean = true)
+ def addPreComponentActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PreComponentActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+
+ def __call__(self, ec_id):
+ self._memfunc(ec_id)
+ return
+
+ listener = Noname(memfunc)
+ self._actionListeners.preaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PreComponentActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PreComponentAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removePreComponentActionListener(PreComponentActionListenerType listener_type,
+ # PreComponentActionListener* listener);
+ def removePreComponentActionListener(self, listener_type, listener):
+ self._actionListeners.preaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PostComponentActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # ComponentAction ¼ÂÁõ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·Ä¾¸å¤Î¥¤¥Ù¥ó¥È¤Ë´ØÏ¢¤¹¤ë³Æ¼ï¥ê
+ # ¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - POST_ON_INITIALIZE: onInitialize ľ¸å
+ # - POST_ON_FINALIZE: onFinalize ľ¸å
+ # - POST_ON_STARTUP: onStartup ľ¸å
+ # - POST_ON_SHUTDOWN: onShutdown ľ¸å
+ # - POST_ON_ACTIVATED: onActivated ľ¸å
+ # - POST_ON_DEACTIVATED: onDeactivated ľ¸å
+ # - POST_ON_ABORTING: onAborted ľ¸å
+ # - POST_ON_ERROR: onError ľ¸å
+ # - POST_ON_RESET: onReset ľ¸å
+ # - POST_ON_EXECUTE: onExecute ľ¸å
+ # - POST_ON_STATE_UPDATE: onStateUpdate ľ¸å
+ #
+ # ¥ê¥¹¥Ê¤Ï PostComponentActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PostComponentActionListener::operator()(UniqueId ec_id, ReturnCode_t ret)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePostComponentActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PostComponentAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - POST_ON_INITIALIZE: after onInitialize
+ # - POST_ON_FINALIZE: after onFinalize
+ # - POST_ON_STARTUP: after onStartup
+ # - POST_ON_SHUTDOWN: after onShutdown
+ # - POST_ON_ACTIVATED: after onActivated
+ # - POST_ON_DEACTIVATED: after onDeactivated
+ # - POST_ON_ABORTING: after onAborted
+ # - POST_ON_ERROR: after onError
+ # - POST_ON_RESET: after onReset
+ # - POST_ON_EXECUTE: after onExecute
+ # - POST_ON_STATE_UPDATE: after onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PostComponentActionListener::operator()(UniqueId ec_id, ReturnCode_t ret)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePostComponentActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PostComponentActionListener*
+ # addPostComponentActionListener(PostCompActionListenerType listener_type,
+ # void (Listener::*memfunc)(UniqueId ec_id,
+ # ReturnCode_t ret),
+ # bool autoclean = true)
+ def addPostComponentActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PostComponentActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+ def __call__(self, ec_id, ret):
+ self._memfunc(ec_id, ret)
+ return
+
+ listener = Noname(memfunc)
+ self._actionListeners.postaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PostComponentActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PostComponentAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ ##
+ # void
+ # removePostComponentActionListener(PostComponentActionListenerType listener_type,
+ # PostComponentActionListener* listener);
+ def removePostComponentActionListener(self, listener_type, listener):
+ self._actionListeners.postaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PortActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # Port¤ÎÄɲᢺï½ü»þ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - ADD_PORT: PortÄɲûþ
+ # - REMOVE_PORT: Portºï½ü»þ
+ #
+ # ¥ê¥¹¥Ê¤Ï PortActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PortActionListener::operator()(PortProfile& pprof)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePortActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PortAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - ADD_PORT: At adding Port
+ # - REMOVE_PORT: At removing Port
+ #
+ # Listeners should have the following function operator().
+ #
+ # PortActionListener::operator()(RTC::PortProfile pprof)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePortActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PortActionListener*
+ # addPortActionListener(PortActionListenerType listener_type,
+ # void (Listener::*memfunc)(const RTC::PortProfile&),
+ # bool autoclean=true)
+ def addPortActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PortActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, pprofile):
+ self._memfunc(pprofile)
+ return
+
+ listener = Noname(memfunc)
+
+ self._actionListeners.portaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PortActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PortAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ # void
+ # removePortActionListener(PortActionListenerType listener_type,
+ # PortActionListener* listener);
+ def removePortActionListener(self, listener_type, listener):
+ self._actionListeners.portaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief ExecutionContextActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # ExecutionContext¤ÎÄɲᢺï½ü»þ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - ATTACH_EC: ExecutionContext ¥¢¥¿¥Ã¥Á»þ
+ # - DETACH_EC: ExecutionContext ¥Ç¥¿¥Ã¥Á»þ
+ #
+ # ¥ê¥¹¥Ê¤Ï ExecutionContextActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # ExecutionContextActionListener::operator()(UniqueId¡¡ec_id)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removeExecutionContextActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding ExecutionContextAction type listener
+ #
+ # This operation adds certain listeners related to ComponentActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - ADD_PORT: At adding ExecutionContext
+ # - REMOVE_PORT: At removing ExecutionContext
+ #
+ # Listeners should have the following function operator().
+ #
+ # ExecutionContextActionListener::operator()(UniqueId ec_id)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removeExecutionContextActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ECActionListener*
+ # addExecutionContextActionListener(ECActionListenerType listener_type,
+ # void (Listener::*memfunc)(UniqueId),
+ # bool autoclean = true);
+ def addExecutionContextActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ExecutionContextActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, ec_id):
+ self._memfunc(ec_id)
+ return
+
+ listener = Noname(memfunc)
+ self._actionListeners.ecaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief ExecutionContextActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing ExecutionContextAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removeExecutionContextActionListener(ECActionListenerType listener_type,
+ # ECActionListener* listener);
+ def removeExecutionContextActionListener(self, listener_type, listener):
+ self._actionListeners.ecaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PortConnectListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # Port¤ÎÀܳ»þ¤äÀܳ²ò½ü»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - ON_NOTIFY_CONNECT: notify_connect() ´Ø¿ôÆâ¸Æ¤Ó½Ð¤·Ä¾¸å
+ # - ON_NOTIFY_DISCONNECT: notify_disconnect() ¸Æ¤Ó½Ð¤·Ä¾¸å
+ # - ON_UNSUBSCRIBE_INTERFACES: notify_disconnect() Æâ¤ÎIF¹ØÆɲò½ü»þ
+ #
+ # ¥ê¥¹¥Ê¤Ï PortConnectListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PortConnectListener::operator()(const char*, ConnectorProfile)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePortConnectListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PortConnect type listener
+ #
+ # This operation adds certain listeners related to Port's connect actions.
+ # The following listener types are available.
+ #
+ # - ON_NOTIFY_CONNECT: right after entering into notify_connect()
+ # - ON_NOTIFY_DISCONNECT: right after entering into notify_disconnect()
+ # - ON_UNSUBSCRIBE_INTERFACES: unsubscribing IF in notify_disconnect()
+ #
+ # Listeners should have the following function operator().
+ #
+ # PortConnectListener::operator()(const char*, ConnectorProfile)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePortConnectListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PortConnectListener*
+ # addPortConnectListener(PortConnectListenerType listener_type,
+ # void (Listener::*memfunc)(const char*,
+ # ConnectorProfile&),
+ # bool autoclean = true)
+ def addPortConnectListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PortConnectListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, portname, cprofile):
+ self._memfunc(portname, cprofile)
+ return
+
+ listener = Noname(memfunc)
+ self._portconnListeners.portconnect_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PortConnectListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PortConnect type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removePortConnectListener(PortConnectListenerType listener_type,
+ # PortConnectListener* listener);
+ def removePortConnectListener(self, listener_type, listener):
+ self._portconnListeners.portconnect_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PortConnectRetListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # Port¤ÎÀܳ»þ¤äÀܳ²ò½ü»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - ON_CONNECT_NEXTPORT: notify_connect() Ãæ¤Î¥«¥¹¥±¡¼¥É¸Æ¤Ó½Ð¤·Ä¾¸å
+ # - ON_SUBSCRIBE_INTERFACES: notify_connect() Ãæ¤Î¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¹ØÆÉľ¸å
+ # - ON_CONNECTED: nofity_connect() Àܳ½èÍý´°Î»»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë
+ # - ON_DISCONNECT_NEXT: notify_disconnect() Ãæ¤Ë¥«¥¹¥±¡¼¥É¸Æ¤Ó½Ð¤·Ä¾¸å
+ # - ON_DISCONNECTED: notify_disconnect() ¥ê¥¿¡¼¥ó»þ
+ #
+ # ¥ê¥¹¥Ê¤Ï PortConnectRetListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PortConnectRetListener::operator()(const char*, ConnectorProfile)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePortConnectRetListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PortConnectRet type listener
+ #
+ # This operation adds certain listeners related to Port's connect actions.
+ # The following listener types are available.
+ #
+ # - ON_CONNECT_NEXTPORT: after cascade-call in notify_connect()
+ # - ON_SUBSCRIBE_INTERFACES: after IF subscribing in notify_connect()
+ # - ON_CONNECTED: completed nofity_connect() connection process
+ # - ON_DISCONNECT_NEXT: after cascade-call in notify_disconnect()
+ # - ON_DISCONNECTED: completed notify_disconnect() disconnection process
+ #
+ # Listeners should have the following function operator().
+ #
+ # PortConnectRetListener::operator()(const char*, ConnectorProfile)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePortConnectRetListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param memfunc member function object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # PortConnectRetListener*
+ # addPortConnectRetListener(PortConnectRetListenerType listener_type,
+ # void (Listener::*memfunc)(const char*,
+ # ConnectorProfile&,
+ # ReturnCode_t))
+ def addPortConnectRetListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PortConnectRetListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, portname, cprofile, ret):
+ self._memfunc(portname, cprofile, ret)
+ return
+
+ listener = Noname(memfunc)
+ self._portconnListeners.portconnret_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief PortConnectRetListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PortConnectRet type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ # void
+ # removePortConnectRetListener(PortConnectRetListenerType listener_type,
+ # PortConnectRetListener* listener);
+ def removePortConnectRetListener(self, listener_type, listener):
+ self._portconnListeners.portconnret_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationParamListener ¤òÄɲ乤ë
+ #
+ # update(const char* config_set, const char* config_param) ¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë
+ # ¥³¡¼¥ë¤µ¤ì¤ë¥ê¥¹¥Ê ConfigurationParamListener ¤òÄɲ乤롣
+ # type ¤Ë¤Ï¸½ºß¤Î¤È¤³¤í ON_UPDATE_CONFIG_PARAM ¤Î¤ß¤¬Æþ¤ë¡£
+ #
+ # @param type ConfigurationParamListenerType·¿¤ÎÃÍ¡£
+ # ON_UPDATE_CONFIG_PARAM ¤¬¤¢¤ë¡£
+ #
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤ò¼«Æ°¤Çºï½ü¤¹¤ë¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationParamListener
+ #
+ # This function adds a listener object which is called when
+ # update(const char* config_set, const char* config_param) is
+ # called. In the type argument, currently only
+ # ON_UPDATE_CONFIG_PARAM is allowed.
+ #
+ # @param type ConfigurationParamListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ #
+ # @param memfunc member function object
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ConfigurationParamListener*
+ # addConfigurationParamListener(ConfigurationParamListenerType listener_type,
+ # void (Listener::*memfunc)(const char*,
+ # const char*),
+ # bool autoclean = true)
+ def addConfigurationParamListener(self, type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ConfigurationParamListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, config_set_name, config_param_name):
+ self._memfunc(config_set_name, config_param_name)
+ return
+
+ listener = Noname(memfunc)
+ self._configsets.addConfigurationParamListener(type, listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationParamListener ¤òºï½ü¤¹¤ë
+ #
+ # addConfigurationParamListener ¤ÇÄɲ䵤줿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤òºï½ü¤¹¤ë¡£
+ #
+ # @param type ConfigurationParamListenerType·¿¤ÎÃÍ¡£
+ # ON_UPDATE_CONFIG_PARAM ¤¬¤¢¤ë¡£
+ # @param listener Í¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationParamListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationParamListener() function.
+ #
+ # @param type ConfigurationParamListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ # @param listener a pointer to ConfigurationParamListener listener object.
+ #
+ # @endif
+ #
+ # void removeConfigurationParamListener(ConfigurationParamListenerType type,
+ # ConfigurationParamListener* listener);
+ def removeConfigurationParamListener(self, type, listener):
+ self._configsets.removeConfigurationParamListener(type, listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetListener ¤òÄɲ乤ë
+ #
+ # ConfigurationSet ¤¬¹¹¿·¤µ¤ì¤¿¤È¤¤Ê¤É¤Ë¸Æ¤Ð¤ì¤ë¥ê¥¹¥Ê
+ # ConfigurationSetListener ¤òÄɲ乤롣ÀßÄê²Äǽ¤Ê¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤Î
+ # 2¼ïÎब¤¢¤ë¡£
+ #
+ # - ON_SET_CONFIG_SET: setConfigurationSetValues() ¤Ç
+ # ConfigurationSet ¤ËÃͤ¬ÀßÄꤵ¤ì¤¿¾ì¹ç¡£
+ # - ON_ADD_CONFIG_SET: addConfigurationSet() ¤Ç¿·¤·¤¤
+ # ConfigurationSet ¤¬Äɲ䵤줿¾ì¹ç¡£
+ #
+ # @param type ConfigurationSetListenerType·¿¤ÎÃÍ¡£
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤ò¼«Æ°¤Çºï½ü¤¹¤ë¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationSetListener
+ #
+ # This function add a listener object which is called when
+ # ConfigurationSet is updated. Available events are the followings.
+ #
+ # @param type ConfigurationSetListenerType value
+ # @param memfunc member function object
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ConfigurationSetListener*
+ # addConfigurationSetListener(ConfigurationSetListenerType listener_type,
+ # void (Listener::*memfunc)
+ # (const coil::Properties& config_set))
+ def addConfigurationSetListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ConfigurationSetListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, config_set):
+ self._memfunc(config_set)
+ return
+
+ listener = Noname(memfunc)
+ self._configsets.addConfigurationSetListener(listener_type, listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetListener ¤òºï½ü¤¹¤ë
+ #
+ # addConfigurationSetListener ¤ÇÄɲ䵤줿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤òºï½ü¤¹¤ë¡£
+ #
+ # @param type ConfigurationSetListenerType·¿¤ÎÃÍ¡£
+ # @param listener Í¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationSetListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationSetListener() function.
+ #
+ # @param type ConfigurationSetListenerType value
+ # @param listener a pointer to ConfigurationSetListener listener object.
+ #
+ # @endif
+ #
+ # void removeConfigurationSetListener(ConfigurationSetListenerType type,
+ # ConfigurationSetListener* listener);
+ def removeConfigurationSetListener(self, type, listener):
+ self._configsets.removeConfigurationSetListener(type, listener)
+ return
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetNameListener ¤òÄɲ乤ë
+ #
+ # ConfigurationSetName ¤¬¹¹¿·¤µ¤ì¤¿¤È¤¤Ê¤É¤Ë¸Æ¤Ð¤ì¤ë¥ê¥¹¥Ê
+ # ConfigurationSetNameListener ¤òÄɲ乤롣ÀßÄê²Äǽ¤Ê¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤Î
+ # 3¼ïÎब¤¢¤ë¡£
+ #
+ # - ON_UPDATE_CONFIG_SET: ¤¢¤ë ConfigurationSet ¤¬¥¢¥Ã¥×¥Ç¡¼¥È¤µ¤ì¤¿
+ # - ON_REMOVE_CONFIG_SET: ¤¢¤ë ConfigurationSet ¤¬ºï½ü¤µ¤ì¤¿
+ # - ON_ACTIVATE_CONFIG_SET: ¤¢¤ë ConfigurationSet ¤¬¥¢¥¯¥Æ¥£¥Ö²½¤µ¤ì¤¿
+ #
+ # @param type ConfigurationSetNameListenerType·¿¤ÎÃÍ¡£
+ # @param memfunc ´Ø¿ô¥ª¥Ö¥¸¥§¥¯¥È
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤ò¼«Æ°¤Çºï½ü¤¹¤ë¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ #
+ # @brief Adding ConfigurationSetNameListener
+ #
+ # This function add a listener object which is called when
+ # ConfigurationSetName is updated. Available events are the followings.
+ #
+ # - ON_UPDATE_CONFIG_SET: A ConfigurationSet has been updated.
+ # - ON_REMOVE_CONFIG_SET: A ConfigurationSet has been deleted.
+ # - ON_ACTIVATE_CONFIG_SET: A ConfigurationSet has been activated.
+ #
+ # @param type ConfigurationSetNameListenerType value
+ # @param memfunc member function object
+ # @param autoclean a flag whether if the listener object autocleaned.
+ #
+ # @endif
+ #
+ # template <class Listener>
+ # ConfigurationSetNameListener*
+ # addConfigurationSetNameListener(ConfigurationSetNameListenerType type,
+ # void (Listener::*memfunc)(const char*))
+ def addConfigurationSetNameListener(self, type, memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.ConfigurationSetNameListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, config_set_name):
+ self._memfunc(config_set_name)
+ return
+
+ listener = Noname(memfunc)
+ self._configsets.addConfigurationSetNameListener(type, listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ #
+ # @brief ConfigurationSetNameListener ¤òºï½ü¤¹¤ë
+ #
+ # addConfigurationSetNameListener ¤ÇÄɲ䵤줿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤ò
+ # ºï½ü¤¹¤ë¡£
+ #
+ # @param type ConfigurationSetNameListenerType·¿¤ÎÃÍ¡£
+ # ON_UPDATE_CONFIG_PARAM ¤¬¤¢¤ë¡£
+ # @param listener Í¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ #
+ # @brief Removing ConfigurationSetNameListener
+ #
+ # This function removes a listener object which is added by
+ # addConfigurationSetNameListener() function.
+ #
+ # @param type ConfigurationSetNameListenerType value
+ # ON_UPDATE_CONFIG_PARAM is only allowed.
+ # @param listener a pointer to ConfigurationSetNameListener
+ # listener object.
+ #
+ # @endif
+ # void
+ # removeConfigurationSetNameListener(ConfigurationSetNameListenerType type,
+ # ConfigurationSetNameListener* listener);
+ def removeConfigurationSetNameListener(self, type, listener):
+ self._configsets.removeConfigurationSetNameListener(type, listener)
+ return
+
+ ##
+ # @if jp
+ # @brief PreFsmActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # FsmAction ¼ÂÁõ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·Ä¾Á°¤Î¥¤¥Ù¥ó¥È¤Ë´ØÏ¢¤¹¤ë³Æ¼ï¥ê
+ # ¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - PRE_ON_INITIALIZE: onInitialize ľÁ°
+ # - PRE_ON_FINALIZE: onFinalize ľÁ°
+ # - PRE_ON_STARTUP: onStartup ľÁ°
+ # - PRE_ON_SHUTDOWN: onShutdown ľÁ°
+ # - PRE_ON_ACTIVATED: onActivated ľÁ°
+ # - PRE_ON_DEACTIVATED: onDeactivated ľÁ°
+ # - PRE_ON_ABORTED: onAborted ľÁ°
+ # - PRE_ON_ERROR: onError ľÁ°
+ # - PRE_ON_RESET: onReset ľÁ°
+ # - PRE_ON_EXECUTE: onExecute ľÁ°
+ # - PRE_ON_STATE_UPDATE: onStateUpdate ľÁ°
+ #
+ # ¥ê¥¹¥Ê¤Ï PreFsmActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PreFsmActionListener::operator()(UniqueId ec_id)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePreFsmActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PreFsmAction type listener
+ #
+ # This operation adds certain listeners related to FsmActions
+ # pre events.
+ # The following listener types are available.
+ #
+ # - PRE_ON_INITIALIZE: before onInitialize
+ # - PRE_ON_FINALIZE: before onFinalize
+ # - PRE_ON_STARTUP: before onStartup
+ # - PRE_ON_SHUTDOWN: before onShutdown
+ # - PRE_ON_ACTIVATED: before onActivated
+ # - PRE_ON_DEACTIVATED: before onDeactivated
+ # - PRE_ON_ABORTED: before onAborted
+ # - PRE_ON_ERROR: before onError
+ # - PRE_ON_RESET: before onReset
+ # - PRE_ON_EXECUTE: before onExecute
+ # - PRE_ON_STATE_UPDATE: before onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PreFsmActionListener::operator()(UniqueId ec_id)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePreFsmActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addPreFsmActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PreFsmActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, state):
+ self._memfunc(state)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.preaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+ ##
+ # @if jp
+ # @brief PreFsmActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PreFsmAction type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removePreFsmActionListener(self, listener_type, listener):
+ self._fsmActionListeners.preaction_[listener_type].removeListener(listener)
+ return
+
+
+ ##
+ # @if jp
+ # @brief PostFsmActionListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # FsmAction ¼ÂÁõ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·Ä¾¸å¤Î¥¤¥Ù¥ó¥È¤Ë´ØÏ¢¤¹¤ë³Æ¼ï¥ê
+ # ¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - POST_ON_INITIALIZE: onInitialize ľ¸å
+ # - POST_ON_FINALIZE: onFinalize ľ¸å
+ # - POST_ON_STARTUP: onStartup ľ¸å
+ # - POST_ON_SHUTDOWN: onShutdown ľ¸å
+ # - POST_ON_ACTIVATED: onActivated ľ¸å
+ # - POST_ON_DEACTIVATED: onDeactivated ľ¸å
+ # - POST_ON_ABORTED: onAborted ľ¸å
+ # - POST_ON_ERROR: onError ľ¸å
+ # - POST_ON_RESET: onReset ľ¸å
+ # - POST_ON_EXECUTE: onExecute ľ¸å
+ # - POST_ON_STATE_UPDATE: onStateUpdate ľ¸å
+ #
+ # ¥ê¥¹¥Ê¤Ï PostFsmActionListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # PostFsmActionListener::operator()(const char* state, ReturnCode_t ret)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removePostFsmActionListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding PostFsmAction type listener
+ #
+ # This operation adds certain listeners related to FsmActions
+ # post events.
+ # The following listener types are available.
+ #
+ # - POST_ON_INITIALIZE: after onInitialize
+ # - POST_ON_FINALIZE: after onFinalize
+ # - POST_ON_STARTUP: after onStartup
+ # - POST_ON_SHUTDOWN: after onShutdown
+ # - POST_ON_ACTIVATED: after onActivated
+ # - POST_ON_DEACTIVATED: after onDeactivated
+ # - POST_ON_ABORTED: after onAborted
+ # - POST_ON_ERROR: after onError
+ # - POST_ON_RESET: after onReset
+ # - POST_ON_EXECUTE: after onExecute
+ # - POST_ON_STATE_UPDATE: after onStateUpdate
+ #
+ # Listeners should have the following function operator().
+ #
+ # PostFsmActionListener::operator()(const char* state, ReturnCode_t ret)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removePostFsmActionListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addPostFsmActionListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.PostFsmActionListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, state, ret):
+ self._memfunc(state, ret)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.postaction_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+
+ ##
+ # @if jp
+ # @brief PostFsmActionListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing PostFsmActionListener type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removePostFsmActionListener(self, listener_type, listener):
+ self._fsmActionListeners.postaction_[listener_type].removeListener(listener)
+ return
+
+
+
+ ##
+ # @if jp
+ # @brief FsmProfileListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # FSM¤Ø¤Î¥×¥í¥Õ¥¡¥¤¥ë¤ÎÀßÄê¡¢¼èÆÀ»þ¡¢¤Þ¤¿FSM¼«ÂΤؤξõÂÖ¤äÁ«°Ü¡¢¥¤
+ # ¥Ù¥ó¥È¤ÎÄɲúï½ü»þ¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - SET_FSM_PROFILE : FSM ProfileÀßÄê»þ
+ # - GET_FSM_PROFILE : FSM Profile¼èÆÀ»þ
+ # - ADD_FSM_STATE : FSM¤ËState¤¬Äɲ䵤줿
+ # - REMOVE_FSM_STATE : FSM¤«¤éState¤¬ºï½ü¤µ¤ì¤¿
+ # - ADD_FSM_TRANSITION : FSM¤ËÁ«°Ü¤¬Äɲ䵤줿
+ # - REMOVE_FSM_TRANSITION : FSM¤«¤éÁ«°Ü¤¬ºï½ü¤µ¤ì¤¿
+ # - BIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+ # - UNBIND_FSM_EVENT : FSM¤Ë¥¤¥Ù¥ó¥È¤¬¥¢¥ó¥Ð¥¤¥ó¥É¤µ¤ì¤¿
+ #
+ # ¥ê¥¹¥Ê¤Ï FsmProfileListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # FsmProfileListener::operator()(RTC::FsmProfile& pprof)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removeFsmProfileListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding FsmProfile type listener
+ #
+ # This operation adds certain listeners that is called when
+ # setting/getting FsmProfile and stae/transition/event add/remove
+ # to/from the FSM itself.
+ #
+ # The following listener types are available.
+ #
+ # - SET_FSM_PROFILE : Setting FSM Profile
+ # - GET_FSM_PROFILE : Getting FSM Profile
+ # - ADD_FSM_STATE : A State added to the FSM
+ # - REMOVE_FSM_STATE : A State removed from FSM
+ # - ADD_FSM_TRANSITION : A transition added to the FSM
+ # - REMOVE_FSM_TRANSITION : A transition removed from FSM
+ # - BIND_FSM_EVENT : An event bounded to the FSM
+ # - UNBIND_FSM_EVENT : An event unbounded to the FSM
+ #
+ # Listeners should have the following function operator().
+ #
+ # FsmProfileListener::operator()(RTC::PortProfile pprof)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removeFsmProfileListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addFsmProfileListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.FsmProfileListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, pprofile):
+ self._memfunc(pprofile)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.profile_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+
+ ##
+ # @if jp
+ # @brief FsmProfileListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing FsmProfileListener type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removeFsmProfileListener(self, listener_type, listener):
+ self._fsmActionListeners.profile_[listener_type].removeListener(listener)
+ return
+
+ ##
+ # @if jp
+ # @brief FsmStructureListener ¥ê¥¹¥Ê¤òÄɲ乤ë
+ #
+ # ExtendedFsmService ¤Ë´ØÏ¢¤¹¤ë FSM structure ¤ÎÀßÄꡦ¼èÆÀ»þ¤Ë¥³¡¼
+ # ¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë³Æ¼ï¥ê¥¹¥Ê¤òÀßÄꤹ¤ë¡£
+ #
+ # ÀßÄê¤Ç¤¤ë¥ê¥¹¥Ê¤Î¥¿¥¤¥×¤È¥³¡¼¥ë¥Ð¥Ã¥¯¥¤¥Ù¥ó¥È¤Ï°Ê²¼¤ÎÄ̤ê
+ #
+ # - SET_FSM_STRUCTURE: FSM¹½Â¤¤ÎÀßÄê
+ # - GET_FSM_STRUCTURE: FSM¹½Â¤¤Î¼èÆÀ
+ #
+ # ¥ê¥¹¥Ê¤Ï FsmStructureListener ¤ò·Ñ¾µ¤·¡¢°Ê²¼¤Î¥·¥°¥Ë¥Á¥ã¤ò»ý¤Ä
+ # operator() ¤ò¼ÂÁõ¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ #
+ # FsmStructureListener::operator()(FsmStructure& structure)
+ #
+ # ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤ËÍ¿¤¨¤¿¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤Ï
+ # RTObject¤Ë°Ü¤ê¡¢RTObject²òÂλþ¤â¤·¤¯¤Ï¡¢
+ # removeFsmStructureListener() ¤Ë¤è¤êºï½ü»þ¤Ë¼«Æ°Åª¤Ë²òÂΤµ¤ì¤ë¡£
+ # ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î½ê͸¢¤ò¸Æ¤Ó½Ð¤·Â¦¤Ç°Ý»ý¤·¤¿¤¤¾ì¹ç¤Ï¡¢Âè3°ú
+ # ¿ô¤Ë false ¤ò»ØÄꤷ¡¢¼«Æ°Åª¤Ê²òÂΤòÍÞÀ©¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ # @param autoclean ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Î¼«Æ°Åª²òÂΤò¹Ô¤¦¤«¤É¤¦¤«¤Î¥Õ¥é¥°
+ #
+ # @else
+ # @brief Adding FsmStructure type listener
+ #
+ # This operation adds certain listeners related to FSM structure
+ # data which are handled by ExtendedFsmService.
+ #
+ # The following listener types are available.
+ #
+ # - SET_FSM_STRUCTURE: Setting FSM structure
+ # - GET_FSM_STRUCTURE: Getting FSM structure
+ #
+ # Listeners should have the following function operator().
+ #
+ # FsmStructureListener::operator()(RTC::FsmStructure structure)
+ #
+ # The ownership of the given listener object is transferred to
+ # this RTObject object in default. The given listener object will
+ # be destroied automatically in the RTObject's dtor or if the
+ # listener is deleted by removeFsmStructureListener() function.
+ # If you want to keep ownership of the listener object, give
+ # "false" value to 3rd argument to inhibit automatic destruction.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ # @param autoclean A flag for automatic listener destruction
+ #
+ # @endif
+ #
+ def addFsmStructureListener(self, listener_type,
+ memfunc, autoclean = True):
+ class Noname(OpenRTM_aist.FsmStructureListener):
+ def __init__(self, memfunc):
+ self._memfunc = memfunc
+ return
+
+ def __call__(self, pprofile):
+ self._memfunc(pprofile)
+ return
+
+ listener = Noname(memfunc)
+ self._fsmActionListeners.structure_[listener_type].addListener(listener, autoclean)
+ return listener
+
+
+ ##
+ # @if jp
+ # @brief FsmStructureListener ¥ê¥¹¥Ê¤òºï½ü¤¹¤ë
+ #
+ # ÀßÄꤷ¤¿³Æ¼ï¥ê¥¹¥Ê¤òºï½ü¤¹¤ë¡£
+ #
+ # @param listener_type ¥ê¥¹¥Ê¥¿¥¤¥×
+ # @param listener ¥ê¥¹¥Ê¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
+ #
+ # @else
+ # @brief Removing FsmStructureListener type listener
+ #
+ # This operation removes a specified listener.
+ #
+ # @param listener_type A listener type
+ # @param listener A pointer to a listener object
+ #
+ # @endif
+ #
+ def removeFsmStructureListener(self, listener_type, listener):
+ self._fsmActionListeners.structure_[listener_type].removeListener(listener)
+ return
+
+ ##
+ # @if jp
+ #
+ # @brief RTC ¤ò½ªÎ»¤¹¤ë
+ #
+ # RTC ¤Î½ªÎ»½èÍý¤ò¼Â¹Ô¤¹¤ë¡£
+ # ÊÝ»ý¤·¤Æ¤¤¤ëÁ´ Port ¤ÎÅÐÏ¿¤ò²ò½ü¤¹¤ë¤È¤È¤â¤Ë¡¢³ºÅö¤¹¤ë CORBA ¥ª¥Ö¥¸¥§¥¯¥È
+ # ¤òÈó³èÀ²½¤·¡¢RTC ¤ò½ªÎ»¤¹¤ë¡£
+ #
+ # @param self
+ #
+ # @else
+ #
+ # @endif
+ def shutdown(self):
+ self._rtcout.RTC_TRACE("shutdown()")
+ try:
+ self.finalizePorts()
+ self.finalizeContexts()
+ self._poa.deactivate_object(self._poa.servant_to_id(self._SdoConfigImpl))
+ self._poa.deactivate_object(self._poa.servant_to_id(self))
+ self._sdoservice.exit()
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+
+ if self._manager:
+ self._rtcout.RTC_DEBUG("Cleanup on Manager")
+ self._manager.notifyFinalized(self)
+
+ del self._actionListeners
+ del self._portconnListeners
+
+
+ return
+
+ # inline void preOnInitialize(UniqueId ec_id)
+ def preOnInitialize(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_INITIALIZE].notify(ec_id)
+ return
+
+ # inline void preOnFinalize(UniqueId ec_id)
+ def preOnFinalize(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_FINALIZE].notify(ec_id)
+ return
+
+ # inline void preOnStartup(UniqueId ec_id)
+ def preOnStartup(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STARTUP].notify(ec_id)
+ return
+
+ # inline void preOnShutdown(UniqueId ec_id)
+ def preOnShutdown(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_SHUTDOWN].notify(ec_id)
+ return
+
+ # inline void preOnActivated(UniqueId ec_id)
+ def preOnActivated(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ACTIVATED].notify(ec_id)
+ return
+
+ # inline void preOnDeactivated(UniqueId ec_id)
+ def preOnDeactivated(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_DEACTIVATED].notify(ec_id)
+ return
+
+ # inline void preOnAborting(UniqueId ec_id)
+ def preOnAborting(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ABORTING].notify(ec_id)
+ return
+
+ # inline void preOnError(UniqueId ec_id)
+ def preOnError(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_ERROR].notify(ec_id)
+ return
+
+ # inline void preOnReset(UniqueId ec_id)
+ def preOnReset(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RESET].notify(ec_id)
+ return
+
+ # inline void preOnExecute(UniqueId ec_id)
+ def preOnExecute(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_EXECUTE].notify(ec_id)
+ return
+
+ # inline void preOnStateUpdate(UniqueId ec_id)
+ def preOnStateUpdate(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_STATE_UPDATE].notify(ec_id)
+ return
+
+
+ # inline void preOnRateChanged(UniqueId ec_id)
+ def preOnRateChanged(self, ec_id):
+ self._actionListeners.preaction_[OpenRTM_aist.PreComponentActionListenerType.PRE_ON_RATE_CHANGED].notify(ec_id)
+ return
+
+
+ # inline void postOnInitialize(UniqueId ec_id, ReturnCode_t ret)
+ def postOnInitialize(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_INITIALIZE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnFinalize(UniqueId ec_id, ReturnCode_t ret)
+ def postOnFinalize(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_FINALIZE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnStartup(UniqueId ec_id, ReturnCode_t ret)
+ def postOnStartup(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STARTUP].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnShutdown(UniqueId ec_id, ReturnCode_t ret)
+ def postOnShutdown(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_SHUTDOWN].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnActivated(UniqueId ec_id, ReturnCode_t ret)
+ def postOnActivated(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ACTIVATED].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnDeactivated(UniqueId ec_id, ReturnCode_t ret)
+ def postOnDeactivated(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_DEACTIVATED].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnAborting(UniqueId ec_id, ReturnCode_t ret)
+ def postOnAborting(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ABORTING].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnError(UniqueId ec_id, ReturnCode_t ret)
+ def postOnError(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_ERROR].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnReset(UniqueId ec_id, ReturnCode_t ret)
+ def postOnReset(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RESET].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnExecute(UniqueId ec_id, ReturnCode_t ret)
+ def postOnExecute(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_EXECUTE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnStateUpdate(UniqueId ec_id, ReturnCode_t ret)
+ def postOnStateUpdate(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_STATE_UPDATE].notify(ec_id, ret)
+ return
+
+
+ # inline void postOnRateChanged(UniqueId ec_id, ReturnCode_t ret)
+ def postOnRateChanged(self, ec_id, ret):
+ self._actionListeners.postaction_[OpenRTM_aist.PostComponentActionListenerType.POST_ON_RATE_CHANGED].notify(ec_id, ret)
+ return
+
+
+ # inline void onAddPort(const PortProfile& pprof)
+ def onAddPort(self, pprof):
+ self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.ADD_PORT].notify(pprof)
+ return
+
+
+ # inline void onRemovePort(const PortProfile& pprof)
+ def onRemovePort(self, pprof):
+ self._actionListeners.portaction_[OpenRTM_aist.PortActionListenerType.REMOVE_PORT].notify(pprof)
+ return
+
+
+ # inline void onAttachExecutionContext(UniqueId ec_id)
+ def onAttachExecutionContext(self, ec_id):
+ self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_ATTACHED].notify(ec_id)
+ return
+
+
+ # inline void onDetachExecutionContext(UniqueId ec_id)
+ def onDetachExecutionContext(self, ec_id):
+ self._actionListeners.ecaction_[OpenRTM_aist.ExecutionContextActionListenerType.EC_DETACHED].notify(ec_id)
+ return
+
+
+
+ def preOnFsmInit(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_INIT].notify(state)
+ return
+ def preOnFsmEntry(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_ENTRY].notify(state)
+ return
+ def preOnFsmDo(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_DO].notify(state)
+ return
+ def preOnFsmExit(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_EXIT].notify(state)
+ return
+ def preOnFsmStateChange(self, state):
+ self._fsmActionListeners.preaction_[OpenRTM_aist.PreFsmActionListenerType.PRE_ON_STATE_CHANGE].notify(state)
+ return
+ def postOnFsmInit(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_INIT].notify(state, ret)
+ return
+ def postOnFsmEntry(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_ENTRY].notify(state, ret)
+ return
+ def postOnFsmDo(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_DO].notify(state, ret)
+ return
+ def postOnFsmExit(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_EXIT].notify(state, ret)
+ return
+ def postOnFsmStateChange(self, state, ret):
+ self._fsmActionListeners.postaction_[OpenRTM_aist.PostFsmActionListenerType.POST_ON_STATE_CHANGE].notify(state, ret)
+ return
+
+
+ # ReturnCode_t getInheritedECOptions(coil::Properties& default_opts);
+ def getInheritedECOptions(self, default_opts):
+ inherited_opts_ = ["sync_transition",
+ "sync_activation",
+ "sync_deactivation",
+ "sync_reset",
+ "transition_timeout",
+ "activation_timeout",
+ "deactivation_timeout",
+ "reset_timeout"
+ "cpu_affinity"]
+
+ p_ = self._properties.findNode("exec_cxt")
+ if not p_:
+ self._rtcout.RTC_WARN("No exec_cxt option found.")
+ return RTC.RTC_ERROR
+
+ self._rtcout.RTC_DEBUG("Copying inherited EC options.")
+ for opt_ in inherited_opts_:
+ if p_.findNode(opt_):
+ self._rtcout.RTC_PARANOID("Option %s exists.", opt_)
+ default_opts.setProperty(opt_, p_.getProperty(opt_))
+
+ return RTC.RTC_OK
+
+
+ ##
+ # @brief getting individual EC options from RTC's configuration file
+ #
+ # ReturnCode_t
+ # getPrivateContextOptions(std::vector<coil::Properties>& ec_args);
+ def getPrivateContextOptions(self, ec_args):
+ self._rtcout.RTC_TRACE("getPrivateContextOptions()")
+ # Component specific multiple EC option available
+ if not self._properties.findNode("execution_contexts"):
+ self._rtcout.RTC_DEBUG("No component specific EC specified.")
+ return RTC.RTC_ERROR
+
+ args_ = self._properties.getProperty("execution_contexts")
+ ecs_tmp_ = [s.strip() for s in args_.split(",")]
+ if not ecs_tmp_[0]:
+ return RTC.RTC_ERROR
+ self._rtcout.RTC_DEBUG("Component specific e EC option available,")
+ self._rtcout.RTC_DEBUG("%s", args_)
+
+ default_opts_ = OpenRTM_aist.Properties()
+ self.getInheritedECOptions(default_opts_)
+ for ec_tmp in ecs_tmp_:
+ if OpenRTM_aist.normalize([ec_tmp]) == "none":
+ self._rtcout.RTC_INFO("EC none. EC will not be bound to the RTC.")
+ ec_args = []
+ return RTC.RTC_OK
+
+ type_and_name_ = [s.strip() for s in ec_tmp.split("(")]
+ if len(type_and_name_) > 2:
+ self._rtcout.RTC_DEBUG("Invalid EC type specified: %s", ec_tmp)
+ continue
+
+ p_ = copy.deepcopy(default_opts_)
+
+
+ # create EC's properties
+ p_.setProperty("type",type_and_name_[0])
+ self._rtcout.RTC_DEBUG("p_type: %s", p_.getProperty("type"))
+ p_type_ = self._properties.findNode("ec." + p_.getProperty("type"))
+
+ if p_type_:
+ self._rtcout.RTC_DEBUG("p_type props:")
+ self._rtcout.RTC_DEBUG(p_type_)
+ p_.mergeProperties(p_type_)
+
+ else:
+ self._rtcout.RTC_DEBUG("p_type none")
+
+ # EC name specified
+ #self._rtcout.RTC_DEBUG("size: %d, name: %s",
+ # (len(type_and_name_), type_and_name_[1]))
+
+ if len(type_and_name_) == 2 and type_and_name_[1][-1] == ')':
+ type_and_name_ = type_and_name_[1][:-1]
+ p_.setProperty("name", type_and_name_)
+ p_name_ = self._properties.findNode("ec." + p_.getProperty("name"))
+
+ if p_name_:
+ self._rtcout.RTC_DEBUG("p_name props:")
+ self._rtcout.RTC_DEBUG(p_name_)
+ p_.mergeProperties(p_name_)
+
+ else:
+ self._rtcout.RTC_DEBUG("p_name none")
+
+ ec_args.append(p_)
+ self._rtcout.RTC_DEBUG("New EC properties stored:")
+ self._rtcout.RTC_DEBUG(p_)
+
+ return RTC.RTC_OK
+
+
+ ##
+ # @brief getting global EC options from rtc.conf
+ #
+ # ReturnCode_t
+ # getGlobalContextOptions(coil::Properties& global_ec_props);
+ def getGlobalContextOptions(self, global_ec_props):
+ # exec_cxt option is obsolete
+ self._rtcout.RTC_TRACE("getGlobalContextOptions()")
+
+ prop_ = self._properties.findNode("exec_cxt.periodic")
+ if not prop_:
+ self._rtcout.RTC_WARN("No global EC options found.")
+ return RTC.RTC_ERROR
+
+ self._rtcout.RTC_DEBUG("Global EC options are specified.")
+ self._rtcout.RTC_DEBUG(prop_)
+ self.getInheritedECOptions(global_ec_props)
+ global_ec_props.mergeProperties(prop_)
+ return RTC.RTC_OK
+
+
+ ##
+ # @brief getting EC options
+ #
+ # ReturnCode_t
+ # getContextOptions(std::vector<coil::Properties>& ec_args);
+ def getContextOptions(self, ec_args):
+ self._rtcout.RTC_DEBUG("getContextOptions()")
+ global_props_ = OpenRTM_aist.Properties()
+ ret_global_ = self.getGlobalContextOptions(global_props_)
+ ret_private_ = self.getPrivateContextOptions(ec_args)
+
+ # private(X), global(X) -> error
+ # private(O), global(O) -> private
+ # private(X), global(O) -> global
+ # private(O), global(X) -> private
+ if ret_global_ != RTC.RTC_OK and ret_private_ != RTC.RTC_OK:
+ return RTC.RTC_ERROR
+
+ if ret_global_ == RTC.RTC_OK and ret_private_ != RTC.RTC_OK:
+ ec_args.append(global_props_)
+
+ return RTC.RTC_OK
+
+
+ ##
+ # @brief fiding existing EC from the factory
+ #
+ # ReturnCode_t findExistingEC(coil::Properties& ec_arg,
+ # RTC::ExecutionContextBase*& ec);
+ def findExistingEC(self, ec_arg, ec):
+ eclist_ = OpenRTM_aist.ExecutionContextFactory.instance().createdObjects()
+ for ec_ in eclist_:
+ if ec_.getProperties().getProperty("type") == ec_arg.getProperty("type") and \
+ ec_.getProperties().getProperty("name") == ec_arg.getProperty("name"):
+ ec[0] = ec_
+ return RTC.RTC_OK
+
+ return RTC.RTC_ERROR
+
+
+ ##
+ # @brief creating, initializing and binding context
+ #
+ # ReturnCode_t createContexts(std::vector<coil::Properties>& ec_args);
+ def createContexts(self, ec_args):
+ ret_ = RTC.RTC_OK
+ avail_ec_ = OpenRTM_aist.ExecutionContextFactory.instance().getIdentifiers()
+
+ for ec_arg_ in ec_args:
+ ec_type_ = ec_arg_.getProperty("type")
+ ec_name_ = ec_arg_.getProperty("name")
+ ec_ = [None]
+ if ec_name_ and self.findExistingEC(ec_arg_, ec_) == RTC.RTC_OK:
+ # if EC's name exists, find existing EC in the factory.
+ self._rtcout.RTC_DEBUG("EC: type=%s, name=%s already exists.",
+ (ec_type_, ec_name_))
+ else:
+ # If EC's name is empty or no existing EC, create new EC.
+ if not ec_type_ in avail_ec_:
+ self._rtcout.RTC_WARN("EC %s is not available.", ec_type_)
+ self._rtcout.RTC_DEBUG("Available ECs: %s",
+ OpenRTM_aist.flatten(avail_ec_))
+ continue
+ ec_[0] = OpenRTM_aist.ExecutionContextFactory.instance().createObject(ec_type_)
+
+ if not ec_[0]:
+ # EC factory available but creation failed. Resource full?
+ self._rtcout.RTC_ERROR("EC (%s) creation failed.", ec_type_)
+ self._rtcout.RTC_DEBUG("Available EC list: %s",
+ OpenRTM_aist.flatten(avail_ec_))
+ ret_ = RTC.RTC_ERROR
+ continue
+
+ self._rtcout.RTC_DEBUG("EC (%s) created.", ec_type_)
+
+ ec_[0].init(ec_arg_)
+ self._eclist.append(ec_[0])
+ ec_[0].bindComponent(self)
+
+ if len(self._eclist) == 0:
+ default_prop = OpenRTM_aist.Properties()
+ default_prop.setDefaults(OpenRTM_aist.default_config)
+
+ ec_ = [None]
+ ec_type_ = default_prop.getProperty("exec_cxt.periodic.type")
+ if not ec_type_ in avail_ec_:
+ self._rtcout.RTC_WARN("EC %s is not available.", ec_type_)
+ self._rtcout.RTC_DEBUG("Available ECs: %s",
+ OpenRTM_aist.flatten(avail_ec_))
+ return RTC.RTC_ERROR
+
+
+
+ default_opts = OpenRTM_aist.Properties()
+ prop_ = default_prop.findNode("exec_cxt.periodic")
+ #if not prop_:
+ # self._rtcout.RTC_WARN("No default EC options found.")
+ # return RTC.RTC_ERROR
+
+ default_opts.mergeProperties(prop_)
+
+ inherited_opts_ = ["sync_transition",
+ "sync_activation",
+ "sync_deactivation",
+ "sync_reset",
+ "transition_timeout",
+ "activation_timeout",
+ "deactivation_timeout",
+ "reset_timeout",
+ "cpu_affinity"]
+
+ p_ = self._properties.findNode("exec_cxt")
+
+ if not p_:
+ self._rtcout.RTC_WARN("No exec_cxt option found.")
+ return RTC.RTC_ERROR
+
+ self._rtcout.RTC_DEBUG("Copying inherited EC options.")
+ for opt_ in inherited_opts_:
+ if p_.findNode(opt_):
+ self._rtcout.RTC_PARANOID("Option %s exists.", opt_)
+ default_opts.setProperty(opt_, p_.getProperty(opt_))
+
+
+ ec_[0] = OpenRTM_aist.ExecutionContextFactory.instance().createObject(ec_type_)
+ #if not ec_[0]:
+ # self._rtcout.RTC_ERROR("EC (%s) creation failed.", ec_type_)
+ # self._rtcout.RTC_DEBUG("Available EC list: %s",
+ # OpenRTM_aist.flatten(avail_ec_))
+ # return RTC.RTC_ERROR
+
+ ec_[0].init(default_opts)
+ self._eclist.append(ec_[0])
+ ec_[0].bindComponent(self)
+
+
+
+
+ return ret_
+
+
+
+
+
+ ##
+ # @if jp
+ # @class svc_name
+ # @brief SDOService ¤Î¥×¥í¥Õ¥¡¥¤¥ë¥ê¥¹¥È¤«¤éid¤Ç¥µ¡¼¥Á¤¹¤ë¤¿¤á¤Î
+ # ¥Õ¥¡¥ó¥¯¥¿¥¯¥é¥¹
+ # @else
+ #
+ # @endif
+ class svc_name:
+ def __init__(self, _id):
+ self._id= _id
+
+ def __call__(self, prof):
+ return self._id == prof.id
+
+
+ #------------------------------------------------------------
+ # Functor
+ #------------------------------------------------------------
+
+ ##
+ # @if jp
+ # @class nv_name
+ # @brief NVList ¸¡º÷ÍÑ¥Õ¥¡¥ó¥¯¥¿
+ # @else
+ #
+ # @endif
+ class nv_name:
+ def __init__(self, _name):
+ self._name = _name
+
+ def __call__(self, nv):
+ return self._name == nv.name
+
+
+ ##
+ # @if jp
+ # @class ec_find
+ # @brief ExecutionContext ¸¡º÷ÍÑ¥Õ¥¡¥ó¥¯¥¿
+ # @else
+ #
+ # @endif
+ class ec_find:
+ def __init__(self, _ec):
+ self._ec = _ec
+
+ def __call__(self, ecs):
+ try:
+ if not CORBA.is_nil(ecs):
+ ec = ecs._narrow(RTC.ExecutionContext)
+ return self._ec._is_equivalent(ec)
+ except:
+ print(OpenRTM_aist.Logger.print_exception())
+ return False
+
+ return False
+
+
+ ##
+ # @if jp
+ # @class ec_copy
+ # @brief ExecutionContext CopyÍÑ¥Õ¥¡¥ó¥¯¥¿
+ # @else
+ #
+ # @endif
+ class ec_copy:
+ def __init__(self, eclist):
+ self._eclist = eclist
+
+ def __call__(self, ecs):
+ if not CORBA.is_nil(ecs):
+ self._eclist.append(ecs)
+
+
+ ##
+ # @if jp
+ # @class deactivate_comps
+ # @brief RTC Èó³èÀ²½ÍÑ¥Õ¥¡¥ó¥¯¥¿
+ # @else
+ #
+ # @endif
+ class deactivate_comps:
+ def __init__(self, comp):
+ self._comp = comp
+
+ def __call__(self, ec):
+ try:
+ if not CORBA.is_nil(ec) and not ec._non_existent():
+ ec.deactivate_component(self._comp)
+ ec.stop()
+ except:
+ print(OpenRTM_aist.Logger.print_exception())
+
+
+# RtcBase = RTObject_impl
+"""
+ ec_args = self._properties.getProperty("exec_cxt.periodic.type")
+ ec_args += "?"
+ ec_args += "rate="
+ ec_args += self._properties.getProperty("exec_cxt.periodic.rate")
+
+ ec = OpenRTM_aist.Manager.instance().createContext(ec_args)
+ if ec is None:
+ return RTC.RTC_ERROR
+
+ ec.set_rate(float(self._properties.getProperty("exec_cxt.periodic.rate")))
+ self._eclist.append(ec)
+ ecv = ec.getObjRef()
+ if CORBA.is_nil(ecv):
+ return RTC.RTC_ERROR
+
+ ec.bindComponent(self)
+
+ # at least one EC must be attached
+ if len(self._ecMine) == 0:
+ return RTC.PRECONDITION_NOT_MET
+
+ ret = self.on_initialize()
+ self._created = False
+ if ret is not RTC.RTC_OK:
+ return ret
+
+ # -- entering alive state --
+ for i in range(len(self._ecMine)):
+ self._rtcout.RTC_DEBUG("EC[%d] starting.", i)
+ self._ecMine[i].start()
+
+ # ret must be RTC_OK
+ return ret
+"""
+
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectStateMachine.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectStateMachine.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/RTObjectStateMachine.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -66,6 +66,8 @@
self.onError)
self._sm.setExitAction (RTC.ERROR_STATE,
self.onReset)
+ #self._sm.setDoAction (RTC.ACTIVE_STATE,
+ # self.onAction)
# Setting inital state
st = OpenRTM_aist.StateHolder()
st.prev = RTC.INACTIVE_STATE
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -211,7 +211,9 @@
properties,
svc._this())
- svc.init(rtobj, prof)
+ if not svc.init(rtobj, prof):
+ svc.finalize()
+ continue
self._providers.append(svc)
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceConsumerBase.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -44,22 +44,105 @@
def __del__(self):
pass
- # virtual bool init(RTObject_impl& rtobj,
- # const SDOPackage::ServiceProfile& profile) = 0;
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥·¥å¡¼¥Þ¥¯¥é¥¹¤Î½é´ü²½´Ø¿ô
+ #
+ # ½é´ü²½´Ø¿ô¡£Í¿¤¨¤é¤ì¤¿ RTObject ¤ª¤è¤Ó ServiceProfile ¤«¤é¡¢Åö³º
+ # ¥ª¥Ö¥¸¥§¥¯¥È¤ò½é´ü²½¤·¤Þ¤¹¡£¤³¤Î¥µ¡¼¥Ó¥¹¤¬
+ # ''sdo.service.provider.enabled_services'' ¤Ç͸ú²½¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢
+ # ¤³¤Î´Ø¿ô¤ÏÂбþ¤¹¤ëRTC¤¬¥¤¥ó¥¹¥¿¥ó¥¹²½¤µ¤ì¤¿Ä¾¸å¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£
+ #
+ # ServiceProfile ¤Ë¤Ï°Ê²¼¤Î¾ðÊó¤¬Æþ¤Ã¤¿¾õÂ֤ǸƤӽФµ¤ì¤Þ¤¹¡£
+ #
+ # - ServiceProfile.id: Åö³º¥µ¡¼¥Ó¥¹¤ÎIFR·¿
+ # - ServiceProfile.interface_type: Åö³º¥µ¡¼¥Ó¥¹¤ÎIFR·¿
+ # - ServiceProfile.service: Åö³º¥µ¡¼¥Ó¥¹¤Î¥ª¥Ö¥¸¥§¥¯¥È»²¾È
+ # - ServiceProfile.properties: rtc.conf ¤ä <component>.conf Åù¤ÇÍ¿
+ # ¤¨¤é¤ì¤¿SDO¥µ¡¼¥Ó¥¹¸ÇͤΥª¥×¥·¥ç¥ó¤¬ÅϤµ¤ì¤ë¡£
+ # conf¥Õ¥¡¥¤¥ëÆâ¤Ç
+ # ¤Ï¡¢''<pragma>.<module_name>.<interface_name>''
+ # ¤È¤¤¤¦¥×¥ê¥Õ¥£¥Ã¥¯¥¹¤ò¤Ä¤±¤¿¥ª¥×¥·¥ç¥ó¤È¤·¤ÆÍ¿
+ # ¤¨¤ë¤³¤È¤¬¤Ç¤¡¢properties Æâ¤Ë¤Ï¡¢¤³¤Î¥×¥ê
+ # ¥Õ¥£¥Ã¥¯¥¹¤ò½ü¤¤¤¿¥ª¥×¥·¥ç¥ó¤¬key:value·Á¼°¤Ç
+ # ´Þ¤Þ¤ì¤Æ¤¤¤ë¡£
+ #
+ # ´Ø¿ôÆâ¤Ç¤Ï¡¢¼ç¤Ë properties ¤«¤éÀßÄêÆâÍƤòÆɤ߹þ¤ß¥µ¡¼¥Ó¥¹¸ÇͤÎ
+ # ÀßÄêÅù¤ò¹Ô¤¤¤Þ¤¹¡£Í¿¤¨¤é¤ì¤¿ ServiceProfile¤ÎÆâÍƤ¬ÉÔÀµ¡¢¤¢¤ë¤¤
+ # ¤Ï¤½¤Î¾¤ÎÍýͳ¤ÇÅö³º¥µ¡¼¥Ó¥¹¤ò¥¤¥ó¥¹¥¿¥ó¥¹²½¤·¤Ê¤¤¾ì¹ç¤Ï false
+ # ¤òÊÖ¤·¤Þ¤¹¡£¤½¤Î¾ì¹ç¡¢finalize() ¤¬¸Æ¤Ó½Ð¤µ¤ì¤½¤Î¸å¥ª¥Ö¥¸¥§¥¯¥È
+ # ¤Ïºï½ü¤µ¤ì¤Þ¤¹¡£¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï true ¤òÊÖ¤¹¤È¡¢¥µ¡¼¥Ó¥¹¥ª¥Ö¥¸¥§
+ # ¥¯¥È¤Ï RTC Æâ¤ËÊÝ»ý¤µ¤ì¤Þ¤¹¡£
+ #
+ # @param rtobj ¤³¤Î¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¤¥ó¥¹¥¿¥ó¥¹²½¤µ¤ì¤¿ RTC
+ # @param profile ³°Éô¤«¤éÍ¿¤¨¤é¤ì¤¿ SDO ServiceProfile
+ # @return Í¿¤¨¤é¤ì¤¿ SDO Service ¤ä ServiceProfile ¤¬ÉÔÀµ¤Î¾ì¹ç false
+ #
+ # @else
+ # @brief Initialization function of the consumer class
+ #
+ # @endif
+ #
def init(self, rtobj, profile):
pass
- # virtual bool reinit(const SDOPackage::ServiceProfile& profile) = 0;
+ ##
+ # @if jp
+ # @brief ¥³¥ó¥·¥å¡¼¥Þ¥¯¥é¥¹¤ÎºÆ½é´ü²½´Ø¿ô
+ #
+ # ¤³¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ÎºÆ½é´ü²½¤ò¹Ô¤¦¡£ServiceProfile ¤Ë¤Ï id ¥Õ¥£¡¼
+ # ¥ë¥É¤Ë¥»¥Ã¥·¥ç¥ó¸ÇͤΠUUID ¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ë¤¬¡¢Æ±°ì¤Î id ¤Î¾ì
+ # ¹ç¡¢properties ¤ËÀßÄꤵ¤ì¤¿ÀßÄê¾ðÊó¤ÎÊѹ¹¤ä¡¢service ¥Õ¥£¡¼¥ë¥É
+ # ¤Î¥µ¡¼¥Ó¥¹¤Î»²¾È¤ÎÊѹ¹¤¬¹Ô¤ï¤ì¤ë¡£¤½¤ÎºÝ¤Ë¸Æ¤Ð¤ì¤ë¤Î¤¬¤³¤Î
+ # reinit() ´Ø¿ô¤Ç¤¢¤ë¡£¼ÂÁõ¤Ç¤Ï¡¢service ¥Õ¥£¡¼¥ë¥É¤Î¥ª¥Ö¥¸¥§¥¯¥È
+ # ¥ê¥Õ¥¡¥ì¥ó¥¹¤ÎƱ°ìÀ¤ò³Îǧ¤·¡¢°Û¤Ê¤Ã¤Æ¤¤¤ë¾ì¹çÊÝ»ý¤·¤Æ¤¤¤ë¥ê¥Õ¥¡
+ # ¥ì¥ó¥¹¤ò¹¹¿·¤¹¤ëɬÍפ¬¤¢¤ë¡£¤Þ¤¿ properties ¤Ë¤Ï¿·¤¿¤ÊÀßÄ꤬Ϳ¤¨
+ # ¤é¤ì¤Æ¤¤¤ë²ÄǽÀ¤¬¤¢¤ë¤Î¤Ç¡¢ÆâÍƤòÆɤ߹þ¤ßÀßÄê¤ò¹¹¿·¤¹¤ë¡£
+ #
+ # @param profile ¿·¤¿¤ËÍ¿¤¨¤é¤ì¤¿ SDO ServiceProfile
+ # @return ÉÔÀµ¤Ê ServiceProfile ¤¬Í¿¤¨¤é¤ì¤¿¾ì¹ç¤Ï false
+ #
+ # @else
+ # @brief Reinitialization function of the consumer class
+ #
+ # @endif
+ #
def reinit(self, profile):
pass
- # virtual const SDOPackage::ServiceProfile& getProfile() const = 0;
+ ##
+ # @if jp
+ # @brief ServiceProfile ¤òÊÖ¤¹
+ #
+ # init()/reinit()¤ÇÍ¿¤¨¤é¤ì¤¿ ServiceProfile ¤ÏÄ̾索¥Ö¥¸¥§¥¯¥ÈÆâ
+ # ¤ÇÊÝ»ý¤µ¤ì¤ë¡£SDO Service ´ÉÍý¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Ï´ÉÍý¾å¤³¤Î¥ª¥Ö¥¸¥§
+ # ¥¯¥È¤ËÂбþ¤¹¤ë ServiceProfile ¤òɬÍפȤ¹¤ë¤Î¤Ç¡¢¤³¤Î´Ø¿ô¤Ç¤ÏÊÝ»ý
+ # ¤µ¤ì¤Æ¤¤¤ë ServiceProfile ¤òÊÖ¤¹¡£
+ #
+ # @return ¤³¤Î¥ª¥Ö¥¸¥§¥¯¥È¤¬ÊÝ»ý¤·¤Æ¤¤¤ë ServiceProfile
+ #
+ # @else
+ # @brief Getting ServiceProfile
+ # @endif
+ #
def getProfile(self):
pass
- # virtual void finalize() = 0;
+ ##
+ # @if jp
+ # @brief ½ªÎ»½èÍý
+ #
+ # SDO¥µ¡¼¥Ó¥¹¤¬¤Ç¥¿¥Ã¥Á¤µ¤ì¤ëºÝ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë½ªÎ»½èÍýÍÑ´Ø¿ô¡£¥µ¡¼
+ # ¥Ó¥¹¤Î¤Ç¥¿¥Ã¥Á¤ËºÝ¤·¤Æ¡¢Åö³º¥ª¥Ö¥¸¥§¥¯¥È¤¬ÊÝ»ý¤¹¤ë¥ê¥½¡¼¥¹¤ò²òÊü
+ # ¤¹¤ë¤Ê¤É¤Î½èÍý¤ò¹Ô¤¦¡£
+ #
+ # @else
+ # @brief Finalization
+ #
+ # @endif
+ #
def finalize(self):
pass
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -21,6 +21,7 @@
+
##
# @if jp
#
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -18,6 +18,7 @@
import threading
import OpenRTM_aist
+import OpenRTM_aist.Macho
import RTC
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StaticFSM.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StaticFSM.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/StaticFSM.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file StaticFSM.py
+# @brief Static FSM framework based on Macho
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import OpenRTM_aist
+import RTC
+
+
+def FSM_TOPSTATE(TOP):
+ OpenRTM_aist.Macho.TOPSTATE(TOP)
+
+
+def FSM_SUBSTATE(STATE, SUPERSTATE):
+ OpenRTM_aist.Macho.SUBSTATE(STATE, SUPERSTATE)
+
+
+class Machine(OpenRTM_aist.Macho.Machine):
+ def __init__(self, TOP, comp):
+ super(Machine,self).__init__(TOP, OpenRTM_aist.Macho.TopBase(TOP))
+ self._rtComponent = comp
+
+
+ def __del__(self):
+ pass
+ def init_other(self, other):
+ pass
+ def equal(self, snapshot):
+ pass
+ def getComp(self):
+ return self._rtComponent
+
+
+
+class Link(OpenRTM_aist.Macho.Link):
+ def __init__(self, instance):
+ super(Link,self).__init__(instance)
+ self._rtComponent = None
+ def __del__(self):
+ pass
+ def setrtc(self):
+ if self._rtComponent:
+ return
+ machine = self._myStateInstance.machine()
+ if machine:
+ self._rtComponent = machine.getComp()
+
+ def entry(self):
+ self.setrtc()
+ if not self._rtComponent:
+ self.onEntry()
+ else:
+ self._rtComponent.postOnFsmStateChange(self._state_name(), RTC.RTC_OK)
+ self._rtComponent.preOnFsmEntry(self._state_name())
+ self._rtComponent.postOnFsmEntry(self._state_name(), self.onEntry())
+
+ def init(self):
+ self.setrtc()
+ if not self._rtComponent:
+ self.onInit()
+ else:
+ self._rtComponent.preOnFsmInit(self._state_name())
+ self._rtComponent.postOnFsmInit(self._state_name(), self.onInit())
+
+
+ def exit(self):
+ self.setrtc()
+ if not self._rtComponent:
+ self.onExit()
+ else:
+ self._rtComponent.preOnFsmExit(self._state_name())
+ self._rtComponent.postOnFsmExit(self._state_name(), self.onExit())
+ self._rtComponent.preOnFsmStateChange(self._state_name())
+
+ def onEntry(self):
+ return RTC.RTC_OK
+ def onInit(self):
+ return RTC.RTC_OK
+ def onExit(self):
+ return RTC.RTC_OK
\ No newline at end of file
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Timestamp.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Timestamp.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/Timestamp.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Timestamp.py
+# @brief Timestamp listener class
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import OpenRTM_aist
+
+
+class Timestamp(OpenRTM_aist.ConnectorDataListenerT):
+ def __init__(self, ts_type):
+ self._ts_type = ts_type
+ def __del__(self):
+ pass
+ def __call__(self, info, data):
+ if info.properties.getProperty("timestamp_policy") != self._ts_type:
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+ tm = OpenRTM_aist.Time().gettimeofday()
+ data.tm.sec = tm.sec()
+ data.tm.nsec = tm.usec() * 1000
+ return OpenRTM_aist.ConnectorListenerStatus.DATA_CHANGED
+
+
+
+
+
+
+
+
+
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/__init__.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/__init__.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -116,5 +116,15 @@
from CPUAffinity import *
from LogstreamBase import *
from LogstreamFile import *
+from FsmActionListener import *
+from StaticFSM import *
+from EventPort import *
+from Timestamp import *
+from OutPortDSConsumer import *
+from OutPortDSProvider import *
+from InPortDSConsumer import *
+from InPortDSProvider import *
+from FsmObject import *
+from FiniteStateMachineComponent import *
-
+import Macho
\ No newline at end of file
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleIn.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleIn.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleIn.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -35,6 +35,7 @@
print "Profile::id: ", info.id
print "Data: ", data.data
print "------------------------------"
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
class ConnListener(OpenRTM_aist.ConnectorListener):
def __init__(self, name):
@@ -49,6 +50,7 @@
print "Profile::name: ", info.name
print "Profile::id: ", info.id
print "------------------------------"
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
class ConsoleIn(OpenRTM_aist.DataFlowComponentBase):
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/SimpleIO/ConsoleOut.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -36,6 +36,7 @@
print "Profile::id: ", info.id
print "Data: ", data.data
print "------------------------------"
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
class ConnListener(OpenRTM_aist.ConnectorListener):
@@ -51,6 +52,7 @@
print "Profile::name: ", info.name
print "Profile::id: ", info.id
print "------------------------------"
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Display.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Display.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Display.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,170 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Display.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+import OpenRTM_aist.StringUtil
+
+display_spec = ["implementation_id", "Display",
+ "type_name", "Display",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Miyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+
+class DataListener(OpenRTM_aist.ConnectorDataListenerT):
+ def __init__(self, name):
+ self._name = name
+
+ def __del__(self):
+ print "dtor of ", self._name
+
+ def __call__(self, info, cdrdata):
+ data = OpenRTM_aist.ConnectorDataListenerT.__call__(self, info, cdrdata, RTC.TimedLong(RTC.Time(0,0),0))
+ print "------------------------------"
+ print "Listener: ", self._name
+ print "Profile::name: ", info.name
+ print "Profile::id: ", info.id
+ print "Data: ", data.data
+ print "------------------------------"
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+
+
+class ConnListener(OpenRTM_aist.ConnectorListener):
+ def __init__(self, name):
+ self._name = name
+
+ def __del__(self):
+ print "dtor of ", self._name
+
+ def __call__(self, info):
+ print "------------------------------"
+ print "Listener: ", self._name
+ print "Profile::name: ", info.name
+ print "Profile::id: ", info.id
+ print "------------------------------"
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+
+
+
+
+class Display(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+ return
+
+ def onInitialize(self):
+ self._in = RTC.TimedLong(RTC.Time(0,0),0)
+
+
+ self._inIn = OpenRTM_aist.InPort("in", self._in)
+
+ # Set OutPort buffer
+ self.addInPort("in", self._inIn)
+
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE,
+ DataListener("ON_BUFFER_WRITE"))
+
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_FULL,
+ DataListener("ON_BUFFER_FULL"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE_TIMEOUT,
+ DataListener("ON_BUFFER_WRITE_TIMEOUT"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_OVERWRITE,
+ DataListener("ON_BUFFER_OVERWRITE"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ,
+ DataListener("ON_BUFFER_READ"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_SEND,
+ DataListener("ON_SEND"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED,
+ DataListener("ON_RECEIVED"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_FULL,
+ DataListener("ON_RECEIVER_FULL"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_TIMEOUT,
+ DataListener("ON_RECEIVER_TIMEOUT"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_ERROR,
+ DataListener("ON_RECEIVER_ERROR"))
+
+ self._inIn.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_CONNECT,
+ ConnListener("ON_CONNECT"))
+ self._inIn.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_DISCONNECT,
+ ConnListener("ON_DISCONNECT"))
+
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+ if self._inIn.isNew():
+ data = self._inIn.read()
+ print("Received: ", data.data)
+ print("TimeStamp: ", data.tm.sec,"[s]")
+ print("TimeStamp: ", data.tm.nsec,"[ns]")
+
+
+ return RTC.RTC_OK
+
+
+def DisplayInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=display_spec)
+ manager.registerFactory(profile,
+ Display,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ DisplayInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("Display")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Inputbutton.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Inputbutton.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Inputbutton.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Inputbutton.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+import OpenRTM_aist.StringUtil
+
+inputbutton_spec = ["implementation_id", "Inputbutton",
+ "type_name", "Inputbutton",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Miyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+
+
+
+class Inputbutton(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+ return
+
+ def onInitialize(self):
+ self._open = RTC.TimedLong(RTC.Time(0,0),0)
+ self._close = RTC.TimedLong(RTC.Time(0,0),0)
+ self._minute = RTC.TimedLong(RTC.Time(0,0),0)
+ self._start = RTC.TimedLong(RTC.Time(0,0),0)
+ self._stop = RTC.TimedLong(RTC.Time(0,0),0)
+ self._tick = RTC.TimedLong(RTC.Time(0,0),0)
+
+ self._openOut = OpenRTM_aist.OutPort("open", self._open)
+ self._closeOut = OpenRTM_aist.OutPort("close", self._close)
+ self._minuteOut = OpenRTM_aist.OutPort("minute", self._minute)
+ self._startOut = OpenRTM_aist.OutPort("start", self._start)
+ self._stopOut = OpenRTM_aist.OutPort("stop", self._stop)
+ self._tickOut = OpenRTM_aist.OutPort("tick", self._tick)
+ # Set OutPort buffer
+ self.addOutPort("out", self._openOut)
+ self.addOutPort("out", self._closeOut)
+ self.addOutPort("out", self._minuteOut)
+ self.addOutPort("out", self._startOut)
+ self.addOutPort("out", self._stopOut)
+ self.addOutPort("out", self._tickOut)
+
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+ print("")
+ print("Please select action!!")
+ print("Commands: ")
+ print(" open : Open the microwave's door.")
+ print(" close : Close the microwave's door.")
+ print(" minute <int> : Increment timer. ")
+ print(" start : Start the microwave.")
+ print(" stop : Stop the microwave.")
+ print(" tick : Proceed time.")
+ print(" -> others are interpreted as tick commnad.")
+ print(">> ")
+ #print("Please input number: ",end="")
+ print "Please input number: ",
+ cmds = sys.stdin.readline()
+ cmds = cmds.split(" ")
+ OpenRTM_aist.StringUtil.eraseBlank(cmds)
+ cmds[0] = cmds[0].replace("\n","")
+ cmds[0] = cmds[0].replace("\r","")
+ print("[command]: ",cmds[0])
+ #print(" [args]: ",end="")
+ print " [args]: ",
+ for n in range(len(cmds)):
+ if n == 0:
+ continue
+ #print(cmds[n],end="")
+ print cmds[n],
+ print("")
+ if cmds[0] == "open":
+ self._open.data = 0
+ self._openOut.write()
+ elif cmds[0] == "close":
+ self._close.data = 0
+ self._closeOut.write()
+ elif cmds[0] == "minute":
+ min = [0]
+ if len(cmds) < 2 or not OpenRTM_aist.StringUtil.stringTo(min, cmds[1]):
+ print("minute command needs an integer arg.")
+ return RTC.RTC_OK
+
+ self._minute.data = min[0]
+ self._minuteOut.write()
+ elif cmds[0] == "start":
+ self._start.data = 0
+ self._startOut.write()
+ elif cmds[0] == "stop":
+ self._stop.data = 0
+ self._stopOut.write()
+ else:
+ print("tick")
+ self._tick.data = 0
+ self._tickOut.write()
+
+
+
+ return RTC.RTC_OK
+
+
+def InputbuttonInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=inputbutton_spec)
+ manager.registerFactory(profile,
+ Inputbutton,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ InputbuttonInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("Inputbutton")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Microwave.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Microwave.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/Microwave.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Microwave.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+
+
+import MicrowaveFsm
+
+microwave_spec = ["implementation_id", "Microwave",
+ "type_name", "Microwave",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Miyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+
+
+
+class Microwave(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+
+ return
+
+ def onFinalize(self):
+ self._fsm.exit()
+ return RTC.RTC_OK
+
+ def onInitialize(self):
+ self._fsm = OpenRTM_aist.Machine(MicrowaveFsm.TOP, self)
+ self._fsm.init()
+ self._eventIn = OpenRTM_aist.EventInPort("event", self._fsm)
+
+ self.addInPort("event", self._eventIn)
+ self._eventIn.bindEvent0("open", "open")
+ self._eventIn.bindEvent0("close", "close")
+ self._eventIn.bindEvent1("minute", "minute", RTC.TimedLong(RTC.Time(0,0),0))
+ self._eventIn.bindEvent0("start", "start")
+ self._eventIn.bindEvent0("stop", "stop")
+ self._eventIn.bindEvent0("tick", "tick")
+
+
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+
+
+ return RTC.RTC_OK
+
+
+def MicrowaveInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=microwave_spec)
+ manager.registerFactory(profile,
+ Microwave,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ MicrowaveInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("Microwave")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/MicrowaveFsm.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/MicrowaveFsm.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/MicrowaveFsm.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Microwave.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+import OpenRTM_aist.Macho
+
+class TOP(OpenRTM_aist.Link):
+ def __init__(self, instance):
+ super(TOP,self).__init__(instance)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+ self.setState(Operational)
+
+
+ def open(self):
+ pass
+ def close(self):
+ pass
+ def minute(self, time_):
+ pass
+ def start(self):
+ pass
+ def stop(self):
+ pass
+ def tick(self):
+ pass
+
+ class Box:
+ def __init__(self):
+ self.myCookingTime = 0
+ def printTimer(self):
+ print(" Timer set to ", self.myCookingTime, " minutes")
+ def incrementTimer(self):
+ self.myCookingTime+=1
+ def decrementTimer(self):
+ self.myCookingTime-=1
+ def resetTimer(self):
+ self.myCookingTime = 0
+ def getRemainingTime(self):
+ return self.myCookingTime
+
+
+OpenRTM_aist.FSM_TOPSTATE(TOP)
+
+
+class Disabled(TOP):
+ def __init__(self, instance):
+ super(Disabled,self).__init__(instance)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ print(" Microwave opened")
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ print(" Microwave closed")
+ def close(self):
+ self.setStateHistory(Operational)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+
+OpenRTM_aist.FSM_SUBSTATE(Disabled,TOP)
+
+class Operational(TOP):
+ def __init__(self, instance):
+ super(Operational,self).__init__(instance)
+ def open(self):
+ self.setState(Disabled)
+ def stop(self):
+ self.setState(Idle)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+ self.setState(Idle)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+
+
+
+
+OpenRTM_aist.FSM_SUBSTATE(Operational,TOP)
+OpenRTM_aist.Macho.DEEPHISTORY(Operational)
+
+
+class Idle(Operational):
+ def __init__(self, instance):
+ super(Idle,self).__init__(instance)
+ def minute(self, time_):
+ self.setState(Programmed)
+ self["TopBase_"].dispatch(OpenRTM_aist.Macho.Event1("minute",time_))
+
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ self[TOP].box().resetTimer()
+ print(" Microwave ready")
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+
+
+OpenRTM_aist.FSM_SUBSTATE(Idle,Operational)
+
+
+class Programmed(Operational):
+ def __init__(self, instance):
+ super(Programmed,self).__init__(instance)
+ def minute(self, time_):
+ for t in range(time_.data):
+ self[TOP].box().incrementTimer()
+ self[TOP].box().printTimer()
+ def start(self):
+ self.setState(Cooking)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+
+
+
+OpenRTM_aist.FSM_SUBSTATE(Programmed,Operational)
+
+
+class Cooking(Programmed):
+ def __init__(self, instance):
+ super(Cooking,self).__init__(instance)
+ def tick(self):
+ print(" Clock tick")
+ tb = self[TOP].box()
+ tb.decrementTimer()
+ if tb.getRemainingTime() == 0:
+ print(" Finished")
+ self.setState(Idle)
+ else:
+ tb.printTimer()
+
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ print(" Heating on")
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ print(" Heating off")
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+
+
+OpenRTM_aist.FSM_SUBSTATE(Cooking,Programmed)
\ No newline at end of file
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/display.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/display.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/display.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/inputbutton.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/inputbutton.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/inputbutton.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/microwave.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/microwave.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/microwave.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/rtc.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/rtc.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/examples/StaticFsm/rtc.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,40 @@
+corba.nameservers: localhost
+naming.formats: %n.rtc
+logger.enable: YES
+logger.log_level: VERBOSE
+#logger.file_name: STDOUT
+#example.Inputbutton.config_file: inputbutton.conf
+#example.Microwave.config_file: microwave.conf
+#example.Display.config_file: display.conf
+
+
+#manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.base_path: ./
+#manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.file_structure: flat
+#manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.context_delimiter: .
+
+#manager.local_service.modules: \
+# ../../src/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.py(ComponentObserverConsumerInit), \
+# ../../src/ext/sdo/extended_fsm/ComponentObserverProvider.py(ExtendedFsmServiceProviderInit)
+
+manager.modules.load_path: ./
+manager.modules.preload: Microwave.py
+manager.components.precreate: Microwave
+manager.components.preactivation: Inputbutton0, Microwave0
+manager.components.preconnect: \
+ Inputbutton0.open^Microwave0.event(fsm_event_name=open), \
+ Inputbutton0.close^Microwave0.event(fsm_event_name=close), \
+ Inputbutton0.minute^Microwave0.event(fsm_event_name=minute), \
+ Inputbutton0.start^Microwave0.event(fsm_event_name=start), \
+ Inputbutton0.stop^Microwave0.event(fsm_event_name=stop), \
+ Inputbutton0.tick^Microwave0.event(fsm_event_name=tick)
+
+#manager.modules.preload: Display.py
+#manager.components.precreate: Display
+#manager.components.preactivation: Inputbutton0, Display0
+#manager.components.preconnect: \
+# Inputbutton0.open^Display0.in(), \
+# Inputbutton0.close^Display0.in(), \
+# Inputbutton0.minute^Display0.in(), \
+# Inputbutton0.start^Display0.in(), \
+# Inputbutton0.stop^Display0.in(), \
+# Inputbutton0.tick^Display0.in()
\ No newline at end of file
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/ExtendedFsmServiceProvider.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/ExtendedFsmServiceProvider.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/ExtendedFsmServiceProvider.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,298 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file ComponentObserverProvider.py
+# @brief test for ComponentObserverConsumer
+# @date $Date$
+# @author Shinji Kurihara
+#
+# Copyright (C) 2011
+# Noriaki Ando
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+#
+
+import sys
+
+from omniORB import CORBA, PortableServer
+import RTC, RTC__POA
+import OpenRTM, OpenRTM__POA
+import SDOPackage
+import OpenRTM_aist
+import OpenRTM_aist.NVUtil
+
+class ExtendedFsmServiceProvider(RTC__POA.ExtendedFsmService, OpenRTM_aist.SdoServiceProviderBase):
+ def __init__(self):
+ self._rtobj = None
+ self._profile = None
+ self._fsmState = ""
+ structure = """
+<scxml xmlns=\"http://www.w3.org/2005/07/scxml\
+ version=\"1.0\"
+ initial=\"airline-ticket\">
+ <state id=\"state0\">
+ <datamodel>
+ <data id=\"data0\">
+ </data>
+ </datamodel>
+ <transition event=\"toggle\" target=\"state1\" />
+ </state>
+ <state id=\"state1\">
+ <datamodel>"
+ <data id=\"data1\">
+ </data>
+ </datamodel>
+ <transition event=\"toggle\" target=\"state0\" />
+ </state>
+</scxml>
+ """
+ event_profile = RTC.FsmEventProfile("toggle","TimedShort")
+ nv = OpenRTM_aist.NVUtil.newNV("fsm_structure.format","scxml")
+ self._fsmStructure = RTC.FsmStructure("dummy_name","",[event_profile],[nv])
+
+ ##
+ # @if jp
+ # @brief ½é´ü²½
+ # @else
+ # @brief Initialization
+ # @endif
+ #
+ def init(self, rtobj, profile):
+ self._rtobj = rtobj
+ self._profile = profile
+ return True
+
+ ##
+ # @if jp
+ # @brief ºÆ½é´ü²½
+ # @else
+ # @brief Re-initialization
+ # @endif
+ #
+ def reinit(self, profile):
+ self._profile = profile
+ return True
+
+ ##
+ # @if jp
+ # @brief ServiceProfile ¤ò¼èÆÀ¤¹¤ë
+ # @else
+ # @brief getting ServiceProfile
+ # @endif
+ #
+ def getProfile(self):
+ return self._profile
+
+ ##
+ # @if jp
+ # @brief ½ªÎ»½èÍý
+ # @else
+ # @brief Finalization
+ # @endif
+ #
+ def finalize(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FSM¤Î¸½ºß¤Î¾õÂÖ¤ò¼èÆÀ
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ÏFSM¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ÎFSM¤Î¸½ºß¤Î¾õÂÖ¤òÊÖ¤¹¡£
+ # (FSM4RTC spec. p.20)
+ #
+ # @return ¸½ºß¤Î¾õÂÖ¤òɽ¤¹Ê¸»úÎó
+ #
+ # @else
+ # @brief Get Current FSM State
+ #
+ # This operation returns the current state of an FSM in the
+ # target FSM component. (FSM4RTC spec. p.20)
+ #
+ # @return A string which represent the current status
+ #
+ # @endif
+ #
+ def get_current_state(self):
+ return self._fsmState
+
+ ##
+ # @if jp
+ # @brief FSM¤Î¹½Â¤¤òÀßÄꤹ¤ë
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ÏÂоݤΥ³¥ó¥Ý¡¼¥Í¥ó¥È¤ËÂФ·¤Æ¡¢FSM¤Î¹½Â¤¤òÊÝ
+ # »ý¤¹¤ë FsmStruccture ¤òÀßÄꤹ¤ë¡£Âоݥ³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï
+ # fsm_structure ¤ËÍ¿¤¨¤é¤ì¤¿Ãͤò´ð¤Ë¾õÂÖÁ«°Ü¥ë¡¼¥ëÅù¤ÎFSM¹½Â¤¤òºÆ
+ # ÀßÄꤹ¤ë¡£¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬Ì¤¼ÂÁõ¤Î¾ì¹ç¤Ï¡¢UNSUPPORTED ¤òÊÖ¤¹¡£
+ #
+ # @param fsm_structure FSM¤Î¹½Â¤¤òɽ¤¹FsmStructure¹½Â¤ÂΡ£
+ # @return RTC_OK Àµ¾ï½ªÎ»
+ # RTC_ERROR ¤½¤Î¾¤Î¥¨¥é¡¼
+ # BAD_PARAMETER ÉÔÀµ¤Ê¥Ñ¥é¥á¡¼¥¿
+ # UNSUPPORTED ̤¥µ¥Ý¡¼¥È
+ #
+ # @else
+ # @brief Set FSM Structure
+ #
+ # This operation sets an FsmStructure to the target
+ # component. Then the target component reconfigures its FSM
+ # structure such as transition rules according to the values of
+ # the given fsm_structure. RTCs may return UNSUPPORTED if this
+ # operation is not implemented.
+ #
+ # @param fsm_structure FsmStructure structure which represents
+ # FSM structure
+ # @return RTC_OK normal return
+ # RTC_ERROR other error
+ # BAD_PARAMETER invalid parameter
+ # UNSUPPORTED unsupported or not implemented
+ #
+ # @endif
+ #
+ def set_fsm_structure(self, fsm_structure):
+ self._fsmStructure = fsm_structure
+ return RTC.RTC_OK
+
+
+ ##
+ # @if jp
+ # @brief FSM¤Î¹½Â¤¤ò¼èÆÀ¤¹¤ë
+ #
+ # ¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤ÏÂоݤΥ³¥ó¥Ý¡¼¥Í¥ó¥È¤ËÂФ·¤Æ¡¢¸½ºßÊÝ»ý¤·¤Æ¤¤
+ # ¤ëFSM¤Î¹½Â¤¤ò¼èÆÀ¤¹¤ë¡£ExtendedFsmService ¹½Â¤ÂΤϥե£¡¼¥ë¥É
+ # name (FSM¤Î̾¾Î), structure (FSM¤Î¹½Â¤) ¡¢EventProfile ¤Ê¤É¤òÊÖ
+ # ¤¹¡£structure ¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¡¢¥Õ¥£¡¼¥ë¥É properties Æâ¤Ë³ÊǼ¤µ
+ # ¤ì¤¿¥¡¼ "fsm_structure.format" ¤Ë»ØÄꤵ¤ì¤ë¡£¤³¤Î¥ª¥Ú¥ì¡¼¥·¥ç¥ó
+ # ¤¬Ì¤¼ÂÁõ¤Î¾ì¹ç¤Ï¡¢UNSUPPORTED ¤òÊÖ¤¹¡£
+ #
+ # ref: SCXML https://www.w3.org/TR/scxml/
+ #
+ # @param fsm_structure FSM¤Î¹½Â¤¤òɽ¤¹FsmStructure¹½Â¤ÂΡ£
+ # @return RTC_OK Àµ¾ï½ªÎ»
+ # RTC_ERROR ¤½¤Î¾¤Î¥¨¥é¡¼
+ # BAD_PARAMETER ÉÔÀµ¤Ê¥Ñ¥é¥á¡¼¥¿
+ # UNSUPPORTED ̤¥µ¥Ý¡¼¥È
+ #
+ # @else
+ # @brief Set FSM Structure
+ #
+ # This operation returns the structure of an FSM in the target
+ # FSM component. ExtendedFsmService returns the name, structure
+ # with format specified by fsm_structure.format and
+ # EventProfiles. RTCs may return UNSUPPORTED if this operation is
+ # not implemented.
+ #
+ # @param fsm_structure FsmStructure structure which represents
+ # FSM structure
+ # @return RTC_OK normal return
+ # RTC_ERROR other error
+ # BAD_PARAMETER invalid parameter
+ # UNSUPPORTED unsupported or not implemented
+ #
+ # @endif
+ #
+ def get_fsm_structure(self):
+ return (RTC.RTC_OK,self._fsmStructure)
+
+
+ ##
+ # @if jp
+ # @brief RTObject¤Ø¤Î¥ê¥¹¥ÊÀܳ½èÍý
+ # @else
+ # @brief Connectiong listeners to RTObject
+ # @endif
+ #
+ def setListeners(self, prop):
+ pass
+
+ ##
+ # @if jp
+ # @brief FSM¾õÂÖÁ«°Ü
+ # @else
+ # @brief FSM status change
+ # @endif
+ #
+ def changeStatus(self, state):
+ self._fsmState = state
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤ò²ò½ü¤¹¤ë
+ # @else
+ # @brief Unsetting heartbeat
+ # @endif
+ #
+ def changeStructure(self, fsm_structure):
+ self._fsmStructure.structure = fsm_structure
+
+ ##
+ # @if jp
+ # @brief FSM¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê½èÍý
+ # @else
+ # @brief Setting FSM status listeners
+ # @endif
+ #
+ def setFSMStatusListeners(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FSM¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü½èÍý
+ # @else
+ # @brief Unsetting FSM status listeners
+ # @endif
+ #
+ def unsetFSMStatusListeners(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FsmProfile¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting FsmProfile listener
+ # @endif
+ #
+ def setFSMProfileListeners(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FsmProfile¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü
+ # @else
+ # @brief Unsetting FsmProfile listener
+ # @endif
+ #
+ def unsetFSMProfileListeners(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FsmStructure¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting FsmStructure listener
+ # @endif
+ #
+ def setFSMStructureListeners(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FsmStructure¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü
+ # @else
+ # @brief Unsetting FsmStructure listener
+ # @endif
+ #
+ def unsetFSMStructureListeners(self):
+ pass
+
+
+
+
+def ExtendedFsmServiceProviderInit(mgr=None):
+ factory = OpenRTM_aist.SdoServiceProviderFactory.instance()
+ factory.addFactory(RTC.ExtendedFsmService._NP_RepositoryId,
+ ExtendedFsmServiceProvider,
+ OpenRTM_aist.Delete)
+ return
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/rtc.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/rtc.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/extended_fsm/rtc.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,8 @@
+corba.nameservers: localhost
+naming.formats: %n.rtc
+#logger.enable: NO
+logger.log_level: VERBOSE
+logger.file_name: STDOUT
+#manager.naming_formats: %n.mgr
+manager.modules.load_path: .
+manager.local_service.modules:ExtendedFsmServiceProvider.py
\ No newline at end of file
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/COCTestRTC.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/COCTestRTC.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/COCTestRTC.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# -*- Python -*-
+
+import sys
+
+import RTC
+import OpenRTM_aist
+
+coctestrtc_spec = ["implementation_id", "COCTestRTC",
+ "type_name", "COCTestRTC",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Shinji Kurihara",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+class DataListener(OpenRTM_aist.ConnectorDataListenerT):
+ def __init__(self, name):
+ self._name = name
+
+ def __del__(self):
+ print("dtor of ", self._name)
+
+ def __call__(self, info, cdrdata):
+ data = OpenRTM_aist.ConnectorDataListenerT.__call__(self, info, cdrdata, RTC.TimedLong(RTC.Time(0,0),0))
+ print("------------------------------")
+ print("Listener: ", self._name)
+ print("Profile::name: ", info.name)
+ print("Profile::id: ", info.id)
+ print("Data: ", data.data)
+ print("------------------------------")
+
+class ConnListener(OpenRTM_aist.ConnectorListener):
+ def __init__(self, name):
+ self._name = name
+
+ def __del__(self):
+ print("dtor of ", self._name)
+
+ def __call__(self, info):
+ print("------------------------------")
+ print("Listener: ", self._name)
+ print("Profile::name: ", info.name)
+ print("Profile::id: ", info.id)
+ print("------------------------------")
+
+
+class COCTestRTC(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+ return
+
+ def onInitialize(self):
+ self._data = RTC.TimedLong(RTC.Time(0,0),0)
+ self._outport = OpenRTM_aist.OutPort("out", self._data)
+ # Set OutPort buffer
+ self.addOutPort("out", self._outport)
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE,
+ DataListener("ON_BUFFER_WRITE"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_FULL,
+ DataListener("ON_BUFFER_FULL"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE_TIMEOUT,
+ DataListener("ON_BUFFER_WRITE_TIMEOUT"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_OVERWRITE,
+ DataListener("ON_BUFFER_OVERWRITE"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ,
+ DataListener("ON_BUFFER_READ"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_SEND,
+ DataListener("ON_SEND"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED,
+ DataListener("ON_RECEIVED"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_FULL,
+ DataListener("ON_RECEIVER_FULL"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_TIMEOUT,
+ DataListener("ON_RECEIVER_TIMEOUT"))
+ self._outport.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_ERROR,
+ DataListener("ON_RECEIVER_ERROR"))
+
+ self._outport.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_CONNECT,
+ ConnListener("ON_CONNECT"))
+ self._outport.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_DISCONNECT,
+ ConnListener("ON_DISCONNECT"))
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+ print("Please input number: ")
+ self._data.data = long(sys.stdin.readline())
+ OpenRTM_aist.setTimestamp(self._data)
+ print("Sending to subscriber: ", self._data.data)
+ self._outport.write()
+ return RTC.RTC_OK
+
+
+def COCTestRTCInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=coctestrtc_spec)
+ manager.registerFactory(profile,
+ COCTestRTC,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ COCTestRTCInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("COCTestRTC")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserver.idl
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserver.idl (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserver.idl 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,36 @@
+#ifndef _COMPONENT_OBSERVER_IDL_
+#define _COMPONENT_OBSERVER_IDL_
+
+#include <SDOPackage.idl>
+
+#pragma prefix "omg.org"
+
+module RTC
+{
+ enum StatusKind
+ {
+ COMPONENT_PROFILE,
+ RTC_STATUS,
+ EC_STATUS,
+ PORT_PROFILE,
+ CONFIGURATION,
+ RTC_HEARTBEAT,
+ EC_HEARTBEAT,
+ FSM_PROFILE,
+ FSM_STATUS,
+ FSM_STRUCTURE,
+ USER_DEFINED,
+ STATUS_KIND_NUM
+ };
+ #pragma version StatusKind 1.0
+
+ interface ComponentObserver : SDOPackage::SDOService
+ {
+ oneway void update_status(in StatusKind status_kind,
+ in string hint);
+ };
+ #pragma version ComponentObserver 1.0
+};
+
+#endif // _COMPONENT_OBSERVER_IDL_
+
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,1319 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file ComponentObserverConsumer.py
+# @brief Component observer SDO service consumer implementation
+# @date $Date$
+# @author Nobuhiko Miyamoto<n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Nobuhiko Miyamoto
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+#
+
+import sys
+sys.path.insert(1,".")
+
+import RTC
+import OpenRTM
+import OpenRTM_aist
+
+##
+# @if jp
+# @else
+# @endif
+#
+class ComponentObserverConsumer(OpenRTM_aist.SdoServiceConsumerBase):
+ """
+ """
+
+ ##
+ # @if jp
+ # @class ComponentObserverConsumer ¥¯¥é¥¹
+ # @brief ComponentObserver ¥â¥¸¥å¡¼¥ë
+ #
+ # ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î³Æ¼ï¾õÂÖ¤òComponentObserver¥µ¡¼¥Ó¥¹¤ËÂФ·¤Æ¥³¡¼¥ë
+ # ¥Ð¥Ã¥¯¤¹¤ë¤¿¤á¤Î¥¯¥é¥¹¡£¥Ä¡¼¥ëÅù¡¢¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¾õÂÖÊѲ½¤òÃΤꤿ
+ # ¤¤¥¨¥ó¥Æ¥£¥Æ¥£¤¬¥µ¡¼¥Ó¥¹¥×¥í¥Ð¥¤¥À¤òÅö³º¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ËÂФ·¤Æ¥»¥Ã
+ # ¥È¤¹¤ë¤È¡¢Âбþ¤¹¤ëËÜ¥³¥ó¥·¥å¡¼¥Þ¤¬¥¢¥¿¥Ã¥Á¤µ¤ì¡¢¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¾õ
+ # ÂÖÊѲ½¤Ë±þ¤¸¤Æ¡¢update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤òSTATUS_KIND ¤È¥Ò¥ó
+ # ¥È¤ò°ú¿ô¤Ë¸Æ¤Ó½Ð¤¹¡£Ëܵ¡Ç½¤Ï¡¢OMG ¤Î FSM4RTC»ÅÍÍ
+ # (formal/16-04-01) 7.2.4.2 ComponentObserver Interface ¤Ëµ½Ò¤µ¤ì¤Æ
+ # ¤¤¤ë¡£
+ #
+ # STATUS_KIND ¤Ë¤Ï°Ê²¼¤Î¼ïÎब¤¢¤ë¡£
+ #
+ # - COMPONENT_PROFILE: ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¾ðÊó¤¬ÊѲ½
+ # - RTC_STATUS : ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¾õÂÖ (Init, Alive) ¤¬ÊѲ½
+ # - EC_STATUS : EC¤Î¾õÂÖ (Inavtive, Active, Error) ¤¬ÊѲ½
+ # - PORT_PROFILE : ¥Ý¡¼¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¤¬ÊѲ½
+ # - CONFIGURATION : ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤¬ÊѲ½
+ # - RTC_HEARTBEAT : RTC¤ÎÀ¸Â¸³Îǧ¤Î¥Ï¡¼¥È¥Ó¡¼¥É
+ # - EC_HEARTBEAT : EC¤ÎÀ¸Â¸³Îǧ¤Î¥Ï¡¼¥È¥Ó¡¼¥È
+ # - FSM_PROFILE : FSM¤Î¥×¥í¥Õ¥¡¥¤¥ë¤¬ÊѲ½
+ # - FSM_STATUS : FSM¤Î¾õÂÖ¤¬ÊѲ½
+ # - FSM_STRUCTURE : FSM¤Î¹½Â¤¤¬ÊѲ½
+ # - USER_DEFINED : ¥æ¡¼¥¶ÄêµÁ
+ #
+ # \subsection COMPONENT_PROFILE COMPONENT_PROFILE
+ # ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¾ðÊó¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£(̤¼ÂÁõ)
+ #
+ # \subsection RTC_STATUS RTC_STATUS
+ #
+ # ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î¾õÂÖ (Init, Alive) ¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾
+ # (enumÃÍ)¤òÂè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì
+ # ¤ë¡£¸·Ì©¤Ë¤ÏEC¤Î¾õÂ֤Ǥ¢¤ë¤¬¡¢Inavtive, Active, Error, Finalize ¤Î
+ # 4¤Ä¤Î¾õÂÖ¤ËÊѲ½¤·¤¿¤³¤È¤ò¸¡ÃΤ¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£°Ê²¼¤Î¾õÂÖÊѲ½»þ¤Ë¡¢
+ # ¤½¤ì¤¾¤ì¥Ò¥ó¥È¤È¤·¤Æ°Ê²¼¤Îʸ»úÎó¤È¤È¤â¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤µ¤ì¤ë¡£
+ #
+ # - onActivated ¸Æ¤Ó½Ð¤·À®¸ù»þ: ACTIVE: <EC id>
+ # - onDeactivated ¸Æ¤Ó½Ð¤·À®¸ù»þ: INACTIVE: <EC id>
+ # - onReset ¸Æ¤Ó½Ð¤·À®¸ù»þ: INACTIVE: <EC id>
+ # - onAborting ¸Æ¤Ó½Ð¤·À®¸ù»þ: ERROR: <EC id>
+ # - onFinalize ¸Æ¤Ó½Ð¤·À®¸ù»þ: FINALIZE: <EC id>
+ #
+ # \subsection EC_STATUS EC_STATUS
+ #
+ # EC¤Î¾õÂÖ (Inavtive, Active, Error) ¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection PORT_PROFILE PORT_PROFILE
+ # ¥Ý¡¼¥È¤Î¥×¥í¥Õ¥¡¥¤¥ë¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection CONFIGURATION CONFIGURATION
+ # ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection RTC_HEARTBEAT RTC_HEARTBEAT
+ # RTC¤ÎÀ¸Â¸³Îǧ¤Î¥Ï¡¼¥È¥Ó¡¼¥É¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection EC_HEARTBEAT EC_HEARTBEAT
+ # EC¤ÎÀ¸Â¸³Îǧ¤Î¥Ï¡¼¥È¥Ó¡¼¥È¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection FSM_PROFILE FSM_PROFILE
+ # FSM¤Î¥×¥í¥Õ¥¡¥¤¥ë¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection FSM_STATUS FSM_STATUS
+ # FSM¤Î¾õÂÖ¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection FSM_STRUCTURE FSM_STRUCTURE
+ # FSM¤Î¹½Â¤¤¬ÊѲ½¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ #
+ # \subsection USER_DEFINED USER_DEFINED
+ # ¥æ¡¼¥¶ÄêµÁ¤·¤¿ºÝ¤Ë¤³¤Î¥¿¥°Ì¾(enumÃÍ)¤ò
+ # Âè1°ú¿ô¤Ë¤·¤Æ update_status() ¥ª¥Ú¥ì¡¼¥·¥ç¥ó¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+ # @else
+ # @brief ctor of ComponentObserverConsumer
+ # @endif
+ #
+ def __init__(self):
+ self._rtobj = None
+ self._profile = None
+ self._observer = OpenRTM_aist.CorbaConsumer(interfaceType=RTC.ComponentObserver)
+ self._observed = [ False for i in range(RTC.STATUS_KIND_NUM._v)]
+
+ self._compstat = self.CompStatMsg(self)
+ self._portaction = self.PortAction(self)
+ self._ecaction = self.ECAction(self)
+ self._configMsg = self.ConfigAction(self)
+ self._fsmaction = self.FSMAction(self)
+
+ self._rtcInterval = OpenRTM_aist.TimeValue(1, 0)
+ self._rtcHeartbeat = False
+ self._rtcHblistenerid = None
+ self._ecInterval = OpenRTM_aist.TimeValue(1, 0)
+ self._ecHeartbeat = False
+ self._ecHblistenerid = None
+
+ # ¤³¤Î¥¿¥¤¥Þ¡¼¤Ï¤¤¤º¤ì¥°¥í¡¼¥Ð¥ë¤Ê¥¿¥¤¥Þ¤Ë¤ª¤¤«¤¨¤ë
+ self._timer = OpenRTM_aist.Timer(self._rtcInterval)
+ return
+
+
+ ##
+ # @if jp
+ # @brief dtor
+ # @else
+ # @brief dtor
+ # @endif
+ #
+ def __del__(self):
+ self.unsetComponentProfileListeners()
+ self.unsetComponentStatusListeners()
+ self.unsetPortProfileListeners()
+ self.unsetExecutionContextListeners()
+ self.unsetConfigurationListeners()
+ self.unsetRTCHeartbeat()
+ self.unsetECHeartbeat()
+ del self._timer
+ return
+
+
+ ##
+ # @if jp
+ # @brief ½é´ü²½
+ # @else
+ # @brief Initialization
+ # @endif
+ #
+ # virtual bool init(RTObject_impl& rtobj,
+ # const SDOPackage::ServiceProfile& profile);
+ def init(self, rtobj, profile):
+ if not self._observer.setObject(profile.service):
+ # narrowing failed
+ return False
+
+ self._rtobj = rtobj
+ self._profile = profile
+ prop = OpenRTM_aist.Properties()
+ OpenRTM_aist.NVUtil.copyToProperties(prop, profile.properties)
+ self.setRTCHeartbeat(prop)
+ self.setECHeartbeat(prop)
+ self.setListeners(prop)
+ return True
+
+
+ ##
+ # @if jp
+ # @brief ºÆ½é´ü²½
+ # @else
+ # @brief Re-initialization
+ # @endif
+ #
+ # virtual bool reinit(const SDOPackage::ServiceProfile& profile);
+ def reinit(self, profile):
+ if not self._observer._ptr()._is_equivalent(profile.service):
+ tmp = OpenRTM_aist.CorbaConsumer(interfaceType=RTC.ComponentObserver)
+ if not tmp.setObject(profile.service):
+ return False
+ self._observer.releaseObject()
+ self._observer.setObject(profile.service)
+
+ self._profile= profile
+ prop = OpenRTM_aist.Properties()
+ OpenRTM_aist.NVUtil.copyToProperties(prop, profile.properties)
+ self.setRTCHeartbeat(prop)
+ self.setECHeartbeat(prop)
+ self.setListeners(prop)
+ return True
+
+
+ ##
+ # @if jp
+ # @brief ServiceProfile ¤ò¼èÆÀ¤¹¤ë
+ # @else
+ # @brief getting ServiceProfile
+ # @endif
+ #
+ # virtual const SDOPackage::ServiceProfile& getProfile() const;
+ def getProfile(self):
+ return self._profile
+
+
+ ##
+ # @if jp
+ # @brief ½ªÎ»½èÍý
+ # @else
+ # @brief Finalization
+ # @endif
+ #
+ # virtual void finalize();
+ def finalize(self):
+ self.unsetComponentProfileListeners()
+ self.unsetComponentStatusListeners()
+ self.unsetPortProfileListeners()
+ self.unsetExecutionContextListeners()
+ self.unsetConfigurationListeners()
+ self.unsetRTCHeartbeat()
+ self.unsetECHeartbeat()
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥ê¥â¡¼¥È¥ª¥Ö¥¸¥§¥¯¥È¥³¡¼¥ë
+ # @else
+ # @brief Calling remote object
+ # @endif
+ #
+ # inline void updateStatus(OpenRTM::StatusKind statuskind, const char* msg)
+ def updateStatus(self, statuskind, msg):
+ try:
+ self._observer._ptr().update_status(statuskind, msg)
+ except:
+ self._rtobj.removeSdoServiceConsumer(self._profile.id)
+ return
+
+ ##
+ # @if jp
+ # @brief Kind¤òʸ»úÎó¤ØÊÑ´¹¤¹¤ë
+ # @else
+ # @brief Converting kind to string
+ # @endif
+ #
+ # inline const char* toString(OpenRTM::StatusKind kind)
+ def toString(self, kind):
+ kinds = ["COMPONENT_PROFILE",
+ "RTC_STATUS",
+ "EC_STATUS",
+ "PORT_PROFILE",
+ "CONFIGURATION",
+ "RTC_HEARTBEAT"
+ "EC_HEARTBEAT",
+ "FSM_PROFILE",
+ "FSM_STATUS",
+ "FSM_STRUCTURE",
+ "USER_DEFINED"]
+ if kind._v < RTC.STATUS_KIND_NUM._v:
+ return kinds[kind._v]
+ return ""
+
+
+ ##
+ # @if jp
+ # @brief RTObject¤Ø¤Î¥ê¥¹¥ÊÀܳ½èÍý
+ # @else
+ # @brief Connectiong listeners to RTObject
+ # @endif
+ #
+ # void setListeners(coil::Properties& prop);
+ def setListeners(self, prop):
+ if not prop.getProperty("observed_status"):
+ prop.setProperty("observed_status", "ALL")
+
+ observed_ = [s.strip() for s in prop.getProperty("observed_status").split(",")]
+ flags_ = [ False for i in range(RTC.STATUS_KIND_NUM._v) ]
+
+ for i in range(len(observed_)):
+ observed_[i] = observed_[i].upper()
+ if observed_[i] == "COMPONENT_PROFILE":
+ flags_[RTC.COMPONENT_PROFILE._v] = True
+ elif observed_[i] == "RTC_STATUS":
+ flags_[RTC.RTC_STATUS._v] = True
+ elif observed_[i] == "EC_STATUS":
+ flags_[RTC.EC_STATUS._v] = True
+ elif observed_[i] == "PORT_PROFILE":
+ flags_[RTC.PORT_PROFILE._v] = True
+ elif observed_[i] == "CONFIGURATION":
+ flags_[RTC.CONFIGURATION._v] = True
+ elif observed_[i] == "FSM_PROFILE":
+ flags_[RTC.FSM_PROFILE._v] = True
+ elif observed_[i] == "FSM_STATUS":
+ flags_[RTC.FSM_STRUCTURE._v] = True
+ elif observed_[i] == "FSM_STRUCTURE":
+ flags_[RTC.CONFIGURATION._v] = True
+ elif observed_[i] == "ALL":
+ for j in range(RTC.STATUS_KIND_NUM._v):
+ flags_[j] = True
+ break
+
+ self.switchListeners(flags_[RTC.COMPONENT_PROFILE._v],
+ self._observed,
+ RTC.COMPONENT_PROFILE._v,
+ self.setComponentProfileListeners,
+ self.unsetComponentProfileListeners)
+
+ self.switchListeners(flags_[RTC.RTC_STATUS._v],
+ self._observed,
+ RTC.RTC_STATUS._v,
+ self.setComponentStatusListeners,
+ self.unsetComponentStatusListeners)
+
+ self.switchListeners(flags_[RTC.EC_STATUS._v],
+ self._observed,
+ RTC.EC_STATUS._v,
+ self.setExecutionContextListeners,
+ self.unsetExecutionContextListeners)
+
+ self.switchListeners(flags_[RTC.PORT_PROFILE._v],
+ self._observed,
+ RTC.PORT_PROFILE._v,
+ self.setPortProfileListeners,
+ self.unsetPortProfileListeners)
+
+ self.switchListeners(flags_[RTC.CONFIGURATION._v],
+ self._observed,
+ RTC.CONFIGURATION._v,
+ self.setConfigurationListeners,
+ self.unsetConfigurationListeners)
+
+ self.switchListeners(flags_[RTC.FSM_PROFILE._v],
+ self._observed,
+ RTC.FSM_PROFILE._v,
+ self.setFSMProfileListeners,
+ self.unsetFSMProfileListeners)
+ self.switchListeners(flags_[RTC.FSM_STATUS._v],
+ self._observed,
+ RTC.FSM_STATUS._v,
+ self.setFSMStatusListeners,
+ self.unsetFSMStatusListeners)
+ self.switchListeners(flags_[RTC.FSM_STRUCTURE._v],
+ self._observed,
+ RTC.FSM_STRUCTURE._v,
+ self.setFSMStructureListeners,
+ self.unsetFSMStructureListeners)
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥ê¥¹¥ÊÀܳ¡¦ÀÚÃÇ¥¹¥¤¥Ã¥Á¥ó¥°½èÍý
+ # @else
+ # @brief Switching listeners connecting/disconnecting
+ # @endif
+ #
+ # void switchListeners(bool& next, bool& pre,
+ # void (ComponentObserverConsumer::*setfunc)(),
+ # void (ComponentObserverConsumer::*unsetfunc)());
+ def switchListeners(self, next, pre, pre_idx, setfunc, unsetfunc):
+ if (not pre[pre_idx]) and next:
+ setfunc()
+ pre[pre_idx] = True
+ elif pre[pre_idx] and (not next):
+ unsetfunc()
+ pre[pre_idx] = False
+
+ return
+
+
+ #============================================================
+ # Heartbeat related functions
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤ò¥ª¥Ö¥¶¡¼¥Ð¤ËÅÁ¤¨¤ë
+ # @else
+ # @brief Sending a heartbeart signal to observer
+ # @endif
+ #
+ # void rtcHeartbeat();
+ def rtcHeartbeat(self):
+ self.updateStatus(RTC.RTC_HEARTBEAT, "")
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤òÀßÄꤹ¤ë
+ # @else
+ # @brief Setting heartbeat
+ # @endif
+ #
+ # void setRTCHeartbeat(coil::Properties& prop);
+ def setRTCHeartbeat(self, prop):
+ if prop.getProperty("rtc_heartbeat.enable"):
+ prop.setProperty("heartbeat.enable",prop.getProperty("rtc_heartbeat.enable"))
+ if prop.getProperty("rtc_heartbeat.interval"):
+ prop.setProperty("heartbeat.interval",prop.getProperty("rtc_heartbeat.interval"))
+
+ if OpenRTM_aist.toBool(prop.getProperty("heartbeat.enable"), "YES", "NO", False):
+ interval_ = prop.getProperty("heartbeat.interval")
+ if not interval_:
+ self._rtcInterval.set_time(1.0)
+ else:
+ tmp_ = float(interval_)
+ self._rtcInterval.set_time(tmp_)
+
+ tm_ = self._rtcInterval
+ self._rtcHblistenerid = self._timer.registerListenerObj(self,
+ ComponentObserverConsumer.rtcHeartbeat,
+ tm_)
+ self._timer.start()
+ self._rtcHeartbeat = True
+
+ else:
+ if self._rtcHeartbeat and self._rtcHblistenerid:
+ self.unsetRTCHeartbeat()
+ self._timer.stop()
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤ò²ò½ü¤¹¤ë
+ # @else
+ # @brief Unsetting heartbeat
+ # @endif
+ #
+ # void unsetRTCHeartbeat();
+ def unsetRTCHeartbeat(self):
+ self._timer.unregisterListener(self._rtcHblistenerid)
+ self._rtcHblistenerid = 0
+ self._timer.stop()
+ self._rtcHeartbeat = False
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤ò¥ª¥Ö¥¶¡¼¥Ð¤ËÅÁ¤¨¤ë
+ # @else
+ # @brief Sending a heartbeart signal to observer
+ # @endif
+ #
+ # void ecHeartbeat();
+ def ecHeartbeat(self):
+ self.updateStatus(RTC.EC_HEARTBEAT, "")
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤òÀßÄꤹ¤ë
+ # @else
+ # @brief Setting heartbeat
+ # @endif
+ #
+ # void setECHeartbeat(coil::Properties& prop);
+ def setECHeartbeat(self, prop):
+
+ if OpenRTM_aist.toBool(prop.getProperty("ec_heartbeat.enable"), "YES", "NO", False):
+ interval_ = prop.getProperty("ec_heartbeat.interval")
+ if not interval_:
+ self._ecInterval.set_time(1.0)
+ else:
+ tmp_ = float(interval_)
+ self._ecInterval.set_time(tmp_)
+
+ tm_ = self._ecInterval
+ self._ecHblistenerid = self._timer.registerListenerObj(self,
+ ComponentObserverConsumer.ecHeartbeat,
+ tm_)
+ self._timer.start()
+ self._ecHeartbeat = True
+
+ else:
+ if self._ecHeartbeat and self._ecHblistenerid:
+ self.unsetECHeartbeat()
+ self._timer.stop()
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief ¥Ï¡¼¥È¥Ó¡¼¥È¤ò²ò½ü¤¹¤ë
+ # @else
+ # @brief Unsetting heartbeat
+ # @endif
+ #
+ # void unsetECHeartbeat();
+ def unsetECHeartbeat(self):
+ self._timer.unregisterListener(self._ecHblistenerid)
+ self._ecHblistenerid = 0
+ self._timer.stop()
+ self._ecHeartbeat = False
+ return
+
+
+ #============================================================
+ # Component status related functions
+
+ ##
+ # @if jp
+ # @brief RTC¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê½èÍý
+ # @else
+ # @brief Setting RTC status listeners
+ # @endif
+ #
+ # void setComponentStatusListeners();
+ def setComponentStatusListeners(self):
+ postclistener_ = OpenRTM_aist.PostComponentActionListenerType
+ if not self._compstat.activatedListener:
+ self._compstat.activatedListener = \
+ self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_ACTIVATED,
+ self._compstat.onActivated)
+ if not self._compstat.deactivatedListener:
+ self._compstat.deactivatedListener = \
+ self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_DEACTIVATED,
+ self._compstat.onDeactivated)
+
+ if not self._compstat.resetListener:
+ self._compstat.resetListener = \
+ self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_RESET,
+ self._compstat.onReset)
+
+ if not self._compstat.abortingListener:
+ self._compstat.abortingListener = \
+ self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_ABORTING,
+ self._compstat.onAborting)
+
+ if not self._compstat.finalizeListener:
+ self._compstat.finalizeListener = \
+ self._rtobj.addPostComponentActionListener(postclistener_.POST_ON_FINALIZE,
+ self._compstat.onFinalize)
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief RTC¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü½èÍý
+ # @else
+ # @brief Unsetting RTC status listeners
+ # @endif
+ #
+ # void unsetComponentStatusListeners();
+ def unsetComponentStatusListeners(self):
+ postclistener_ = OpenRTM_aist.PostComponentActionListenerType
+ if self._compstat.activatedListener:
+ self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_ACTIVATED,
+ self._compstat.activatedListener)
+ self._compstat.activatedListener = None
+
+ if self._compstat.deactivatedListener:
+ self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_DEACTIVATED,
+ self._compstat.deactivatedListener)
+ self._compstat.deactivatedListener = None
+
+ if self._compstat.resetListener:
+ self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_RESET,
+ self._compstat.resetListener)
+ self._compstat.resetListener = None
+
+ if self._compstat.abortingListener:
+ self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_ABORTING,
+ self._compstat.abortingListener)
+ self._compstat.abortingListener = None
+
+ if self._compstat.finalizeListener:
+ self._rtobj.removePostComponentActionListener(postclistener_.POST_ON_FINALIZE,
+ self._compstat.finalizeListener)
+ self._compstat.finalizeListener = None
+
+ return
+
+
+ def setFSMStatusListeners(self):
+ pass
+ def unsetFSMStatusListeners(self):
+ pass
+
+
+ #============================================================
+ # Port profile related functions
+
+ ##
+ # @if jp
+ # @brief Port¥×¥í¥Õ¥¡¥¤¥ëÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê½èÍý
+ # @else
+ # @brief Setting port profile listener
+ # @endif
+ #
+ # void setPortProfileListeners();
+ def setPortProfileListeners(self):
+ plistener_ = OpenRTM_aist.PortActionListenerType
+ if not self._portaction.portAddListener:
+ self._portaction.portAddListener = \
+ self._rtobj.addPortActionListener(plistener_.ADD_PORT,
+ self._portaction.onAddPort)
+
+ if not self._portaction.portRemoveListener:
+ self._portaction.portRemoveListener = \
+ self._rtobj.addPortActionListener(plistener_.REMOVE_PORT,
+ self._portaction.onRemovePort)
+
+ pclistener_ = OpenRTM_aist.PortConnectRetListenerType
+ if not self._portaction.portConnectListener:
+ self._portaction.portConnectListener = \
+ self._rtobj.addPortConnectRetListener(pclistener_.ON_CONNECTED,
+ self._portaction.onConnect)
+
+ if not self._portaction.portDisconnectListener:
+ self._portaction.portDisconnectListener = \
+ self._rtobj.addPortConnectRetListener(pclistener_.ON_DISCONNECTED,
+ self._portaction.onDisconnect)
+
+ return
+
+ ##
+ # @if jp
+ # @brief Port¥×¥í¥Õ¥¡¥¤¥ëÊѲ½¥ê¥¹¥Ê¤Î²ò½ü½èÍý
+ # @else
+ # @brief Unsetting port profile listener
+ # @endif
+ #
+ # void unsetPortProfileListeners();
+ def unsetPortProfileListeners(self):
+ plistener_ = OpenRTM_aist.PortActionListenerType
+ if self._portaction.portAddListener:
+ self._rtobj.removePortActionListener(plistener_.ADD_PORT,
+ self._portaction.portAddListener)
+ self._portaction.portAddListener = None
+
+ if self._portaction.portRemoveListener:
+ self._rtobj.removePortActionListener(plistener_.REMOVE_PORT,
+ self._portaction.portRemoveListener)
+ self._portaction.portRemoveListener = None
+
+ pclistener_ = OpenRTM_aist.PortConnectRetListenerType
+ if self._portaction.portConnectListener:
+ self._rtobj.removePortConnectRetListener(pclistener_.ON_CONNECTED,
+ self._portaction.portConnectListener)
+ self._portaction.portConnectListener = None
+
+ if self._portaction.portDisconnectListener:
+ self._rtobj.removePortConnectRetListener(pclistener_.ON_DISCONNECTED,
+ self._portaction.portDisconnectListener)
+ self._portaction.portDisconnectListener = None
+
+ return
+
+
+ #============================================================
+ # EC profile related functions
+
+ ##
+ # @if jp
+ # @brief EC¤Î¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting EC status listener
+ # @endif
+ #
+ # void setExecutionContextListeners();
+ def setExecutionContextListeners(self):
+ ectype_ = OpenRTM_aist.ExecutionContextActionListenerType
+ if not self._ecaction.ecAttached:
+ self._ecaction.ecAttached = \
+ self._rtobj.addExecutionContextActionListener(ectype_.EC_ATTACHED,
+ self._ecaction.onAttached)
+
+ if not self._ecaction.ecDetached:
+ self._ecaction.ecDetached = \
+ self._rtobj.addExecutionContextActionListener(ectype_.EC_DETACHED,
+ self._ecaction.onDetached)
+
+ pcaltype_ = OpenRTM_aist.PostComponentActionListenerType
+ if not self._ecaction.ecRatechanged:
+ self._ecaction.ecRatechanged = \
+ self._rtobj.addPostComponentActionListener(pcaltype_.POST_ON_RATE_CHANGED,
+ self._ecaction.onRateChanged)
+
+ if not self._ecaction.ecStartup:
+ self._ecaction.ecStartup = \
+ self._rtobj.addPostComponentActionListener(pcaltype_.POST_ON_STARTUP,
+ self._ecaction.onStartup)
+
+ if not self._ecaction.ecShutdown:
+ self._ecaction.ecShutdown = \
+ self._rtobj.addPostComponentActionListener(pcaltype_.POST_ON_SHUTDOWN,
+ self._ecaction.onShutdown)
+
+ return
+
+
+ ##
+ # @if jp
+ # @brief EC¤Î¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü
+ # @else
+ # @brief Unsetting EC status listener
+ # @endif
+ #
+ # void unsetExecutionContextListeners();
+ def unsetExecutionContextListeners(self):
+ ectype_ = OpenRTM_aist.ExecutionContextActionListenerType
+ if self._ecaction.ecAttached:
+ self._rtobj.removeExecutionContextActionListener(ectype_.EC_ATTACHED,
+ self._ecaction.ecAttached)
+
+ if self._ecaction.ecDetached:
+ self._rtobj.removeExecutionContextActionListener(ectype_.EC_ATTACHED,
+ self._ecaction.ecDetached)
+
+ pcaltype_ = OpenRTM_aist.PostComponentActionListenerType
+ if self._ecaction.ecRatechanged:
+ self._rtobj.removePostComponentActionListener(pcaltype_.POST_ON_RATE_CHANGED,
+ self._ecaction.ecRatechanged)
+
+ if self._ecaction.ecStartup:
+ self._rtobj.removePostComponentActionListener(pcaltype_.POST_ON_STARTUP,
+ self._ecaction.ecStartup)
+
+ if self._ecaction.ecShutdown:
+ self._rtobj.removePostComponentActionListener(pcaltype_.POST_ON_SHUTDOWN,
+ self._ecaction.ecShutdown)
+
+ return
+
+
+ #============================================================
+ # ComponentProfile related functions
+
+ ##
+ # @if jp
+ # @brief ComponentProfile¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting ComponentProfile listener
+ # @endif
+ #
+ # void setComponentProfileListeners();
+ def setComponentProfileListeners(self):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief ComponentProfile¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü
+ # @else
+ # @brief Unsetting ComponentProfile listener
+ # @endif
+ #
+ # void unsetComponentProfileListeners();
+ def unsetComponentProfileListeners(self):
+ pass
+
+
+ #============================================================
+ # FsmStructure related functions
+
+ ##
+ # @if jp
+ # @brief FsmStructure¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting FsmStructure listener
+ # @endif
+ #
+ # void setConfigurationListeners();
+ def setFSMStructureListeners(self):
+ fsmactionlistenertype_ = OpenRTM_aist.PreFsmActionListenerType
+ self._fsmaction.preOnFsmInitListener = \
+ self._rtobj.addPreFsmActionListener(fsmactionlistenertype_.PRE_ON_INIT,
+ self._fsmaction.preInit)
+
+ self._fsmaction.preOnFsmEntryListener = \
+ self._rtobj.addPreFsmActionListener(fsmactionlistenertype_.PRE_ON_ENTRY,
+ self._fsmaction.preEntry)
+
+ self._fsmaction.preOnFsmDoListener = \
+ self._rtobj.addPreFsmActionListener(fsmactionlistenertype_.PRE_ON_DO,
+ self._fsmaction.preDo)
+
+ self._fsmaction.preOnFsmExitListener = \
+ self._rtobj.addPreFsmActionListener(fsmactionlistenertype_.PRE_ON_EXIT,
+ self._fsmaction.preExit)
+
+ self._fsmaction.preOnFsmStateChangeListener = \
+ self._rtobj.addPreFsmActionListener(fsmactionlistenertype_.PRE_ON_STATE_CHANGE,
+ self._fsmaction.postInit)
+
+ fsmactionlistenertype_ = OpenRTM_aist.PostFsmActionListenerType
+
+ self._fsmaction.postOnFsmInitListener = \
+ self._rtobj.addPostFsmActionListener(fsmactionlistenertype_.POST_ON_INIT,
+ self._fsmaction.preStateChange)
+
+ self._fsmaction.postOnFsmEntryListener = \
+ self._rtobj.addPostFsmActionListener(fsmactionlistenertype_.POST_ON_ENTRY,
+ self._fsmaction.postEntry)
+
+ self._fsmaction.postOnFsmDoListener = \
+ self._rtobj.addPostFsmActionListener(fsmactionlistenertype_.POST_ON_DO,
+ self._fsmaction.postDo)
+
+ self._fsmaction.postOnFsmExitListener = \
+ self._rtobj.addPostFsmActionListener(fsmactionlistenertype_.POST_ON_EXIT,
+ self._fsmaction.postExit)
+
+ self._fsmaction.postOnFsmStateChangeListener = \
+ self._rtobj.addPostFsmActionListener(fsmactionlistenertype_.POST_ON_STATE_CHANGE,
+ self._fsmaction.postStateChange)
+
+
+
+ def unsetFSMStructureListeners(self):
+ fsmactionlistenertype_ = OpenRTM_aist.FSMActionListenerType
+ if self._fsmaction.preOnFsmInitListener:
+ self._rtobj.removePreFsmActionListener(fsmactionlistenertype_.PRE_ON_INIT,
+ self._fsmaction.preOnFsmInitListener)
+ self._fsmaction.preOnFsmInitListener = None
+
+ if self._fsmaction.preOnFsmEntryListener:
+ self._rtobj.removePreFsmActionListener(fsmactionlistenertype_.PRE_ON_ENTRY,
+ self._fsmaction.preOnFsmEntryListener)
+ self._fsmaction.preOnFsmEntryListener = None
+
+ if self._fsmaction.preOnFsmDoListener:
+ self._rtobj.removePreFsmActionListener(fsmactionlistenertype_.PRE_ON_DO,
+ self._fsmaction.preOnFsmDoListener)
+ self._fsmaction.preOnFsmDoListener = None
+
+ if self._fsmaction.preOnFsmExitListener:
+ self._rtobj.removePreFsmActionListener(fsmactionlistenertype_.PRE_ON_EXIT,
+ self._fsmaction.preOnFsmExitListener)
+ self._fsmaction.preOnFsmExitListener = None
+
+ if self._fsmaction.preOnFsmStateChangeListener:
+ self._rtobj.removePreFsmActionListener(fsmactionlistenertype_.PRE_ON_STATE_CHANGE,
+ self._fsmaction.preOnFsmStateChangeListener)
+ self._fsmaction.preOnFsmStateChangeListener = None
+
+ if self._fsmaction.postOnFsmInitListener:
+ self._rtobj.removePostFsmActionListener(fsmactionlistenertype_.POST_ON_INIT,
+ self._fsmaction.postOnFsmInitListener)
+ self._fsmaction.postOnFsmInitListener = None
+
+ if self._fsmaction.postOnFsmEntryListener:
+ self._rtobj.removePostFsmActionListener(fsmactionlistenertype_.POST_ON_ENTRY,
+ self._fsmaction.postOnFsmEntryListener)
+ self._fsmaction.postOnFsmEntryListener = None
+
+ if self._fsmaction.postOnFsmDoListener:
+ self._rtobj.removePostFsmActionListener(fsmactionlistenertype_.POST_ON_DO,
+ self._fsmaction.postOnFsmDoListener)
+ self._fsmaction.postOnFsmDoListener = None
+
+
+ if self._fsmaction.postOnFsmExitListener:
+ self._rtobj.removePostFsmActionListener(fsmactionlistenertype_.POST_ON_EXIT,
+ self._fsmaction.postOnFsmExitListener)
+ self._fsmaction.postOnFsmExitListener = None
+
+ if self._fsmaction.postOnFsmStateChangeListener:
+ self._rtobj.removePostFsmActionListener(fsmactionlistenertype_.POST_ON_EXIT,
+ self._fsmaction.postOnFsmStateChangeListener)
+ self._fsmaction.postOnFsmStateChangeListener = None
+
+ #============================================================
+ # Configuration related functions
+
+ ##
+ # @if jp
+ # @brief Configuration¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting Configuration listener
+ # @endif
+ #
+ # void setConfigurationListeners();
+ def setConfigurationListeners(self):
+ confprmlistenertype_ = OpenRTM_aist.ConfigurationParamListenerType
+ self._configMsg.updateConfigParamListener = \
+ self._rtobj.addConfigurationParamListener(confprmlistenertype_.ON_UPDATE_CONFIG_PARAM,
+ self._configMsg.updateConfigParam)
+
+ confsetlistenertype_ = OpenRTM_aist.ConfigurationSetListenerType
+ self._configMsg.setConfigSetListener = \
+ self._rtobj.addConfigurationSetListener(confsetlistenertype_.ON_SET_CONFIG_SET,
+ self._configMsg.setConfigSet)
+
+ self._configMsg.addConfigSetListener = \
+ self._rtobj.addConfigurationSetListener(confsetlistenertype_.ON_ADD_CONFIG_SET,
+ self._configMsg.addConfigSet)
+
+ confsetnamelistenertype_ = OpenRTM_aist.ConfigurationSetNameListenerType
+ self._configMsg.updateConfigSetListener = \
+ self._rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_UPDATE_CONFIG_SET,
+ self._configMsg.updateConfigSet)
+
+ self._configMsg.removeConfigSetListener = \
+ self._rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_REMOVE_CONFIG_SET,
+ self._configMsg.removeConfigSet)
+ self._configMsg.activateConfigSetListener = \
+ self._rtobj.addConfigurationSetNameListener(confsetnamelistenertype_.ON_ACTIVATE_CONFIG_SET,
+ self._configMsg.activateConfigSet)
+ return
+
+
+ ##
+ # @if jp
+ # @brief Configuration¾õÂÖÊѲ½¥ê¥¹¥Ê¤Î²ò½ü
+ # @else
+ # @brief Unsetting Configurationlistener
+ # @endif
+ #
+ # void unsetConfigurationListeners();
+ def unsetConfigurationListeners(self):
+ confprmlistenertype_ = OpenRTM_aist.ConfigurationParamListenerType
+ if self._configMsg.updateConfigParamListener:
+ self._rtobj.removeConfigurationParamListener(confprmlistenertype_.ON_UPDATE_CONFIG_PARAM,
+ self._configMsg.updateConfigParamListener)
+ self._configMsg.updateConfigParamListener = None
+
+ confsetlistenertype_ = OpenRTM_aist.ConfigurationSetListenerType
+ if self._configMsg.setConfigSetListener:
+ self._rtobj.removeConfigurationSetListener(confsetlistenertype_.ON_SET_CONFIG_SET,
+ self._configMsg.setConfigSetListener)
+ self._configMsg.setConfigSetListener = None
+
+ if self._configMsg.addConfigSetListener:
+ self._rtobj.removeConfigurationSetListener(confsetlistenertype_.ON_ADD_CONFIG_SET,
+ self._configMsg.addConfigSetListener)
+ self._configMsg.addConfigSetListener = None
+
+ confsetnamelistenertype_ = OpenRTM_aist.ConfigurationSetNameListenerType
+ if self._configMsg.updateConfigSetListener:
+ self._rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_UPDATE_CONFIG_SET,
+ self._configMsg.updateConfigSetListener)
+ self._configMsg.updateConfigSetListener = None
+
+ if self._configMsg.removeConfigSetListener:
+ self._rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_REMOVE_CONFIG_SET,
+ self._configMsg.removeConfigSetListener)
+ self._configMsg.removeConfigSetListener = None
+
+ if self._configMsg.activateConfigSetListener:
+ self._rtobj.removeConfigurationSetNameListener(confsetnamelistenertype_.ON_ACTIVATE_CONFIG_SET,
+ self._configMsg.activateConfigSetListener)
+ self._configMsg.activateConfigSetListener = None
+
+ return
+
+ ##
+ # @if jp
+ # @brief FsmProfile¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting FsmProfile listener
+ # @endif
+ #
+ def setFSMProfileListeners(self):
+ pass
+
+ ##
+ # @if jp
+ # @brief FsmProfile¾õÂÖÊѲ½¥ê¥¹¥Ê¤ÎÀßÄê
+ # @else
+ # @brief Setting FsmProfile listener
+ # @endif
+ #
+ def unsetFSMProfileListeners(self):
+ pass
+
+
+ ##
+ # @if jp
+ # @brief PostComponentActionListener class
+ # @else
+ # @brief PostComponentActionListener class
+ # @endif
+ #
+ class CompStatMsg:
+ """
+ """
+
+ #CompStatMsg(ComponentObserverConsumer& coc)
+ def __init__(self, coc):
+ self.activatedListener = None
+ self.deactivatedListener = None
+ self.resetListener = None
+ self.abortingListener = None
+ self.finalizeListener = None
+ self._coc = coc
+ return
+
+ def __del__(self):
+ del self._coc
+ return
+
+ #void onGeneric(const char* msgprefix, UniqueId ec_id, ReturnCode_t ret)
+ def onGeneric(self, msgprefix, ec_id, ret):
+ if ret == RTC.RTC_OK:
+ msg_ = msgprefix
+ msg_ += str(ec_id)
+ self._coc.updateStatus(RTC.RTC_STATUS, msg_)
+ return
+
+ #void onActivated(UniqueId ec_id, ReturnCode_t ret)
+ def onActivated(self, ec_id, ret):
+ self.onGeneric("ACTIVE:", ec_id, ret)
+ return
+
+ #void onDeactivated(UniqueId ec_id, ReturnCode_t ret)
+ def onDeactivated(self, ec_id, ret):
+ self.onGeneric("INACTIVE:", ec_id, ret)
+ return
+
+ #void onReset(UniqueId ec_id, ReturnCode_t ret)
+ def onReset(self, ec_id, ret):
+ self.onGeneric("INACTIVE:", ec_id, ret)
+ return
+
+ #void onAborting(UniqueId ec_id, ReturnCode_t ret)
+ def onAborting(self, ec_id, ret):
+ self.onGeneric("ERROR:", ec_id, ret)
+ return
+
+ #void onFinalize(UniqueId ec_id, ReturnCode_t ret)
+ def onFinalize(self, ec_id, ret):
+ self.onGeneric("FINALIZE:", ec_id, ret)
+ return
+
+ ##
+ # @if jp
+ # @brief PortActionListener
+ # @else
+ # @brief PortActionListener
+ # @endif
+ #
+ class PortAction:
+ """
+ """
+
+ #PortAction(ComponentObserverConsumer& coc)
+ def __init__(self, coc):
+ self.portAddListener = None
+ self.portRemoveListener = None
+ self.portConnectListener = None
+ self.portDisconnectListener = None
+ self._coc = coc
+ return
+
+ def __del__(self):
+ del self._coc
+ return
+
+ #void onGeneric(const char* _msg, const char* portname)
+ def onGeneric(self, _msg, portname):
+ msg_ = _msg
+ msg_ += portname
+ self._coc.updateStatus(RTC.PORT_PROFILE, msg_)
+ return
+
+ #void onAddPort(const ::RTC::PortProfile& pprof)
+ def onAddPort(self, pprof):
+ self.onGeneric("ADD:", str(pprof.name))
+ return
+
+ #void onRemovePort(const ::RTC::PortProfile& pprof)
+ def onRemovePort(self, pprof):
+ self.onGeneric("REMOVE:", str(pprof.name))
+ return
+
+ #void onConnect(const char* portname,
+ # ::RTC::ConnectorProfile& pprof, ReturnCode_t ret)
+ def onConnect(self, portname, pprof, ret):
+ if ret == RTC.RTC_OK:
+ self.onGeneric("CONNECT:", portname)
+ return
+
+ #void onDisconnect(const char* portname,
+ # ::RTC::ConnectorProfile& pprof, ReturnCode_t ret)
+ def onDisconnect(self, portname, pprof, ret):
+ if ret == RTC.RTC_OK:
+ self.onGeneric("DISCONNECT:", portname)
+ return
+
+
+ ##
+ # @if jp
+ # @brief ExecutionContextActionListener
+ # @else
+ # @brief ExecutionContextActionListener
+ # @endif
+ #
+ class ECAction:
+ """
+ """
+
+ #ECAction(ComponentObserverConsumer& coc)
+ def __init__(self, coc):
+ self.ecAttached = None
+ self.ecDetached = None
+ self.ecRatechanged = None
+ self.ecStartup = None
+ self.ecShutdown = None
+ self._coc = coc
+ return
+
+ def __del__(self):
+ del self._coc
+ return
+
+ #void onGeneric(const char* _msg, UniqueId ec_id)
+ def onGeneric(self, _msg, ec_id):
+ msg_ = _msg + str(ec_id)
+ self._coc.updateStatus(RTC.EC_STATUS, msg_)
+ return
+
+ #void onAttached(UniqueId ec_id)
+ def onAttached(self, ec_id):
+ self.onGeneric("ATTACHED:", ec_id)
+ return
+
+ #void onDetached(UniqueId ec_id)
+ def onDetached(self, ec_id):
+ self.onGeneric("DETACHED:", ec_id)
+ return
+
+ #void onRateChanged(UniqueId ec_id, ReturnCode_t ret)
+ def onRateChanged(self, ec_id, ret):
+ if ret == RTC.RTC_OK:
+ self.onGeneric("RATE_CHANGED:", ec_id)
+ return
+
+ #void onStartup(UniqueId ec_id, ReturnCode_t ret)
+ def onStartup(self, ec_id, ret):
+ if ret == RTC.RTC_OK:
+ self.onGeneric("STARTUP:", ec_id)
+ return
+
+ #void onShutdown(UniqueId ec_id, ReturnCode_t ret)
+ def onShutdown(self, ec_id, ret):
+ if ret == RTC.RTC_OK:
+ self.onGeneric("SHUTDOWN:", ec_id)
+ return
+
+
+ ##
+ # @if jp
+ # @brief ConfigActionListener
+ # @else
+ # @brief ConfigActionListener
+ # @endif
+ #
+ class ConfigAction:
+ """
+ """
+
+ #ConfigAction(ComponentObserverConsumer& coc)
+ def __init__(self, coc):
+ self.updateConfigParamListener = None
+ self.setConfigSetListener = None
+ self.addConfigSetListener = None
+ self.updateConfigSetListener = None
+ self.removeConfigSetListener = None
+ self.activateConfigSetListener = None
+ self._coc = coc
+
+ def __del__(self):
+ del self._coc
+ return
+
+ #void updateConfigParam(const char* configsetname,
+ # const char* configparamname)
+ def updateConfigParam(self, configsetname, configparamname):
+ msg_ = "UPDATE_CONFIG_PARAM: "
+ msg_ += configsetname
+ msg_ += "."
+ msg_ += configparamname
+ self._coc.updateStatus(RTC.CONFIGURATION, msg_)
+ return
+
+ #void setConfigSet(const coil::Properties& config_set)
+ def setConfigSet(self, config_set):
+ msg_ = "SET_CONFIG_SET: "
+ msg_ += config_set.getName()
+ self._coc.updateStatus(RTC.CONFIGURATION, msg_)
+ return
+
+ #void addConfigSet(const coil::Properties& config_set)
+ def addConfigSet(self, config_set):
+ msg_ = "ADD_CONFIG_SET: "
+ msg_ += config_set.getName()
+ self._coc.updateStatus(RTC.CONFIGURATION, msg_)
+ return
+
+ #void updateConfigSet(const char* config_set_name)
+ def updateConfigSet(self, config_set_name):
+ msg_ = "UPDATE_CONFIG_SET: "
+ msg_ += config_set_name
+ self._coc.updateStatus(RTC.CONFIGURATION, msg_)
+ return
+
+ #void removeConfigSet(const char* config_set_name)
+ def removeConfigSet(self, config_set_name):
+ msg_ = "REMOVE_CONFIG_SET: "
+ msg_ += config_set_name
+ self._coc.updateStatus(RTC.CONFIGURATION, msg_)
+ return
+
+ #void activateConfigSet(const char* config_set_name)
+ def activateConfigSet(self, config_set_name):
+ msg_ = "ACTIVATE_CONFIG_SET: "
+ msg_ += config_set_name
+ self._coc.updateStatus(RTC.CONFIGURATION, msg_)
+ return
+
+
+ ##
+ # @if jp
+ # @brief FSMActionListener
+ # @else
+ # @brief FSMActionListener
+ # @endif
+ #
+ class FSMAction:
+ """
+ """
+
+ #ConfigAction(ComponentObserverConsumer& coc)
+ def __init__(self, coc):
+ self.updateFsmStatusListener = None
+ self.preOnFsmInitListener = None
+ self.preOnFsmEntryListener = None
+ self.preOnFsmDoListener = None
+ self.preOnFsmExitListener = None
+ self.preOnFsmStateChangeListener = None
+ self.postOnFsmInitListener = None
+ self.postOnFsmEntryListener = None
+ self.postOnFsmDoListener = None
+ self.postOnFsmExitListener = None
+ self.postOnFsmStateChangeListener = None
+ self._coc = coc
+
+ def __del__(self):
+ del self._coc
+ return
+
+
+ def updateFsmStatus(self, state):
+ self._coc.updateStatus(RTC.FSM_STATUS, state)
+ return
+ def preInit(self, state):
+ msg_ = state+" PRE_ON_INIT"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def preEntry(self, state):
+ msg_ = state+" PRE_ONENTRY"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def preDo(self, state):
+ msg_ = state+" PRE_ON_DO"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def preExit(self, state):
+ msg_ = state+" PRE_ON_EXIT"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def preStateChange(self, state):
+ msg_ = state+" PRE_ON_STATE_CHANGE"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def postInit(self, state):
+ msg_ = state+" POST_ON_INIT"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def postEntry(self, state):
+ msg_ = state+" POST_ONENTRY"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def postDo(self, state):
+ msg_ = state+" POST_ON_DO"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def postExit(self, state):
+ msg_ = state+" POST_ON_EXIT"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+ def postStateChange(self, state):
+ msg_ = state+" POST_ON_STATE_CHNAGE"
+ self._coc.updateStatus(RTC.FSM_STATUS, msg_)
+ return
+
+def ComponentObserverConsumerInit(mgr=None):
+ factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
+ factory.addFactory(RTC.ComponentObserver._NP_RepositoryId,
+ ComponentObserverConsumer,
+ OpenRTM_aist.Delete)
+ return
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/rtc.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/rtc.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/rtc.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,21 @@
+corba.nameservers: localhost
+naming.formats: %n.rtc
+#logger.enable: NO
+logger.log_level: VERBOSE
+#logger.file_name: STDOUT
+#manager.naming_formats: %n.mgr
+manager.modules.load_path: .
+manager.modules.preload: ComponentObserverConsumer
+
+
+manager.modules.load_path: ./
+manager.modules.preload: Microwave.py, ComponentObserverConsumer.py
+manager.components.precreate: Microwave
+manager.components.preactivation: Inputbutton0, Microwave0
+manager.components.preconnect: \
+ Inputbutton0.open^Microwave0.event(fsm_event_name=open), \
+ Inputbutton0.close^Microwave0.event(fsm_event_name=close), \
+ Inputbutton0.minute^Microwave0.event(fsm_event_name=minute), \
+ Inputbutton0.start^Microwave0.event(fsm_event_name=start), \
+ Inputbutton0.stop^Microwave0.event(fsm_event_name=stop), \
+ Inputbutton0.tick^Microwave0.event(fsm_event_name=tick)
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.bat
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.bat (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.bat 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,15 @@
+ at echo off
+echo "<<< ComponentObserverConsumer setup start >>>"
+
+set idlfiles=BasicDataType.idl DataPort.idl ExtendedDataTypes.idl InterfaceDataTypes.idl OpenRTM.idl RTC.idl SDOPackage.idl SharedMemory.idl IORProfile.idl ExtendedFsmService.idl
+
+rem # idl file copy
+for %%x in (%idlfiles%) do copy ..\..\..\RTM_IDL\%%x .
+
+rem # idl file compile
+set idlfiles=%idlfiles% ComponentObserver.idl
+for %%x in (%idlfiles%) do omniidl -I. -bpython %%x
+
+echo "<<< ComponentObserverConsumer setup Complete >>>"
+echo ""
+
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.sh
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.sh (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/ext/sdo/fsm4rtc_observer/setup.sh 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+echo "<<< ComponentObserverConsumer Test setup start >>>"
+
+# idl file copy
+cp -pf ../../../RTM_IDL/BasicDataType.idl .
+cp -pf ../../../RTM_IDL/DataPort.idl .
+cp -pf ../../../RTM_IDL/ExtendedDataTypes.idl .
+cp -pf ../../../RTM_IDL/InterfaceDataTypes.idl .
+cp -pf ../../../RTM_IDL/OpenRTM.idl .
+cp -pf ../../../RTM_IDL/RTC.idl .
+cp -pf ../../../RTM_IDL/SDOPackage.idl .
+cp -pf ../../../RTM_IDL/SharedMemory.idl .
+cp -pf ../../../RTM_IDL/IORProfile.idl .
+cp -pf ../../../RTM_IDL/ExtendedFsmService.idl .
+
+# idl file compile
+omniidl -bpython *.idl
+
+echo "<<< ComponentObserverConsumer Test setup Complete >>>"
+echo ""
+
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleIn.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleIn.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleIn.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -35,6 +35,7 @@
print("Profile::id: ", info.id)
print("Data: ", data.data)
print("------------------------------")
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
class ConnListener(OpenRTM_aist.ConnectorListener):
def __init__(self, name):
@@ -49,6 +50,7 @@
print("Profile::name: ", info.name)
print("Profile::id: ", info.id)
print("------------------------------")
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
class ConsoleIn(OpenRTM_aist.DataFlowComponentBase):
Modified: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleOut.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleOut.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/SimpleIO/ConsoleOut.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -36,6 +36,7 @@
print("Profile::id: ", info.id)
print("Data: ", data.data)
print("------------------------------")
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
class ConnListener(OpenRTM_aist.ConnectorListener):
@@ -51,6 +52,7 @@
print("Profile::name: ", info.name)
print("Profile::id: ", info.id)
print("------------------------------")
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Display.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Display.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Display.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,170 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Display.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+import OpenRTM_aist.StringUtil
+
+display_spec = ["implementation_id", "Display",
+ "type_name", "Display",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Miyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+
+class DataListener(OpenRTM_aist.ConnectorDataListenerT):
+ def __init__(self, name):
+ self._name = name
+
+ def __del__(self):
+ print("dtor of ", self._name)
+
+ def __call__(self, info, cdrdata):
+ data = OpenRTM_aist.ConnectorDataListenerT.__call__(self, info, cdrdata, RTC.TimedLong(RTC.Time(0,0),0))
+ print("------------------------------")
+ print("Listener: ", self._name)
+ print("Profile::name: ", info.name)
+ print("Profile::id: ", info.id)
+ print("Data: ", data.data)
+ print("------------------------------")
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+
+
+class ConnListener(OpenRTM_aist.ConnectorListener):
+ def __init__(self, name):
+ self._name = name
+
+ def __del__(self):
+ print("dtor of ", self._name)
+
+ def __call__(self, info):
+ print("------------------------------")
+ print("Listener: ", self._name)
+ print("Profile::name: ", info.name)
+ print("Profile::id: ", info.id)
+ print("------------------------------")
+ return OpenRTM_aist.ConnectorListenerStatus.NO_CHANGE
+
+
+
+
+class Display(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+ return
+
+ def onInitialize(self):
+ self._in = RTC.TimedLong(RTC.Time(0,0),0)
+
+
+ self._inIn = OpenRTM_aist.InPort("in", self._in)
+
+ # Set OutPort buffer
+ self.addInPort("in", self._inIn)
+
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE,
+ DataListener("ON_BUFFER_WRITE"))
+
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_FULL,
+ DataListener("ON_BUFFER_FULL"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_WRITE_TIMEOUT,
+ DataListener("ON_BUFFER_WRITE_TIMEOUT"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_OVERWRITE,
+ DataListener("ON_BUFFER_OVERWRITE"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_BUFFER_READ,
+ DataListener("ON_BUFFER_READ"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_SEND,
+ DataListener("ON_SEND"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVED,
+ DataListener("ON_RECEIVED"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_FULL,
+ DataListener("ON_RECEIVER_FULL"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_TIMEOUT,
+ DataListener("ON_RECEIVER_TIMEOUT"))
+
+ self._inIn.addConnectorDataListener(OpenRTM_aist.ConnectorDataListenerType.ON_RECEIVER_ERROR,
+ DataListener("ON_RECEIVER_ERROR"))
+
+ self._inIn.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_CONNECT,
+ ConnListener("ON_CONNECT"))
+ self._inIn.addConnectorListener(OpenRTM_aist.ConnectorListenerType.ON_DISCONNECT,
+ ConnListener("ON_DISCONNECT"))
+
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+ if self._inIn.isNew():
+ data = self._inIn.read()
+ print("Received: ", data.data)
+ print("TimeStamp: ", data.tm.sec,"[s]")
+ print("TimeStamp: ", data.tm.nsec,"[ns]")
+
+
+ return RTC.RTC_OK
+
+
+def DisplayInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=display_spec)
+ manager.registerFactory(profile,
+ Display,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ DisplayInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("Display")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Inputbutton.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Inputbutton.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Inputbutton.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,159 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Inputbutton.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+import OpenRTM_aist.StringUtil
+
+inputbutton_spec = ["implementation_id", "Inputbutton",
+ "type_name", "Inputbutton",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Miyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+
+
+
+class Inputbutton(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+ return
+
+ def onInitialize(self):
+ self._open = RTC.TimedLong(RTC.Time(0,0),0)
+ self._close = RTC.TimedLong(RTC.Time(0,0),0)
+ self._minute = RTC.TimedLong(RTC.Time(0,0),0)
+ self._start = RTC.TimedLong(RTC.Time(0,0),0)
+ self._stop = RTC.TimedLong(RTC.Time(0,0),0)
+ self._tick = RTC.TimedLong(RTC.Time(0,0),0)
+
+ self._openOut = OpenRTM_aist.OutPort("open", self._open)
+ self._closeOut = OpenRTM_aist.OutPort("close", self._close)
+ self._minuteOut = OpenRTM_aist.OutPort("minute", self._minute)
+ self._startOut = OpenRTM_aist.OutPort("start", self._start)
+ self._stopOut = OpenRTM_aist.OutPort("stop", self._stop)
+ self._tickOut = OpenRTM_aist.OutPort("tick", self._tick)
+ # Set OutPort buffer
+ self.addOutPort("out", self._openOut)
+ self.addOutPort("out", self._closeOut)
+ self.addOutPort("out", self._minuteOut)
+ self.addOutPort("out", self._startOut)
+ self.addOutPort("out", self._stopOut)
+ self.addOutPort("out", self._tickOut)
+
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+ print("")
+ print("Please select action!!")
+ print("Commands: ")
+ print(" open : Open the microwave's door.")
+ print(" close : Close the microwave's door.")
+ print(" minute <int> : Increment timer. ")
+ print(" start : Start the microwave.")
+ print(" stop : Stop the microwave.")
+ print(" tick : Proceed time.")
+ print(" -> others are interpreted as tick commnad.")
+ print(">> ")
+ print("Please input number: ",end="")
+ #print "Please input number: ",
+ cmds = sys.stdin.readline()
+ cmds = cmds.split(" ")
+ OpenRTM_aist.StringUtil.eraseBlank(cmds)
+ cmds[0] = cmds[0].replace("\n","")
+ cmds[0] = cmds[0].replace("\r","")
+ print("[command]: ",cmds[0])
+ print(" [args]: ",end="")
+ #print " [args]: ",
+ for n in range(len(cmds)):
+ if n == 0:
+ continue
+ print(cmds[n],end="")
+ #print cmds[n],
+ print("")
+ if cmds[0] == "open":
+ self._open.data = 0
+ self._openOut.write()
+ elif cmds[0] == "close":
+ self._close.data = 0
+ self._closeOut.write()
+ elif cmds[0] == "minute":
+ min = [0]
+ if len(cmds) < 2 or not OpenRTM_aist.StringUtil.stringTo(min, cmds[1]):
+ print("minute command needs an integer arg.")
+ return RTC.RTC_OK
+
+ self._minute.data = min[0]
+ self._minuteOut.write()
+ elif cmds[0] == "start":
+ self._start.data = 0
+ self._startOut.write()
+ elif cmds[0] == "stop":
+ self._stop.data = 0
+ self._stopOut.write()
+ else:
+ print("tick")
+ self._tick.data = 0
+ self._tickOut.write()
+
+
+
+ return RTC.RTC_OK
+
+
+def InputbuttonInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=inputbutton_spec)
+ manager.registerFactory(profile,
+ Inputbutton,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ InputbuttonInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("Inputbutton")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Microwave.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Microwave.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/Microwave.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Microwave.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+
+
+import MicrowaveFsm
+
+microwave_spec = ["implementation_id", "Microwave",
+ "type_name", "Microwave",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Nobuhiko Miyamoto",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "Python",
+ "lang_type", "script",
+ ""]
+
+
+
+
+
+class Microwave(OpenRTM_aist.DataFlowComponentBase):
+ def __init__(self, manager):
+ OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
+
+ return
+
+ def onFinalize(self):
+ self._fsm.exit()
+ return RTC.RTC_OK
+
+ def onInitialize(self):
+ self._fsm = OpenRTM_aist.Machine(MicrowaveFsm.TOP, self)
+ self._fsm.init()
+ self._eventIn = OpenRTM_aist.EventInPort("event", self._fsm)
+
+ self.addInPort("event", self._eventIn)
+ self._eventIn.bindEvent0("open", "open")
+ self._eventIn.bindEvent0("close", "close")
+ self._eventIn.bindEvent1("minute", "minute", RTC.TimedLong(RTC.Time(0,0),0))
+ self._eventIn.bindEvent0("start", "start")
+ self._eventIn.bindEvent0("stop", "stop")
+ self._eventIn.bindEvent0("tick", "tick")
+
+
+
+ return RTC.RTC_OK
+
+
+ def onExecute(self, ec_id):
+
+
+ return RTC.RTC_OK
+
+
+def MicrowaveInit(manager):
+ profile = OpenRTM_aist.Properties(defaults_str=microwave_spec)
+ manager.registerFactory(profile,
+ Microwave,
+ OpenRTM_aist.Delete)
+
+
+def MyModuleInit(manager):
+ MicrowaveInit(manager)
+
+ # Create a component
+ comp = manager.createComponent("Microwave")
+
+def main():
+ # Initialize manager
+ mgr = OpenRTM_aist.Manager.init(sys.argv)
+
+ # Set module initialization proceduer
+ # This procedure will be invoked in activateManager() function.
+ mgr.setModuleInitProc(MyModuleInit)
+
+ # Activate manager and register to naming service
+ mgr.activateManager()
+
+ # run the manager in blocking mode
+ # runManager(False) is the default
+ mgr.runManager()
+
+ # If you want to run the manager in non-blocking mode, do like this
+ # mgr.runManager(True)
+
+if __name__ == "__main__":
+ main()
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/MicrowaveFsm.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/MicrowaveFsm.py (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/MicrowaveFsm.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+# -*- coding: euc-jp -*-
+
+##
+# @file Microwave.py
+# @brief example StaticFSM
+# @date $Date: $
+# @author Nobuhiko Miyamoto <n-miyamoto at aist.go.jp>
+#
+# Copyright (C) 2017
+# Intelligent Systems Research Institute,
+# National Institute of
+# Advanced Industrial Science and Technology (AIST), Japan
+# All rights reserved.
+
+import sys
+
+import RTC
+import OpenRTM_aist
+import OpenRTM_aist.Macho
+
+class TOP(OpenRTM_aist.Link):
+ def __init__(self, instance):
+ super(TOP,self).__init__(instance)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+ self.setState(Operational)
+
+
+ def open(self):
+ pass
+ def close(self):
+ pass
+ def minute(self, time_):
+ pass
+ def start(self):
+ pass
+ def stop(self):
+ pass
+ def tick(self):
+ pass
+
+ class Box:
+ def __init__(self):
+ self.myCookingTime = 0
+ def printTimer(self):
+ print(" Timer set to ", self.myCookingTime, " minutes")
+ def incrementTimer(self):
+ self.myCookingTime+=1
+ def decrementTimer(self):
+ self.myCookingTime-=1
+ def resetTimer(self):
+ self.myCookingTime = 0
+ def getRemainingTime(self):
+ return self.myCookingTime
+
+
+OpenRTM_aist.FSM_TOPSTATE(TOP)
+
+
+class Disabled(TOP):
+ def __init__(self, instance):
+ super(Disabled,self).__init__(instance)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ print(" Microwave opened")
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ print(" Microwave closed")
+ def close(self):
+ self.setStateHistory(Operational)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+
+OpenRTM_aist.FSM_SUBSTATE(Disabled,TOP)
+
+class Operational(TOP):
+ def __init__(self, instance):
+ super(Operational,self).__init__(instance)
+ def open(self):
+ self.setState(Disabled)
+ def stop(self):
+ self.setState(Idle)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+ self.setState(Idle)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+
+
+
+
+OpenRTM_aist.FSM_SUBSTATE(Operational,TOP)
+OpenRTM_aist.Macho.DEEPHISTORY(Operational)
+
+
+class Idle(Operational):
+ def __init__(self, instance):
+ super(Idle,self).__init__(instance)
+ def minute(self, time_):
+ self.setState(Programmed)
+ self["TopBase_"].dispatch(OpenRTM_aist.Macho.Event1("minute",time_))
+
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ self[TOP].box().resetTimer()
+ print(" Microwave ready")
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+
+
+OpenRTM_aist.FSM_SUBSTATE(Idle,Operational)
+
+
+class Programmed(Operational):
+ def __init__(self, instance):
+ super(Programmed,self).__init__(instance)
+ def minute(self, time_):
+ for t in range(time_.data):
+ self[TOP].box().incrementTimer()
+ self[TOP].box().printTimer()
+ def start(self):
+ self.setState(Cooking)
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+
+
+
+OpenRTM_aist.FSM_SUBSTATE(Programmed,Operational)
+
+
+class Cooking(Programmed):
+ def __init__(self, instance):
+ super(Cooking,self).__init__(instance)
+ def tick(self):
+ print(" Clock tick")
+ tb = self[TOP].box()
+ tb.decrementTimer()
+ if tb.getRemainingTime() == 0:
+ print(" Finished")
+ self.setState(Idle)
+ else:
+ tb.printTimer()
+
+ def entry(self):
+ OpenRTM_aist.Link.entry(self)
+ print(" Heating on")
+ def exit(self):
+ OpenRTM_aist.Link.exit(self)
+ print(" Heating off")
+ def init(self):
+ OpenRTM_aist.Link.init(self)
+
+
+OpenRTM_aist.FSM_SUBSTATE(Cooking,Programmed)
\ No newline at end of file
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/display.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/display.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/display.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/inputbutton.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/inputbutton.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/inputbutton.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/microwave.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/microwave.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/microwave.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Added: branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/rtc.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/rtc.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist-Python/OpenRTM_aist/python3_examples/StaticFsm/rtc.conf 2017-06-12 04:45:32 UTC (rev 836)
@@ -0,0 +1,40 @@
+corba.nameservers: localhost
+naming.formats: %n.rtc
+logger.enable: YES
+logger.log_level: VERBOSE
+#logger.file_name: STDOUT
+#example.Inputbutton.config_file: inputbutton.conf
+#example.Microwave.config_file: microwave.conf
+#example.Display.config_file: display.conf
+
+
+#manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.base_path: ./
+#manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.file_structure: flat
+#manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.context_delimiter: .
+
+#manager.local_service.modules: \
+# ../../src/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.py(ComponentObserverConsumerInit), \
+# ../../src/ext/sdo/extended_fsm/ComponentObserverProvider.py(ExtendedFsmServiceProviderInit)
+
+manager.modules.load_path: ./
+manager.modules.preload: Microwave.py
+manager.components.precreate: Microwave
+manager.components.preactivation: Inputbutton0, Microwave0
+manager.components.preconnect: \
+ Inputbutton0.open^Microwave0.event(fsm_event_name=open), \
+ Inputbutton0.close^Microwave0.event(fsm_event_name=close), \
+ Inputbutton0.minute^Microwave0.event(fsm_event_name=minute), \
+ Inputbutton0.start^Microwave0.event(fsm_event_name=start), \
+ Inputbutton0.stop^Microwave0.event(fsm_event_name=stop), \
+ Inputbutton0.tick^Microwave0.event(fsm_event_name=tick)
+
+#manager.modules.preload: Display.py
+#manager.components.precreate: Display
+#manager.components.preactivation: Inputbutton0, Display0
+#manager.components.preconnect: \
+# Inputbutton0.open^Display0.in(), \
+# Inputbutton0.close^Display0.in(), \
+# Inputbutton0.minute^Display0.in(), \
+# Inputbutton0.start^Display0.in(), \
+# Inputbutton0.stop^Display0.in(), \
+# Inputbutton0.tick^Display0.in()
\ No newline at end of file
Modified: branches/FSM4RTC/OpenRTM-aist-Python/setup.py
===================================================================
--- branches/FSM4RTC/OpenRTM-aist-Python/setup.py 2017-06-12 04:33:24 UTC (rev 835)
+++ branches/FSM4RTC/OpenRTM-aist-Python/setup.py 2017-06-12 04:45:32 UTC (rev 836)
@@ -211,7 +211,9 @@
"RTC.idl",
"SDOPackage.idl",
"SharedMemory.idl",
- "IORProfile.idl"
+ "IORProfile.idl",
+ "ExtendedFsmService.idl",
+ "DataPort_OpenRTM.idl"
]
baseidl_mods = ["RTM", "RTC", "SDOPackage", "OpenRTM"]
baseidl_path = os.path.normpath(current_dir + "/" + baseidl_dir)
More information about the openrtm-commit
mailing list