[openrtm-commit:02220] r777 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 1月 13日 (金) 18:50:05 JST


Author: miyamoto
Date: 2017-01-13 18:50:05 +0900 (Fri, 13 Jan 2017)
New Revision: 777

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/CorbaConsumer.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/GlobalFactory.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortBase.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/Properties.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py
Log:
[compat,bugfix,->RELENG_1_2] fixed bug.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -117,6 +117,7 @@
     eclist = rtc.get_owned_contexts()
     if ec_id >= len(eclist):
       return RTC.ExecutionContext._nil
+    
     if CORBA.is_nil(eclist[ec_id]):
       return RTC.ExecutionContext._nil
     return eclist[ec_id]

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/CorbaConsumer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/CorbaConsumer.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/CorbaConsumer.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -278,9 +278,14 @@
     if not CorbaConsumerBase.setObject(self, obj):
       self.releaseObject()
       return False
-
+    
     if self._interfaceType:
+      
       self._var = obj._narrow(self._interfaceType)
+      if self._var is None:
+        self.releaseObject()
+        return False
+      
     else:
       self._var = self._objref
     

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -362,11 +362,12 @@
   # RTC::ReturnCode_t setOwner(RTC::LightweightRTObject_ptr comp);
   def setOwner(self, comp):
     self._rtcout.RTC_TRACE("setOwner()")
-    assert(not CORBA.is_nil(comp))
+    if CORBA.is_nil(comp):
+      return RTC.BAD_PARAMETER
     rtobj_ = comp._narrow(RTC.RTObject)
     if CORBA.is_nil(rtobj_):
       self._rtcout.RTC_ERROR("Narrowing failed.")
-      return RTC.BAD_PARAMETER
+      return RTC.RTC_ERROR
 
     guard = OpenRTM_aist.ScopedLock(self._profileMutex)
     self._profile.owner = rtobj_

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/GlobalFactory.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/GlobalFactory.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/GlobalFactory.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -126,7 +126,7 @@
       print "Factory.createObject return None id: ", id
       return None
     obj_ = self._creators[id].creator_()
-    assert(not self._objects.has_key(obj_))
+    #assert(not self._objects.has_key(obj_))
     self._objects[obj_] = self._creators[id]
     return obj_
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortBase.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortBase.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortBase.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -1110,7 +1110,8 @@
     self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
     provider = OpenRTM_aist.InPortProviderFactory.instance().createObject(prop.getProperty("interface_type"))
     
-    if provider != 0:
+    
+    if provider is not None:
       self._rtcout.RTC_DEBUG("provider created")
       provider.init(prop.getNode("provider"))
 
@@ -1149,7 +1150,7 @@
     self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
     consumer = OpenRTM_aist.OutPortConsumerFactory.instance().createObject(prop.getProperty("interface_type"))
     
-    if consumer != 0:
+    if consumer is not None:
       self._rtcout.RTC_DEBUG("consumer created")
       consumer.init(prop.getNode("consumer"))
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -129,10 +129,12 @@
     else:
       self._deleteBuffer = False
 
+    
     if self._buffer == 0:
       self._buffer = self.createBuffer(info)
 
-    if self._buffer == 0 or not self._provider:
+    
+    if self._buffer is None or not self._provider:
       raise
 
     self._buffer.init(info.properties.getNode("buffer"))

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -2473,11 +2473,11 @@
       mo = __import__(import_name)
       sys.path = save_path
       _spec = getattr(mo,import_name.lower()+"_spec",None)
-      _klass = getattr(mo,import_name,None)
-      if _spec and _klass:
+      _class = getattr(mo,import_name,None)
+      if _spec and _class:
         prof = OpenRTM_aist.Properties(defaults_str=_spec)
         self.registerFactory(prof,
-                             _klass,
+                             _class,
                              OpenRTM_aist.Delete)
     except:
       self._rtcout.RTC_ERROR("Module load error: %s", file_name)

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerConfig.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -189,9 +189,9 @@
     prop.setDefaults(OpenRTM_aist.default_config)
     if self.findConfigFile():
       try:
-        fd = file(self._configFile,"r")
-        prop.load(fd)
-        fd.close()
+        with file(self._configFile,"r") as fd:
+          prop.load(fd)
+          fd.close()
       except:
         print OpenRTM_aist.Logger.print_exception()
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -492,8 +492,8 @@
     if len(profs) == 0:
       return OpenRTM_aist.Properties()
 
-    if len(profs) > 1:
-      return None
+    #if len(profs) > 1:
+    #  return None
 
     return profs[0]
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortBase.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -1142,7 +1142,7 @@
     self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
     provider = OpenRTM_aist.OutPortProviderFactory.instance().createObject(prop.getProperty("interface_type"))
     
-    if provider != 0:
+    if provider is not None:
       self._rtcout.RTC_DEBUG("provider created")
       provider.init(prop.getNode("provider"))
 
@@ -1178,7 +1178,7 @@
     self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
     consumer = OpenRTM_aist.InPortConsumerFactory.instance().createObject(prop.getProperty("interface_type"))
     
