[openrtm-commit:03336] r1030 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 10月 8日 (月) 09:15:05 JST


Author: miyamoto
Date: 2018-10-08 09:15:05 +0900 (Mon, 08 Oct 2018)
New Revision: 1030

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
Log:
[compat, bugfix] fixed bug.

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py	2018-10-05 10:17:29 UTC (rev 1029)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/CORBA_RTCUtil.py	2018-10-08 00:15:05 UTC (rev 1030)
@@ -832,7 +832,10 @@
 # RTC::ConnectorProfile_var create_connector(const std::string name,const coil::Properties prop_arg,const RTC::PortService_ptr port0,const RTC::PortService_ptr port1)
 def create_connector(name, prop_arg, port0, port1):
   prop = prop_arg
-  conn_prof = RTC.ConnectorProfile(name, "", [port0, port1],[])
+  if CORBA.is_nil(port1):
+    conn_prof = RTC.ConnectorProfile(name, "", [port0],[])
+  else:
+    conn_prof = RTC.ConnectorProfile(name, "", [port0, port1],[])
 
 
 
@@ -912,10 +915,11 @@
 def connect(name, prop, port0, port1):
   if CORBA.is_nil(port0):
     return RTC.BAD_PARAMETER
-  if CORBA.is_nil(port1):
-    return RTC.BAD_PARAMETER
-  if port0._is_equivalent(port1):
-    return RTC.BAD_PARAMETER
+  #if CORBA.is_nil(port1):
+  #  return RTC.BAD_PARAMETER
+  if not CORBA.is_nil(port1):
+    if port0._is_equivalent(port1):
+      return RTC.BAD_PARAMETER
   cprof = create_connector(name, prop, port0, port1)
   return port0.connect(cprof)[0]
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py	2018-10-05 10:17:29 UTC (rev 1029)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py	2018-10-08 00:15:05 UTC (rev 1030)
@@ -70,10 +70,10 @@
     self._rtcout.RTC_DEBUG("Actual rate: %d [sec], %d [usec]",
                            (self._period.sec(), self._period.usec()))
     self._profileMutex = threading.RLock()
-    self._ref = None
+    self._ref = RTC.ExecutionContext._nil
     self._profile = RTC.ExecutionContextProfile(RTC.PERIODIC,
                                                 (1.0/self._period.toDouble()),
-                                                None, [], [])
+                                                RTC.DataFlowComponent._nil, [], [])
     return
 
 
@@ -93,10 +93,10 @@
     self._rtcout.RTC_TRACE("exit")
 
     # cleanup EC's profile
-    self._profile.owner = None
+    self._profile.owner = RTC.DataFlowComponent._nil
     self._profile.participants = []
     self._profile.properties = []
-    self._ref = None
+    self._ref = RTC.ExecutionContext._nil
     return
 
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2018-10-05 10:17:29 UTC (rev 1029)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2018-10-08 00:15:05 UTC (rev 1030)
@@ -3096,6 +3096,7 @@
 
       ports = []
       configs = {}
+      
       for k,p in param.items():
         if k == "port":
           ports.append(p)
@@ -3102,15 +3103,15 @@
           continue
         tmp = k.replace("port","")
         v = [0]
-        if OpenRTM_aist.stringTo(v, tmp):
+        if OpenRTM_aist.stringTo(v, tmp) and k.find("port") != -1:
           ports.append(p)
           continue
         configs[k] = p
 
-      if len(ports) == 0:
-        self._rtcout.RTC_ERROR("Invalid format for pre-connection.")
-        self._rtcout.RTC_ERROR("Format must be Comp0.port0?port=Comp1.port1")
-        continue
+      #if len(ports) == 0:
+      #  self._rtcout.RTC_ERROR("Invalid format for pre-connection.")
+      #  self._rtcout.RTC_ERROR("Format must be Comp0.port0?port=Comp1.port1")
+      #  continue
     
       if not ("dataflow_type" in configs.keys()):
         configs["dataflow_type"] = "push"
@@ -3150,6 +3151,17 @@
         self._rtcout.RTC_DEBUG("port %s found: " % port0_str)
         continue
 
+      if len(ports) == 0:
+        prop = OpenRTM_aist.Properties()
+        
+        for k,v in configs.items():
+          k = k.strip()
+          v = v.strip()
+          prop.setProperty("dataport."+k,v)
+
+        if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(c, prop, port0_var, RTC.PortService._nil):
+          self._rtcout.RTC_ERROR("Connection error: %s" % c)
+
       for port_str in ports:
       
         tmp = port_str.split(".")



openrtm-commit メーリングリストの案内