[openrtm-commit:02118] r743 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2016年 11月 17日 (木) 19:56:31 JST


Author: miyamoto
Date: 2016-11-17 19:56:31 +0900 (Thu, 17 Nov 2016)
New Revision: 743

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
Log:
[compat,bugfix,->RELENG_1_2] fixed bug.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py	2016-11-17 04:30:42 UTC (rev 742)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ConfigurationListener.py	2016-11-17 10:56:31 UTC (rev 743)
@@ -797,41 +797,38 @@
   """
 
   def __init__(self):
-    pass
+    ##
+    # @if jp
+    # @brief ConfigurationParamListenerTypeリスナ配列
+    # ConfigurationParamTypeリスナを格納
+    # @else
+    # @brief ConfigurationParamListenerType listener array
+    # The ConfigurationParamListenerType listener is stored.
+    # @endif
+    self.configparam_num = ConfigurationParamListenerType.CONFIG_PARAM_LISTENER_NUM
+    self.configparam_ = [ConfigurationParamListenerHolder()
+                  for i in range(self.configparam_num)]
 
+    ##
+    # @if jp
+    # @brief ConfigurationSetListenerTypeリスナ配列
+    # ConfigurationSetListenerTypeリスナを格納
+    # @else
+    # @brief ConfigurationSetListenerType listener array
+    # The ConfigurationSetListenerType listener is stored.
+    # @endif
+    self.configset_num = ConfigurationSetListenerType.CONFIG_SET_LISTENER_NUM
+    self.configset_ = [ConfigurationSetListenerHolder()
+                for i in range(self.configset_num)]
 
-  ##
-  # @if jp
-  # @brief ConfigurationParamListenerTypeリスナ配列
-  # ConfigurationParamTypeリスナを格納
-  # @else
-  # @brief ConfigurationParamListenerType listener array
-  # The ConfigurationParamListenerType listener is stored.
-  # @endif
-  configparam_num = ConfigurationParamListenerType.CONFIG_PARAM_LISTENER_NUM
-  configparam_ = [ConfigurationParamListenerHolder()
-                  for i in range(configparam_num)]
-
-  ##
-  # @if jp
-  # @brief ConfigurationSetListenerTypeリスナ配列
-  # ConfigurationSetListenerTypeリスナを格納
-  # @else
-  # @brief ConfigurationSetListenerType listener array
-  # The ConfigurationSetListenerType listener is stored.
-  # @endif
-  configset_num = ConfigurationSetListenerType.CONFIG_SET_LISTENER_NUM
-  configset_ = [ConfigurationSetListenerHolder()
-                for i in range(configset_num)]
-
-  ##
-  # @if jp
-  # @brief ConfigurationSetNameListenerTypeリスナ配列
-  # ConfigurationSetNameListenerTypeリスナを格納
-  # @else
-  # @brief ConfigurationSetNameListenerType listener array
-  # The ConfigurationSetNameListenerType listener is stored. 
-  # @endif
-  configsetname_num = ConfigurationSetNameListenerType.CONFIG_SET_NAME_LISTENER_NUM
-  configsetname_ = [ConfigurationSetNameListenerHolder()
-                    for i in range(configsetname_num)]
+    ##
+    # @if jp
+    # @brief ConfigurationSetNameListenerTypeリスナ配列
+    # ConfigurationSetNameListenerTypeリスナを格納
+    # @else
+    # @brief ConfigurationSetNameListenerType listener array
+    # The ConfigurationSetNameListenerType listener is stored. 
+    # @endif
+    self.configsetname_num = ConfigurationSetNameListenerType.CONFIG_SET_NAME_LISTENER_NUM
+    self.configsetname_ = [ConfigurationSetNameListenerHolder()
+                    for i in range(self.configsetname_num)]

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2016-11-17 04:30:42 UTC (rev 742)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2016-11-17 10:56:31 UTC (rev 743)
@@ -1072,6 +1072,7 @@
     
     ec = OpenRTM_aist.ExecutionContextFactory.instance().createObject(ec_id[0])
     ec.init(ec_prop)
+    self._ecs.append(ec)
     return ec
     
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py	2016-11-17 04:30:42 UTC (rev 742)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py	2016-11-17 10:56:31 UTC (rev 743)
@@ -697,7 +697,7 @@
   #
   def onInitialize(self):
     self._rtcout.RTC_TRACE("onInitialize()")
-    return RTC.RTC_OK
+    
     active_set = self._properties.getProperty("configuration.active_config",
                                               "default")
     if self._configsets.haveConfig(active_set):
@@ -769,7 +769,9 @@
 
     for sdo in sdos:
       rtc = sdo._narrow(RTC.RTObject)
-      ecs[0].activate_component(rtc)
+      #ecs[0].activate_component(rtc)
+      therad = MemberComponentThread(rtc, ecs[0].activate_component)
+      therad.activate()
 
     len_ = len(self._members[0])
 
@@ -781,7 +783,7 @@
       str_ = "was"
 
     self._rtcout.RTC_DEBUG("%d member RTC%s activated.", (len_, str_))
-
+    
     return RTC.RTC_OK
 
 
@@ -823,7 +825,9 @@
 
     for sdo in sdos:
       rtc = sdo._narrow(RTC.RTObject)
-      ecs[0].deactivate_component(rtc)
+      #ecs[0].deactivate_component(rtc)
+      therad = MemberComponentThread(rtc, ecs[0].deactivate_component)
+      therad.activate()
 
     return RTC.RTC_OK
 
@@ -865,7 +869,9 @@
 
     for sdo in sdos:
       rtc = sdo._narrow(RTC.RTObject)
-      ecs[0].reset_component(rtc)
+      #ecs[0].reset_component(rtc)
+      therad = MemberComponentThread(rtc, ecs[0].reset_component)
+      therad.activate()
 
     return RTC.RTC_OK
 
@@ -901,7 +907,18 @@
     return RTC.RTC_OK
 
 
+
+class MemberComponentThread(OpenRTM_aist.Task):
+  def __init__(self, rto, func):
+    OpenRTM_aist.Task.__init__(self)
+    self.rto = rto
+    self.func = func
+  def svc(self):
+    self.func(self.rto)
     
+
+
+    
 def PeriodicECSharedCompositeInit(manager):
   profile = OpenRTM_aist.Properties(defaults_str=periodicecsharedcomposite_spec)
   manager.registerFactory(profile,

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py	2016-11-17 04:30:42 UTC (rev 742)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py	2016-11-17 10:56:31 UTC (rev 743)
@@ -508,6 +508,7 @@
   #
   # @endif
   def add_component(self, comp):
+    print "add"
     return OpenRTM_aist.ExecutionContextBase.addComponent(self, comp)
 
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py	2016-11-17 04:30:42 UTC (rev 742)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py	2016-11-17 10:56:31 UTC (rev 743)
@@ -864,7 +864,7 @@
 
     num = OpenRTM_aist.CORBA_SeqUtil.find(self._ecOther, self.ec_find(cxt))
     if num != -1:
-      return long(num)
+      return long(num) + 1000
 
     return long(-1)
 
@@ -3907,6 +3907,7 @@
         return
 
     listener = Noname(memfunc)
+    
     self._actionListeners.portaction_[listener_type].addListener(listener, autoclean)
     return listener
 
@@ -4898,13 +4899,8 @@
                                  OpenRTM_aist.flatten(avail_ec_))
           return RTC.RTC_ERROR
         
-      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
       
+      
       default_opts = OpenRTM_aist.Properties()
       prop_ = default_prop.findNode("exec_cxt.periodic")
       if not prop_:
@@ -4934,6 +4930,13 @@
           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])



More information about the openrtm-commit mailing list