-    if consumer != 0:
+    if consumer is not None:
       self._rtcout.RTC_DEBUG("consumer created")
       
       consumer.init(prop.getNode("consumer"))

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrConsumer.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -259,10 +259,10 @@
     if OpenRTM_aist.NVUtil.isString(properties,"dataport.corba_cdr.outport_ior"):
       self._rtcout.RTC_DEBUG("dataport.corba_cdr.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())
+      #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)

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/PortBase.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -190,9 +190,9 @@
   def __del__(self):
     self._rtcout.RTC_TRACE("PortBase.__del__()")
     try:
-      mgr = OpenRTM_aist.Manager.instance().getPOA()
-      oid = mgr.servant_to_id(self)
-      mgr.deactivate_object(oid)
+      poa = OpenRTM_aist.Manager.instance().getPOA()
+      oid = poa.servant_to_id(self)
+      poa.deactivate_object(oid)
     except:
       self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
     
@@ -1607,6 +1607,7 @@
   # @endif
   # virtual ReturnCode_t disconnectNext(ConnectorProfile& connector_profile);
   def disconnectNext(self, connector_profile):
+    
     index = OpenRTM_aist.CORBA_SeqUtil.find(connector_profile.ports,
                                             self.find_port_ref(self._profile.port_ref))
     if index < 0:

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Properties.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Properties.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Properties.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -773,8 +773,8 @@
         pline += tmp[0]
         continue
       pline += _str
-      if pline == "":
-        continue
+      #if pline == "":
+      # continue
 
       key = []
       value = []

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -673,6 +673,7 @@
     self._rtcout.RTC_TRACE("pushSkip()")
     try:
       ret = self.PORT_OK
+      
       preskip = self._buffer.readable() + self._leftskip
       loopcnt = preskip/(self._skipn+1)
       postskip = self._skipn - self._leftskip
@@ -693,7 +694,7 @@
         postskip = self._skipn + 1
 
       self._buffer.advanceRptr(self._buffer.readable())
-
+      
       if loopcnt == 0:
         # Not put
         self._leftskip = preskip % (self._skipn + 1)

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -897,8 +897,7 @@
   # virtual ComponentProfile* get_component_profile()
   def get_component_profile(self):
     self._rtcout.RTC_TRACE("get_component_profile()")
-    try:
-      prop_ = RTC.ComponentProfile(self._properties.getProperty("instance_name"),
+    prop_ = RTC.ComponentProfile(self._properties.getProperty("instance_name"),
                                    self._properties.getProperty("type_name"),
                                    self._properties.getProperty("description"),
                                    self._properties.getProperty("version"),
@@ -907,8 +906,8 @@
                                    self._portAdmin.getPortProfileList(),
                                    self._profile.parent,
                                    self._profile.properties) 
-      OpenRTM_aist.NVUtil.copyFromProperties(self._profile.properties, self._properties)
-      return prop_
+    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,
@@ -919,11 +918,11 @@
       #               self._profile.parent,
       #               self._profile.properties)
     
-    except:
-      self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+    #except:
+    #  self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
 
 
-    return None
+    #return None
 
 
   ##
@@ -2274,9 +2273,9 @@
     except:
       self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
       raise SDOPackage.InternalError("get_status()")
-    return any.to_any("")
 
 
+
   #============================================================
   # Local interfaces
   #============================================================
@@ -2866,11 +2865,9 @@
     if ret:
       for inport in self._inports:
         if port == inport:
-          try:
-            self._inports.remove(port)
-          except:
-            self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
-            
+
+          self._inports.remove(port)
+
           return True
 
     return False
@@ -2905,11 +2902,9 @@
     if ret:
       for outport in self._outports:
         if port == outport:
-          try:
-            self._outports.remove(port)
-          except:
-            self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
-            
+
+          self._outports.remove(port)
+          
           return True
 
     return False
@@ -3567,8 +3562,7 @@
         self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
       del self._eclist[idx]
 
-    if self._eclist:
-      self._eclist = []
+
     return
 
 
@@ -4912,11 +4906,11 @@
 
 
       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
+      #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])

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/SdoServiceAdmin.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -380,9 +380,9 @@
     factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
     ctype = str(profile.interface_type)
     consumer = factory.createObject(ctype)
-    if consumer == None:
-      self._rtcout.RTC_ERROR("Hmm... consumer must be created.")
-      return False
+    #if consumer is None:
+    #  self._rtcout.RTC_ERROR("Hmm... consumer must be created.")
+    #  return False
 
     # initialize
     if not consumer.init(self._rtobj, sProfile):

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/StateMachine.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -462,13 +462,13 @@
   def worker(self):
     states = StateHolder()
     self.sync(states)
-
     # If no state transition required, execute set of do-actions
     if states.curr == states.next:
       # pre-do
       if self._predo[states.curr]:
         self._predo[states.curr](states)
 
+      
       if self.need_trans():
         return
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py	2017-01-12 10:26:46 UTC (rev 776)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/StringUtil.py	2017-01-13 09:50:05 UTC (rev 777)
@@ -571,8 +571,8 @@
     elif type(_type[0]) == str:
       _type[0] = str(_str)
       return True
-  except ValueError:
-    return False
+  #except ValueError:
+  #  return False
   except:
     return False
   



More information about the openrtm-commit mailing list