[openrtm-commit:02222] r778 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 1月 16日 (月) 14:32:59 JST


Author: miyamoto
Date: 2017-01-16 14:32:59 +0900 (Mon, 16 Jan 2017)
New Revision: 778

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py
Log:
[compat,bugfix,->RELENG_1_2] fixed bug.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py	2017-01-13 09:50:05 UTC (rev 777)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py	2017-01-16 05:32:59 UTC (rev 778)
@@ -730,7 +730,7 @@
     if ret_ != RTC.RTC_OK:
       self._rtcout.RTC_ERROR("onWaitingActivated failed.")
       return ret_
-
+    
     cycle_ = int(float(self._activationTimeout.toDouble()) / float(self.getPeriod().toDouble()))
     self._rtcout.RTC_DEBUG("Timeout is %f [s] (%f [s] in %d times)",
                            (float(self._activationTimeout.toDouble()), self.getRate(), cycle_))
@@ -738,6 +738,7 @@
     starttime_ = OpenRTM_aist.Time().gettimeofday()
     
     while rtobj.isCurrentState(RTC.INACTIVE_STATE):
+      
       ret_ = self.onWaitingActivated(rtobj, count_) # Template method
       if ret_ != RTC.RTC_OK:
         self._rtcout.RTC_ERROR("onWaitingActivated failed.")
@@ -830,7 +831,7 @@
         self._rtcout.RTC_ERROR("The component is not responding.")
         break
 
-
+    
     # Now State must be INACTIVE or ERROR
     if rtobj.isCurrentState(RTC.ACTIVE_STATE):
       self._rtcout.RTC_ERROR("Unknown error: Invalid state transition.")

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py	2017-01-13 09:50:05 UTC (rev 777)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py	2017-01-16 05:32:59 UTC (rev 778)
@@ -157,13 +157,11 @@
     if OpenRTM_aist.CorbaConsumer.setObject(self, obj):
       ref_ = self.getObject()
       if ref_:
-        try:
-          inportcdr = ref_._narrow(OpenRTM__POA.PortSharedMemory)
-          self._shmem.setInterface(inportcdr)
-        except:
-          self._rtcout.RTC_WARN("Exception caught from PortSharedMemory.setInterface().")
-          self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
-        
+        inportcdr = ref_._narrow(OpenRTM__POA.PortSharedMemory)
+        if inportcdr is None:
+          return False
+        self._shmem.setInterface(inportcdr)
+
         return True
     return False
       

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2017-01-13 09:50:05 UTC (rev 777)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2017-01-16 05:32:59 UTC (rev 778)
@@ -1071,9 +1071,9 @@
     
 
     eqpos = paramstr.find("=")
-    if eqpos == -1:
-      self._rtcout.RTC_WARN("Invalid argument: %s", module_name)
-      return ""
+    #if eqpos == -1:
+    #  self._rtcout.RTC_WARN("Invalid argument: %s", module_name)
+    #  return ""
 
     paramstr = paramstr[eqpos + 1:]
     self._rtcout.RTC_DEBUG("%s is %s",(param_name, paramstr))

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py	2017-01-13 09:50:05 UTC (rev 777)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py	2017-01-16 05:32:59 UTC (rev 778)
@@ -119,14 +119,12 @@
   def setObject(self, obj):
     if OpenRTM_aist.CorbaConsumer.setObject(self, obj):
       ref_ = self.getObject()
-      try:
-        if ref_:
-          outportcdr = self.getObject()._narrow(OpenRTM__POA.PortSharedMemory)
-          outportcdr.setInterface(self._shmem._this())
-          return True
-      except:
-        self._rtcout.RTC_WARN("Exception caught from PortSharedMemory.setInterface().")
-        self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+      if ref_:
+        outportcdr = self.getObject()._narrow(OpenRTM__POA.PortSharedMemory)
+        if outportcdr is None:
+          return False
+        outportcdr.setInterface(self._shmem._this())
+        return True
     return False
   
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py	2017-01-13 09:50:05 UTC (rev 777)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py	2017-01-16 05:32:59 UTC (rev 778)
@@ -73,10 +73,15 @@
     if platform.system() == "Windows":
       pass
     else:
-      try:
-        self.rt = ctypes.CDLL('librt.so')
-      except:
-        self.rt = ctypes.CDLL('librt.so.1')
+      from ctypes.util import find_library
+      librt = find_library("librt")
+      if librt is None:
+        raise
+      self.rt = ctypes.CDLL(librt)
+      #try:
+      #  self.rt = ctypes.CDLL('librt.so')
+      #except:
+      #  self.rt = ctypes.CDLL('librt.so.1')
       self.rt.shm_open.argtypes = [ctypes.c_char_p, ctypes.c_int, ctypes.c_int]
       self.rt.shm_open.restype = ctypes.c_int
       self.rt.ftruncate.argtypes = [ctypes.c_int, ctypes.c_int]
@@ -232,7 +237,7 @@
         O_RDWR = 2
         self.fd = self.rt.shm_open(self._shm_address,O_RDWR,0)
         if self.fd < 0:
-          return self.UNKNOWN_ERROR
+          return
         self.rt.ftruncate(self.fd, self._memory_size)
         self._shmem = mmap.mmap(self.fd, self._memory_size, mmap.MAP_SHARED)
         self.rt.close( self.fd )



More information about the openrtm-commit mailing list