[openrtm-commit:02615] r831 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 5月 30日 (火) 11:13:27 JST


Author: miyamoto
Date: 2017-05-30 11:13:27 +0900 (Tue, 30 May 2017)
New Revision: 831

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/DefaultConfiguration.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
Log:
[incompat,new func,->RELENG_1_2] refs #4107

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/DefaultConfiguration.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/DefaultConfiguration.py	2017-05-30 00:30:05 UTC (rev 830)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/DefaultConfiguration.py	2017-05-30 02:13:27 UTC (rev 831)
@@ -71,6 +71,8 @@
                  "corba.nameservers",               "localhost",
                  "corba.master_manager",             "localhost:2810",
                  "corba.nameservice.replace_endpoint", "NO",
+                 "corba.update_master_manager.enable", "YES",
+                 "corba.update_master_manager.interval", "10.0",
                  "exec_cxt.periodic.type",           "PeriodicExecutionContext",
                  "exec_cxt.periodic.rate",           "1000",
                  "exec_cxt.sync_transition",         "YES",

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2017-05-30 00:30:05 UTC (rev 830)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2017-05-30 02:13:27 UTC (rev 831)
@@ -2278,6 +2278,7 @@
     if not OpenRTM_aist.toBool(
       self._config.getProperty("manager.corba_servant"), "YES","NO",True):
       return True
+    
 
     self._mgrservant = OpenRTM_aist.ManagerServant()
     if self._config.getProperty("corba.endpoints_ipv4") == "":
@@ -2291,6 +2292,22 @@
         mgr_name = self.formatString(name, prop)
         self._namingManager.bindManagerObject(mgr_name, self._mgrservant)
 
+
+    
+    if OpenRTM_aist.toBool(self._config.getProperty("corba.update_master_manager.enable"),
+                           "YES", "NO", True) and \
+                           not OpenRTM_aist.toBool(self._config.getProperty("manager.is_master"),
+                                                   "YES", "NO", False):
+      tm = OpenRTM_aist.TimeValue(10, 0)
+      if self._config.findNode("corba.update_master_manager.interval"):
+        duration = float(self._config.getProperty("corba.update_master_manager.interval"))
+        if duration:
+          tm.set_time(duration)
+        if self._timer:
+          self._timer.registerListenerObj(self._mgrservant,
+                                        OpenRTM_aist.ManagerServant.update_master_manager,
+                                        tm)
+
     otherref = None
 
     try:
@@ -2306,6 +2323,8 @@
       else:
         reffile.write(self._orb.object_to_string(self._mgrservant.getObjRef()))
         reffile.close()
+
+
     return True
 
   

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2017-05-30 00:30:05 UTC (rev 830)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py	2017-05-30 02:13:27 UTC (rev 831)
@@ -86,6 +86,11 @@
     return
 
 
+      
+      
+         
+        
+
   ##
   # @if jp
   #
@@ -261,7 +266,7 @@
         except:
           self._rtcout.RTC_ERROR("Unknown exception cought.")
           self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-          self.remove_slave_manager(slave)
+          self._slaves.remove(slave)
 
     return cprof
 
@@ -304,7 +309,7 @@
         except:
           self._rtcout.RTC_ERROR("Unknown exception cought.")
           self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-          self.remove_slave_manager(slave)
+          self._slaves.remove(slave)
 
     return cprof
 
@@ -361,7 +366,7 @@
         except:
           self._rtcout.RTC_ERROR("Unknown exception cought.")
           self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-          self.remove_slave_manager(slave)
+          self._slaves.remove(slave)
       del guard
 
       module_name = module_name + "&manager_name=manager_%p"
@@ -457,7 +462,7 @@
       except:
         self._rtcout.RTC_ERROR("Unknown exception cought.")
         self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-        self.remove_slave_manager(slave)
+        self._slaves.remove(slave)
         #self._rtcout.RTC_INFO("slave (%d) has disappeared.", i)
         #self._slaves[i] = RTM.Manager._nil
 
@@ -503,7 +508,7 @@
       except:
         self._rtcout.RTC_ERROR("Unknown exception cought.")
         self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-        self.remove_slave_manager(slave)
+        self._slaves.remove(slave)
         #self._rtcout.RTC_INFO("slave (%d) has disappeared.", i)
         #self._slaves[i] = RTM.Manager._nil
 
@@ -1043,7 +1048,7 @@
         except:
           self._rtcout.RTC_ERROR("Unknown exception cought.")
           self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-          self.remove_slave_manager(slave)
+          self._slaves.remove(slave)
       del guard
     else:
       guard = OpenRTM_aist.ScopedLock(self._masterMutex)
@@ -1245,7 +1250,7 @@
           except:
             self._rtcout.RTC_ERROR("Unknown exception cought.")
             self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-            self.remove_slave_manager(slave)
+            self._slaves.remove(slave)
             
         del guard_slave
 
@@ -1268,7 +1273,7 @@
             except:
               self._rtcout.RTC_ERROR("Unknown exception cought.")
               self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-              self.remove_slave_manager(slave)
+              self._slaves.remove(slave)
           del guard_slave
           
         else:
@@ -1418,8 +1423,48 @@
       self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
       return RTC.RTObject._nil
 
+  ##
+  # @if jp
+  # @brief ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã¤Î̵ͭ¤ò³Îǧ¤·¤Æ¥ê¥¹¥È¤ò¹¹¿·¤¹¤ë
+  # 
+  # @param self
+  # @else
+  #
+  # @brief 
+  # @param self
+  # @endif
+  # void update_master_manager()
+  def update_master_manager(self):
+    if not self._isMaster and self._objref:
+      guard = OpenRTM_aist.ScopedLock(self._masterMutex)
+      if len(self._masters) > 0:
+        for master in self._masters[:]:
+          try:
+            if master._non_existent():
+              self._masters.remove(master)
+          except:
+            self._rtcout.RTC_ERROR("Unknown exception cought.")
+            self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+            self._masters.remove(master)
+      del guard
+      
+      if len(self._masters) == 0:
+        try:
+          config = self._mgr.getConfig()
+          owner = self.findManager(config.getProperty("corba.master_manager"))
+          if not owner:
+            self._rtcout.RTC_INFO("Master manager not found")
+            return
+          self.add_master_manager(owner)
+          owner.add_slave_manager(self._objref)
+          
+          return
+        except:
+          self._rtcout.RTC_ERROR("Unknown exception cought.")
+          self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
 
 
+
   class is_equiv:
     def __init__(self, mgr):
       self._mgr = mgr

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-05-30 00:30:05 UTC (rev 830)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py	2017-05-30 02:13:27 UTC (rev 831)
@@ -529,6 +529,7 @@
     
     paths.extend(self._loadPath)
     paths = self.deleteSamePath(paths)
+    
 
     suffixes = lprop.getProperty("suffixes").split(",")
 
@@ -559,6 +560,8 @@
         f = f.replace("\\","/")
         self.addNewFile(f, modules)
 
+
+
         
 
   ##



More information about the openrtm-commit mailing list