[openrtm-commit:02098] r732 - trunk/OpenRTM-aist-Python/OpenRTM_aist
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 11月 1日 (火) 17:26:42 JST
Author: miyamoto
Date: 2016-11-01 17:26:42 +0900 (Tue, 01 Nov 2016)
New Revision: 732
Modified:
trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortDirectProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.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
trunk/OpenRTM-aist-Python/OpenRTM_aist/NamingManager.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortConnector.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortDirectProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py
trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.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 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -621,22 +621,23 @@
# RTC::ReturnCode_t ExecutionContextBase::
# addComponent(RTC::LightweightRTObject_ptr comp)
def addComponent(self, comp):
+
self._rtcout.RTC_TRACE("addComponent()")
ret_ = self.onAddingComponent(comp) # Template
if ret_ != RTC.RTC_OK:
self._rtcout.RTC_ERROR("Error: onAddingComponent(). RTC is not attached.")
return ret_
-
+
ret_ = self._worker.addComponent(comp) # Actual addComponent()
if ret_ != RTC.RTC_OK:
self._rtcout.RTC_ERROR("Error: ECWorker addComponent() faild.")
return ret_
-
+
ret_ = self._profile.addComponent(comp) # Actual addComponent()
if ret_ != RTC.RTC_OK:
self._rtcout.RTC_ERROR("Error: ECProfile addComponent() faild.")
return ret_
-
+
ret_ = self.onAddedComponent(comp) # Template
if ret_ != RTC.RTC_OK:
self._rtcout.RTC_ERROR("Error: onAddedComponent() faild.")
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortCorbaCdrProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -116,9 +116,22 @@
# @endif
#
def __del__(self):
+ return
+
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
oid = OpenRTM_aist.Manager.instance().getPOA().servant_to_id(self)
OpenRTM_aist.Manager.instance().getPOA().deactivate_object(oid)
- return
## virtual void init(coil::Properties& prop);
def init(self, prop):
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortDirectProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortDirectProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortDirectProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -91,7 +91,20 @@
def __del__(self):
return
-
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
+ pass
+
## void init(coil::Properties& prop);
def init(self, prop):
pass
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -58,9 +58,22 @@
self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("InPortProvider")
self._connector = None
-
##
# @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
+ pass
+
+ ##
+ # @if jp
# @brief InterfaceProfile情報を公開する
#
# InterfaceProfile情報を公開する。
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortPushConnector.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -258,7 +258,9 @@
if self._provider:
cfactory = OpenRTM_aist.InPortProviderFactory.instance()
cfactory.deleteObject(self._provider)
-
+
+ self._provider.exit()
+
self._provider = 0
# delete buffer
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -101,13 +101,23 @@
# @endif
#
def __del__(self):
+ return
+
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
oid = OpenRTM_aist.Manager.instance().getPOA().servant_to_id(self)
OpenRTM_aist.Manager.instance().getPOA().deactivate_object(oid)
-
-
- return
-
# void init(coil::Properties& prop)
def init(self, prop):
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -26,7 +26,6 @@
import OpenRTM_aist
import RTC
import SDOPackage
-import CosNaming
#------------------------------------------------------------
@@ -438,10 +437,17 @@
if self._initProc:
self._initProc(self)
- self.initPreCreation()
- self.initPreActivation()
- self.initPreConnection()
+ comps = [s.strip() for s in self._config.getProperty("manager.components.precreate").split(",")]
+ for i in range(len(comps)):
+ if comps[i] is None or comps[i] == "":
+ continue
+ tmp = [comps[i]]
+ OpenRTM_aist.eraseHeadBlank(tmp)
+ OpenRTM_aist.eraseTailBlank(tmp)
+ comps[i] = tmp[0]
+ self.createComponent(comps[i])
+
return True
@@ -650,13 +656,7 @@
def registerFactory(self, profile, new_func, delete_func):
self._rtcout.RTC_TRACE("Manager.registerFactory(%s)", profile.getProperty("type_name"))
try:
- policy_name = self._config.getProperty("manager.components.naming_policy")
-
- if not policy_name:
- policy_name = "process_unique"
- policy = OpenRTM_aist.NumberingPolicyFactory.instance().createObject(policy_name)
-
- factory = OpenRTM_aist.FactoryPython(profile, new_func, delete_func, policy)
+ factory = OpenRTM_aist.FactoryPython(profile, new_func, delete_func)
self._factory.registerObject(factory)
return True
except:
@@ -714,13 +714,22 @@
# @endif
def registerECFactory(self, name, new_func, delete_func):
self._rtcout.RTC_TRACE("Manager.registerECFactory(%s)", name)
- try:
+ """try:
self._ecfactory.registerObject(OpenRTM_aist.ECFactoryPython(name, new_func, delete_func))
return True
except:
self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
return False
-
+ """
+ try:
+ OpenRTM_aist.ExecutionContextFactory.instance().addFactory(name,
+ new_func,
+ delete_func)
+ return True
+ except:
+ self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+ return False
+
return False
@@ -903,10 +912,6 @@
if self._config.findNode(inherit_prop[i]):
prop.setProperty(inherit_prop[i],self._config.getProperty(inherit_prop[i]))
- prop_ = prop.getNode("port")
- prop_.mergeProperties(self._config.getNode("port"))
-
-
comp = factory.create(self)
if comp is None:
@@ -951,6 +956,13 @@
comp_id.getProperty("implementation_id"))
self._listeners.rtclifecycle_.postInitialize()
self.registerComponent(comp)
+
+ poa = self._orb.resolve_initial_references("omniINSPOA")
+ poa._get_the_POAManager().activate()
+ id = comp.getCategory()+"/"+comp.getInstanceName()
+
+ poa.activate_object_with_id(id, comp)
+
return comp
@@ -982,20 +994,6 @@
self._namingManager.bindObject(name, comp)
self._listeners.naming_.postBind(comp, names)
- self.publishPorts(comp)
- self.subscribePorts(comp)
-
- try:
- poa = self._orb.resolve_initial_references("omniINSPOA")
- poa._get_the_POAManager().activate()
- id = comp.getCategory() + "/" + comp.getInstanceName()
- poa.activate_object_with_id(id, comp)
-
- except:
- self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-
-
-
return True
@@ -1024,16 +1022,6 @@
self._namingManager.unbindObject(name)
self._listeners.naming_.postUnbind(comp, names)
- try:
- poa = self._orb.resolve_initial_references("omniINSPOA")
- poa._get_the_POAManager().activate()
- id = comp.getCategory() + "/" + comp.getInstanceName()
- poa.deactivate_object(id)
- except:
- self._rtcout.RTC_DEBUG(OpenRTM_aist.Logger.print_exception())
-
-
-
return True
@@ -1061,13 +1049,19 @@
if not self.procContextArgs(ec_args, ec_id, ec_prop):
return None
- factory = self._ecfactory.find(ec_id[0])
+ #factory = self._ecfactory.find(ec_id[0])
- if factory == None:
+ avail_ec_ = OpenRTM_aist.ExecutionContextFactory.instance().getIdentifiers()
+
+
+ #if factory == None:
+ if not ec_id[0] in avail_ec_:
self._rtcout.RTC_ERROR("Factory not found: %s", ec_id[0])
return None
- ec = factory.create()
+ #ec = factory.create()
+ ec = OpenRTM_aist.ExecutionContextFactory.instance().createObject(ec_id[0])
+ ec.init(ec_prop)
return ec
@@ -1357,21 +1351,6 @@
OpenRTM_aist.Manager.cleanupComponents,
tm)
-
- lmpm_ = [s.strip() for s in self._config.getProperty("manager.preload.modules").split(",")]
- for mpm_ in lmpm_:
- tmp = [mpm_]
- OpenRTM_aist.eraseHeadBlank(tmp)
- OpenRTM_aist.eraseTailBlank(tmp)
- mpm_ = tmp[0]
- if len(mpm_) == 0:
- continue
- basename_ = mpm_.split(".")[0]+"Init"
- try:
- self._module.load(mpm_, basename_)
- except:
- self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
-
return
@@ -1535,7 +1514,6 @@
args = OpenRTM_aist.split(self.createORBOptions(), " ")
args.insert(0,"manager")
argv = OpenRTM_aist.toArgv(args)
-
self._orb = CORBA.ORB_init(argv)
self._poa = self._orb.resolve_initial_references("RootPOA")
@@ -1727,6 +1705,7 @@
if self._orb:
try:
self._orb.shutdown(True)
+ self._orb.destroy()
self._rtcout.RTC_DEBUG("ORB was shutdown.")
self._orb = CORBA.Object._nil
except CORBA.SystemException, ex:
@@ -1803,13 +1782,12 @@
def shutdownNaming(self):
self._rtcout.RTC_TRACE("Manager.shutdownNaming()")
comps = self.getComponents()
-
for comp in comps:
names = comp.getNamingNames()
- self._listeners.naming_.preUnbind(comp, names);
+ self._listeners.naming_.preUnbind(comp, names)
for name in names:
self._namingManager.unbindObject(name)
- self._listeners.naming_.postUnbind(comp, names);
+ self._listeners.naming_.postUnbind(comp, names)
self._namingManager.unbindAll()
return
@@ -1980,6 +1958,7 @@
#
# @endif
def shutdownComponents(self):
+
self._rtcout.RTC_TRACE("Manager.shutdownComponents()")
comps = self._namingManager.getObjects()
for comp in comps:
@@ -1997,6 +1976,7 @@
except:
self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
pass
+
##
@@ -2038,6 +2018,7 @@
guard = OpenRTM_aist.ScopedLock(self._finalized.mutex)
self._rtcout.RTC_VERBOSE("%d components are marked as finalized.",
len(self._finalized.comps))
+
for _comp in self._finalized.comps:
self.deleteComponent(comp=_comp)
@@ -2434,435 +2415,9 @@
return
-
-
-
- ##
- # @if jp
- #
- # @brief 指定したRTコンポーネントの保持するポートをNamingServiceにバインドする
- # ポートのpublish_topicというプロパティでトピック名を設定し、トピック名のコンテキストの下に登録
- #
- #
- # @param self
- # @param comp RTコンポーネント
- #
- # @else
- #
- # @brief
- # @param self
- # @param comp
- #
- # @endif
- # void publishPorts(RTObject_impl* comp)
- def publishPorts(self, comp):
- ports = comp.get_ports()
- for p in ports:
- prof = p.get_port_profile()
- prop = OpenRTM_aist.Properties()
- OpenRTM_aist.NVUtil.copyToProperties(prop, prof.properties)
-
- if (prop.hasKey("publish_topic") is None or not str(prop.getProperty("publish_topic"))) and (prop.hasKey("subscribe_topic") is None or not str(prop.getProperty("subscribe_topic"))) and (prop.hasKey("rendezvous_point") is None or not str(prop.getProperty("rendezvous_point"))):
- continue
-
-
- if prop.getProperty("port.port_type") == "DataOutPort":
- name = "dataports.port_cxt/"
- name += str(prop.getProperty("publish_topic")) + ".topic_cxt/"
- name += prof.name
- name += ".outport"
- elif prop.getProperty("port.port_type") == "DataInPort":
- name = "dataports.port_cxt/"
- name += str(prop.getProperty("publish_topic")) + ".topic_cxt/"
- name += prof.name
- name += ".inport"
- elif prop.getProperty("port.port_type") == "CorbaPort":
- name = "svcports.port_cxt/"
- name += str(prop.getProperty("publish_topic")) + ".topic_cxt/"
- name += prof.name
- name += ".svc"
-
- else:
-
- self._rtcout.RTC_WARN("Unknown port type: %s" % str(prop.getProperty("port.port_type")))
- continue
-
-
- port = self._poa.reference_to_servant(p)
-
- self._namingManager.bindPortObject(name, port)
-
- ##
- # @if jp
- #
- # @brief 指定したRTコンポーネントの保持するポートを同じトピック名以下の接続可能なポートと接続
- #
- #
- # @param self
- # @param comp RTコンポーネント
- #
- # @else
- #
- # @brief
- # @param self
- # @param comp
- #
- # @endif
- # void subscribePorts(RTObject_impl* comp)
- def subscribePorts(self, comp):
- ports = comp.get_ports()
-
- for p in ports:
-
- prof = p.get_port_profile()
- prop = OpenRTM_aist.Properties()
- OpenRTM_aist.NVUtil.copyToProperties(prop, prof.properties)
-
- if (prop.hasKey("publish_topic") is None or not str(prop.getProperty("publish_topic"))) and (prop.hasKey("subscribe_topic") is None or not str(prop.getProperty("subscribe_topic"))) and (prop.hasKey("rendezvous_point") is None or not str(prop.getProperty("rendezvous_point"))):
- continue
-
-
-
-
- if prop.getProperty("port.port_type") == "DataOutPort":
- name = "dataports.port_cxt/"
- name += str(prop.getProperty("publish_topic")) + ".topic_cxt"
-
- nsports = self.getPortsOnNameServers(name, "inport")
-
- self.connectDataPorts(p, nsports)
-
- elif prop.getProperty("port.port_type") == "DataInPort":
- name = "dataports.port_cxt/"
- name += str(prop.getProperty("publish_topic")) + ".topic_cxt"
- nsports = self.getPortsOnNameServers(name, "outport")
- self.connectDataPorts(p, nsports)
-
- elif prop.getProperty("port.port_type") == "CorbaPort":
- name = "svcports.port_cxt/"
- name += str(prop.getProperty("publish_topic")) + ".topic_cxt"
- nsports = self.getPortsOnNameServers(name, "svc")
- self.connectServicePorts(p, nsports)
-
- ##
- # @if jp
- #
- # @brief 与えられたパス以下の指定されたkindのポートを取得する
- #
- # @param self
- # @param nsname パス
- # @param kind kind
- # @return ポートのオブジェクトリファレンスのリスト
- #
- # @else
- #
- # @brief
- # @param self
- # @param nsname
- # @param kind
- # @return
- #
- # @endif
- # PortServiceList_var getPortsOnNameServers(std::string nsname,std::string kind)
- def getPortsOnNameServers(self, nsname, kind):
- ports = []
- ns = self._namingManager.getNameServices()
- for n in ns:
- noc = n.ns
- if noc is None:
- continue
- cns = noc._cosnaming
- if cns is None:
- continue
-
- bl = cns.listByKind(nsname,kind)
-
- for b in bl:
- if b.binding_type != CosNaming.nobject:
- continue
- tmp = b.binding_name[0].id + "." + b.binding_name[0].kind
-
- nspath = "/" + nsname + "/" + tmp
- nspath.replace("\\","")
-
- obj = cns.resolveStr(nspath)
- portsvc = obj
-
- if CORBA.is_nil(portsvc):
- continue
-
- try:
- p = portsvc.get_port_profile()
-
- except:
- continue
- ports.append(portsvc)
-
- return ports
-
- ##
- # @if jp
- # @brief 指定したデータポートを指定したリスト内のデータポート全てと接続する
- # @param self
- # @param port 対象のデータポート
- # @param target_ports 接続対象のデータポートのリスト
- # @else
- #
- # @brief
- # @param self
- # @param port
- # @param target_ports
- # @endif
- # void connectDataPorts(PortService_ptr port,PortServiceList_var& target_ports)
- def connectDataPorts(self, port, target_ports):
- for p in target_ports:
- if port._is_equivalent(p):
- continue
- con_name = ""
- p0 = port.get_port_profile()
- p1 = p.get_port_profile()
- con_name += p0.name
- con_name += ":"
- con_name += p1.name
- prop = OpenRTM_aist.Properties()
- if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(con_name,prop,port,p):
- self._rtcout.RTC_ERROR("Connection error in topic connection.")
-
-
- ##
- # @if jp
- # @brief 指定したサービスポートを指定したリスト内のサービスポート全てと接続する
- # @param self
- # @param port 対象のサービスポート
- # @param target_ports 接続対象のサービスポートのリスト
- # @else
- #
- # @brief
- # @param self
- # @param port
- # @param target_ports
- # @endif
- # void connectServicePorts(PortService_ptr port,PortServiceList_var& target_ports)
- def connectServicePorts(self, port, target_ports):
- for p in target_ports:
- if port._is_equivalent(p):
- continue
- con_name = ""
- p0 = port.get_port_profile()
- p1 = p.get_port_profile()
- con_name += p0.name
- con_name += ":"
- con_name += p1.name
- prop = OpenRTM_aist.Properties()
- if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(con_name,prop,port,p):
- self._rtcout.RTC_ERROR("Connection error in topic connection.")
-
-
- ##
- # @if jp
- # @brief 起動時にrtc.confで指定したポートを接続する
- # 例:
- # manager.components.preconnect: RTC0.port0^RTC0.port1(interface_type=corba_cdr&dataflow_type=pull&~),~
- # @param self
- # @else
- #
- # @brief
- # @param self
- # @endif
- # void initPreConnection()
- def initPreConnection(self):
- self._rtcout.RTC_TRACE("Connection pre-creation: %s" % str(self._config.getProperty("manager.components.preconnect")))
- connectors = str(self._config.getProperty("manager.components.preconnect")).split(",")
-
- for c in connectors:
- tmp = [c]
- OpenRTM_aist.eraseHeadBlank(tmp)
- OpenRTM_aist.eraseTailBlank(tmp)
- c = tmp[0]
- if len(c) == 0:
- continue
- conn_prop = c.split("(")
- if len(conn_prop) < 2:
- self._rtcout.RTC_ERROR("Invalid format for pre-connection.")
- continue
- conn_prop[1] = conn_prop[1].replace(")","")
- comp_ports = conn_prop[0].split("^")
- if len(comp_ports) != 2:
- self._rtcout.RTC_ERROR("Invalid format for pre-connection.")
- self._rtcout.RTC_ERROR("Format must be Comp0.port0:Comp1.port1")
- continue
-
- comp0_name = comp_ports[0].split(".")[0]
- port0_name = comp_ports[0]
-
- if comp0_name.find("://") == -1:
- comp0 = self.getComponent(comp0_name)
- if comp0 is None:
- self._rtcout.RTC_ERROR("%s not found." % comp0_name)
- continue
- comp0_ref = comp0.getObjRef()
- else:
- rtcs = self._namingManager.string_to_component(comp0_name)
-
- if len(rtcs) == 0:
- self._rtcout.RTC_ERROR("%s not found." % comp0_name)
- continue
- comp0_ref = rtcs[0]
- port0_name = comp_ports[0].split("/")[-1]
-
-
-
- port0_var = OpenRTM_aist.CORBA_RTCUtil.get_port_by_name(comp0_ref, port0_name)
-
- if CORBA.is_nil(port0_var):
- self._rtcout.RTC_DEBUG("port %s found: " % comp_ports[0])
- continue
-
- comp1_name = comp_ports[1].split(".")[0]
- port1_name = comp_ports[1]
-
-
-
-
- if comp1_name.find("://") == -1:
- comp1 = self.getComponent(comp1_name)
- if comp1 is None:
- self._rtcout.RTC_ERROR("%s not found." % comp1_name)
- continue
- comp1_ref = comp1.getObjRef()
- else:
- rtcs = self._namingManager.string_to_component(comp1_name)
-
- if len(rtcs) == 0:
- self._rtcout.RTC_ERROR("%s not found." % comp1_name)
- continue
- comp1_ref = rtcs[0]
- port1_name = comp_ports[1].split("/")[-1]
-
-
- port1_var = OpenRTM_aist.CORBA_RTCUtil.get_port_by_name(comp1_ref, port1_name)
-
- if CORBA.is_nil(port1_var):
- self._rtcout.RTC_DEBUG("port %s found: " % comp_ports[1])
- continue
-
- prop = OpenRTM_aist.Properties()
- opt_props = conn_prop[1].split("&")
- for o in opt_props:
- temp = o.split("=")
- if len(temp) == 2:
- prop.setProperty("dataport."+temp[0],temp[1])
-
- if RTC.RTC_OK != OpenRTM_aist.CORBA_RTCUtil.connect(c, prop, port0_var, port1_var):
- self._rtcout.RTC_ERROR("Connection error: %s" % c)
-
-
-
-
- ##
- # @if jp
- # @brief 起動時にrtc.confで指定したRTCをアクティベーションする
- # 例:
- # manager.components.preactivation: RTC1,RTC2~
- # @param self
- # @else
- #
- # @brief
- # @param self
- # @endif
- # void initPreActivation()
- def initPreActivation(self):
-
- self._rtcout.RTC_TRACE("Components pre-activation: %s" % str(self._config.getProperty("manager.components.preactivation")))
- comps = str(self._config.getProperty("manager.components.preactivation")).split(",")
- for c in comps:
- tmp = [c]
- OpenRTM_aist.eraseHeadBlank(tmp)
- OpenRTM_aist.eraseTailBlank(tmp)
- c = tmp[0]
- if c:
- if c.find("://") == -1:
- comp = self.getComponent(c)
- if comp is None:
- self._rtcout.RTC_ERROR("%s not found." % c)
- continue
- comp_ref = comp.getObjRef()
- else:
- rtcs = self._namingManager.string_to_component(c)
- if len(rtcs) == 0:
- self._rtcout.RTC_ERROR("%s not found." % c)
- continue
- comp_ref = rtcs[0]
- ret = OpenRTM_aist.CORBA_RTCUtil.activate(comp_ref)
- if ret != RTC.RTC_OK:
- self._rtcout.RTC_ERROR("%s activation filed." % c)
- else:
- self._rtcout.RTC_INFO("%s activated." % c)
-
-
- ##
- # @if jp
- # @brief 起動時にrtc.confで指定したRTCを生成する
- # 例:
- # manager.components.precreate RTC1,RTC2~
- # @param self
- # @else
- #
- # @brief
- # @param self
- # @endif
- # void initPreCreation()
- def initPreCreation(self):
- comps = [s.strip() for s in self._config.getProperty("manager.components.precreate").split(",")]
- for i in range(len(comps)):
- if comps[i] is None or comps[i] == "":
- continue
- tmp = [comps[i]]
- OpenRTM_aist.eraseHeadBlank(tmp)
- OpenRTM_aist.eraseTailBlank(tmp)
- comps[i] = tmp[0]
-
- self.createComponent(comps[i])
-
- ##
- # @if jp
- # @brief ManagerServantを取得する
- #
- #
- # @param self
- # @return ManagerServant
- # @else
- #
- # @brief
- # @param self
- # @return
- # @endif
- # ManagerServant* getManagerServant()
- def getManagerServant(self):
- self._rtcout.RTC_TRACE("Manager.getManagerServant()")
- return self._mgrservant
-
-
- ##
- # @if jp
- # @brief NamingManagerを取得する
- #
- #
- # @param self
- # @return NamingManager
- # @else
- #
- # @brief
- # @param self
- # @return
- # @endif
- # NamingManager* getNaming()
def getNaming(self):
- self._rtcout.RTC_TRACE("Manager.getNaming()")
return self._namingManager
-
-
#============================================================
# コンポーネントマネージャ
#============================================================
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ManagerServant.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -930,7 +930,9 @@
name = tmp[0]
rtc_name = name.split("/")
for rtc in rtcs:
- if len(rtc_name) == 1:
+ if len(rtc_name) == 0:
+ pass
+ elif len(rtc_name) == 1:
if rtc.getInstanceName() == rtc_name[0]:
crtcs.append(rtc.getObjRef())
else:
@@ -944,7 +946,7 @@
-
+
return crtcs
##
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -290,14 +290,18 @@
if pathChanged:
sys.path = save_path
+ file_path = file_path.replace("\\","/")
+ file_path = file_path.replace("//","/")
+
dll = self.DLLEntity(mo,OpenRTM_aist.Properties())
dll.properties.setProperty("file_path",file_path)
self._modules.registerObject(dll)
+
-
if init_func is None:
return file_name
+
self.symbol(file_path,init_func)(self._mgr)
return file_name
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/NamingManager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/NamingManager.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/NamingManager.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -796,6 +796,7 @@
guard = OpenRTM_aist.ScopedLock(self._compNamesMutex)
len_ = len(self._compNames)
+
for i in range(len_):
idx = (len_ - 1) - i
self.unbindObject(self._compNames[idx].name)
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortConnector.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortConnector.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -56,7 +56,7 @@
def __init__(self, info):
self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("OutPortConnector")
self._profile = info
- self._endian = None
+ self._endian = True
return
##
@@ -126,7 +126,7 @@
return self.profile().name
- # void setConnectorInfo(ConnectorInfo info);
+ # ReturnCode_t setConnectorInfo(ConnectorInfo info);
def setConnectorInfo(self, info):
self._profile = info
@@ -144,7 +144,7 @@
elif endian == "big":
self._endian = False
else:
- self._endian = None
+ return RTC.RTC_ERROR
else:
self._endian = True # little endian
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortCorbaCdrProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -103,11 +103,23 @@
# @endif
#
def __del__(self):
+ return
+
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
oid = self._default_POA().servant_to_id(self)
self._default_POA().deactivate_object(oid)
- return
-
##
# @if jp
# @brief 設定初期化
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortDirectProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortDirectProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortDirectProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -83,7 +83,19 @@
return
-
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
+ pass
# void init(coil::Properties& prop);
def init(self, prop):
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -82,6 +82,19 @@
self._subscriptionType = ""
self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("OutPortProvider")
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
+ pass
##
# @if jp
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortPullConnector.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -231,6 +231,7 @@
# delete provider
if self._provider:
OpenRTM_aist.OutPortProviderFactory.instance().deleteObject(self._provider)
+ self._provider.exit()
self._provider = 0
# delete buffer
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMProvider.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -94,13 +94,22 @@
# @endif
#
def __del__(self):
+ return
+
+ ##
+ # @if jp
+ # @brief 終了処理
+ #
+ # @else
+ # @brief
+ #
+ #
+ #
+ # @endif
+ #
+ def exit(self):
oid = self._default_POA().servant_to_id(self)
self._default_POA().deactivate_object(oid)
-
-
- return
-
-
# virtual void init(coil::Properties& prop);
def init(self, prop):
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/PeriodicECSharedComposite.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -636,19 +636,20 @@
#
def __init__(self, manager):
OpenRTM_aist.RTObject_impl.__init__(self,manager)
+
self._ref = self._this()
self._objref = self._ref
self._org = OpenRTM_aist.PeriodicECOrganization(self)
OpenRTM_aist.CORBA_SeqUtil.push_back(self._sdoOwnedOrganizations,
self._org.getObjRef())
-
+
self._members = [[]]
self.bindParameter("members", self._members, " ", stringToStrVec)
self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("rtobject.periodic_ec_shared")
self._configsets.addConfigurationSetListener(\
OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET,
setCallback(self._org))
-
+
self._configsets.addConfigurationSetListener(\
OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET,
addCallback(self._org))
@@ -671,7 +672,11 @@
#
def __del__(self):
self._rtcout.RTC_TRACE("destructor of PeriodicECSharedComposite")
- pass
+ OpenRTM_aist.RTObject_impl.__del__(self)
+ poa = OpenRTM_aist.Manager.instance().getPOA()
+ poa.deactivate_object(poa.servant_to_id(self._org))
+ del self._org
+
##
@@ -691,7 +696,7 @@
#
def onInitialize(self):
self._rtcout.RTC_TRACE("onInitialize()")
-
+ return RTC.RTC_OK
active_set = self._properties.getProperty("configuration.active_config",
"default")
if self._configsets.haveConfig(active_set):
Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2016-11-01 01:53:12 UTC (rev 731)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2016-11-01 08:26:42 UTC (rev 732)
@@ -566,18 +566,19 @@
# @endif
def finalize(self):
self._rtcout.RTC_TRACE("finalize()")
+
if self._created or not self._exiting:
return RTC.PRECONDITION_NOT_MET
# Return RTC::PRECONDITION_NOT_MET,
# When the component is registered in ExecutionContext.
if len(self._ecOther) != 0:
- for ec in self._ecOther:
- if not CORBA.is_nil(ec):
- return RTC.PRECONDITION_NOT_MET
+ #for ec in self._ecOther:
+ #if not CORBA.is_nil(ec):
+ #return RTC.PRECONDITION_NOT_MET
self._ecOther = []
-
+
ret = self.on_finalize()
self.shutdown()
return ret
More information about the openrtm-commit
mailing list