[openrtm-commit:02633] r841 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 6月 13日 (火) 14:46:58 JST


Author: miyamoto
Date: 2017-06-13 14:46:58 +0900 (Tue, 13 Jun 2017)
New Revision: 841

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py
Log:
[compat,->RELENG_1_2] bug fix.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py	2017-06-13 05:44:42 UTC (rev 840)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py	2017-06-13 05:46:58 UTC (rev 841)
@@ -211,20 +211,37 @@
     if not self._buffer:
       return self.PRECONDITION_NOT_MET
 
-    if type(data) == list:
-      ret = self._buffer.read(data)
+    cdr = [""]
+    if self._buffer:
+      ret = self._buffer.read(cdr)
     else:
-      tmp = [data]
-      ret = self._buffer.read(tmp)
+      return self.PRECONDITION_NOT_MET
+    
+
+    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:
+      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 +386,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 +412,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: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2017-06-13 05:44:42 UTC (rev 840)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2017-06-13 05:46:58 UTC (rev 841)
@@ -1170,6 +1170,7 @@
   # @endif
   # RTC::RTObject_ptr create_component_by_mgrname(string module_name)
   def create_component_by_mgrname(self, module_name):
+    
     arg = module_name
     
 
@@ -1220,10 +1221,12 @@
       cmd += " -o " + "manager.name:" + config.getProperty("manager.name")
       cmd += " -o " + "manager.instance_name:" + mgrstr
       cmd += " -o " + "\"manager.modules.load_path:" + load_path + "\""
-      #cmd += " -o " + "manager.supported_languages:" + language
+      cmd += " -o " + "manager.supported_languages:" + language
+      cmd += " -o " + "manager.shutdown_auto:NO"
       
       
       
+      
       self._rtcout.RTC_DEBUG("Invoking command: %s.", cmd)
       
       ret = OpenRTM_aist.launch_shell(cmd)

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-06-13 05:44:42 UTC (rev 840)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-06-13 05:46:58 UTC (rev 841)
@@ -580,7 +580,7 @@
   def addNewFile(self, fpath, modules):
     exists = False
     for modprof in self._modprofs:
-      if modprof == fpath:
+      if modprof.getProperty("module_file_path") == fpath:
         exists = True
         self._rtcout.RTC_DEBUG("Module %s already exists in cache.",fpath)
         break
@@ -627,9 +627,11 @@
         
         try:
           ret = OpenRTM_aist.popen(cmd).split("\r\n")
+          count = 0
           for r in ret:
             pos = r.find(":")
             if r.find(":") != -1:
+              count += 1
               key = r[0:pos]
               tmp = [key]
               OpenRTM_aist.eraseHeadBlank(tmp)
@@ -641,10 +643,11 @@
               value = tmp[0]
 
               prop.setProperty(key, value)
-          self._rtcout.RTC_DEBUG("rtcprof cmd sub process done.")
-          prop.setProperty("module_file_name",os.path.basename(mod_))
-          prop.setProperty("module_file_path", mod_)
-          modprops.append(prop)
+          if count > 0:
+            self._rtcout.RTC_DEBUG("rtcprof cmd sub process done.")
+            prop.setProperty("module_file_name",os.path.basename(mod_))
+            prop.setProperty("module_file_path", mod_)
+            modprops.append(prop)
               
           
         except:
@@ -722,6 +725,7 @@
       modules_ = []
       self.getModuleList(lang, modules_)
       self._rtcout.RTC_DEBUG("%s: %s", (lang, OpenRTM_aist.flatten(modules_)))
+      
 
       tmpprops = []
       self.getModuleProfiles(lang, modules_, tmpprops)

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py	2017-06-13 05:44:42 UTC (rev 840)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py	2017-06-13 05:46:58 UTC (rev 841)
@@ -205,8 +205,10 @@
     else:
       self._rtcout.RTC_ERROR("write(): endian %s is not support.",self._endian)
       return self.UNKNOWN_ERROR
-    
-    self._buffer.write(cdr_data)
+    if self._buffer:
+      self._buffer.write(cdr_data)
+    else:
+      return self.UNKNOWN_ERROR
     return self.PORT_OK
 
 



More information about the openrtm-commit mailing list