23 from omniORB
import CORBA, PortableServer
24 from types
import IntType, ListType
49 mutex = threading.RLock()
65 mgr = OpenRTM_aist.Manager.instance()
116 signal.signal(signal.SIGINT, handler)
166 elif len(arg) == 2
and \
167 isinstance(arg[0], IntType)
and \
168 isinstance(arg[1], ListType):
172 print "Invalid arguments for init()" 173 print "init(argc,argv) or init(argv)" 179 manager.initManager(argv)
183 manager.initFactories()
184 manager.initExecContext()
185 manager.initComposite()
187 manager.initManagerServant()
191 init = staticmethod(init)
222 manager.initManager(
None)
226 manager.initFactories()
227 manager.initExecContext()
228 manager.initComposite()
234 instance = staticmethod(instance)
266 self.
_rtcout.RTC_TRACE(
"Manager.shutdown()")
295 self.
_rtcout.RTC_TRACE(
"Manager.wait()")
368 self.
_rtcout.RTC_TRACE(
"Manager.activateManager()")
372 self.
_rtcout.RTC_TRACE(
"POA Manager activated.")
374 self.
_rtcout.RTC_ERROR(
"Exception: POA Manager activation failed.")
375 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
378 mods = [s.strip()
for s
in self.
_config.getProperty(
"manager.modules.preload").
split(
",")]
380 for i
in range(len(mods)):
381 if mods[i]
is None or mods[i] ==
"":
384 OpenRTM_aist.eraseHeadBlank(tmp)
385 OpenRTM_aist.eraseTailBlank(tmp)
388 basename = os.path.basename(mods[i]).
split(
".")[0]
394 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
400 comps = [s.strip()
for s
in self.
_config.getProperty(
"manager.components.precreate").
split(
",")]
401 for i
in range(len(comps)):
402 if comps[i]
is None or comps[i] ==
"":
405 OpenRTM_aist.eraseHeadBlank(tmp)
406 OpenRTM_aist.eraseTailBlank(tmp)
449 self.
_rtcout.RTC_TRACE(
"Manager.runManager(): non-blocking mode")
452 self.
_rtcout.RTC_TRACE(
"Manager.runManager(): blocking mode")
455 self.
_rtcout.RTC_TRACE(
"Manager.runManager(): ORB was terminated")
458 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
485 def load(self, fname, initfunc):
486 self.
_rtcout.RTC_TRACE(
"Manager.load(fname = %s, initfunc = %s)",
489 fname_ = fname.split(os.sep)
496 mod = [s.strip()
for s
in fname_.split(
".")]
497 initfunc = mod[0]+
"Init" 499 self.
_rtcout.RTC_DEBUG(
"module path: %s", path)
526 self.
_rtcout.RTC_TRACE(
"Manager.unload()")
548 self.
_rtcout.RTC_TRACE(
"Manager.unloadAll()")
568 self.
_rtcout.RTC_TRACE(
"Manager.getLoadedModules()")
587 self.
_rtcout.RTC_TRACE(
"Manager.getLoadableModules()")
613 self.
_rtcout.RTC_TRACE(
"Manager.registerFactory(%s)", profile.getProperty(
"type_name"))
616 self.
_factory.registerObject(factory)
619 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
643 factories = self.
_factory.getObjects()
649 for factory
in factories:
650 props.append(factory.profile())
672 self.
_rtcout.RTC_TRACE(
"Manager.registerECFactory(%s)", name)
677 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
697 self.
_rtcout.RTC_TRACE(
"Manager.getModulesFactories()")
700 for _obj
in self.
_factory._objects._obj:
701 self.
_modlist.
append(_obj.profile().getProperty(
"implementation_id"))
768 self.
_rtcout.RTC_TRACE(
"Manager.createComponent(%s)", comp_args)
772 print "comp_args:", comp_args
776 if comp_prop.findNode(
"exported_ports"):
777 exported_ports = OpenRTM_aist.split(comp_prop.getProperty(
"exported_ports"),
779 exported_ports_str =
"" 780 for i
in range(len(exported_ports)):
781 keyval = OpenRTM_aist.split(exported_ports[i],
".")
783 exported_ports_str += (keyval[0] +
"." + keyval[-1])
785 exported_ports_str += exported_ports[i]
787 if i != (len(exported_ports) - 1) :
788 exported_ports_str +=
"," 790 comp_prop.setProperty(
"exported_ports", exported_ports_str)
791 comp_prop.setProperty(
"conf.default.exported_ports", exported_ports_str)
795 self.
_rtcout.RTC_ERROR(
"createComponent: Factory not found: %s",
796 comp_id.getProperty(
"implementation_id"))
800 self.
_rtcout.RTC_INFO(
"%d loadable modules found", len(mp))
810 self.
_rtcout.RTC_ERROR(
"No module for %s in loadable modules list",
811 comp_id.getProperty(
"implementation_id"))
814 if not found_obj.findNode(
"module_file_name"):
815 self.
_rtcout.RTC_ERROR(
"Hmm...module_file_name key not found.")
819 self.
_rtcout.RTC_INFO(
"Loading module: %s", found_obj.getProperty(
"module_file_name"))
820 self.
load(found_obj.getProperty(
"module_file_name"),
"")
823 self.
_rtcout.RTC_ERROR(
"Factory not found for loaded module: %s",
824 comp_id.getProperty(
"implementation_id"))
829 prop = factory.profile()
831 inherit_prop = [
"config.version",
841 "exec_cxt.periodic.type",
842 "exec_cxt.periodic.rate",
843 "exec_cxt.evdriven.type",
850 for i
in range(len(inherit_prop)):
851 prop.setProperty(inherit_prop[i],self.
_config.getProperty(inherit_prop[i]))
853 comp = factory.create(self)
856 self.
_rtcout.RTC_ERROR(
"createComponent: RTC creation failed: %s",
857 comp_id.getProperty(
"implementation_id"))
859 self.
_rtcout.RTC_TRACE(
"RTC Created: %s", comp_id.getProperty(
"implementation_id"))
864 prop.mergeProperties(comp_prop)
880 if comp.initialize() != RTC.RTC_OK:
881 self.
_rtcout.RTC_TRACE(
"RTC initialization failed: %s",
882 comp_id.getProperty(
"implementation_id"))
884 self.
_rtcout.RTC_TRACE(
"%s was finalized", comp_id.getProperty(
"implementation_id"))
887 self.
_rtcout.RTC_TRACE(
"RTC initialization succeeded: %s",
888 comp_id.getProperty(
"implementation_id"))
910 self.
_rtcout.RTC_TRACE(
"Manager.registerComponent(%s)", comp.getInstanceName())
913 names = comp.getNamingNames()
916 self.
_rtcout.RTC_TRACE(
"Bind name: %s", name)
937 self.
_rtcout.RTC_TRACE(
"Manager.unregisterComponent(%s)", comp.getInstanceName())
938 self.
_compManager.unregisterObject(comp.getInstanceName())
939 names = comp.getNamingNames()
942 self.
_rtcout.RTC_TRACE(
"Unbind name: %s", name)
963 self.
_rtcout.RTC_TRACE(
"Manager.createContext()")
964 self.
_rtcout.RTC_TRACE(
"ExecutionContext type: %s",
965 self.
_config.getProperty(
"exec_cxt.periodic.type"))
975 self.
_rtcout.RTC_ERROR(
"Factory not found: %s", ec_id[0])
978 ec = factory.create()
996 self.
_rtcout.RTC_TRACE(
"Manager.deleteComponent(%s)", instance_name)
999 self.
_rtcout.RTC_WARN(
"RTC %s was not found in manager.", instance_name)
1004 self.
_rtcout.RTC_TRACE(
"Manager.deleteComponent(RTObject_impl)")
1008 comp_id = comp.getProperties()
1012 self.
_rtcout.RTC_DEBUG(
"Factory not found: %s",
1013 comp_id.getProperty(
"implementation_id"))
1016 self.
_rtcout.RTC_DEBUG(
"Factory found: %s",
1017 comp_id.getProperty(
"implementation_id"))
1018 factory.destroy(comp)
1021 if OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.shutdown_on_nortcs"),
1022 "YES",
"NO",
True)
and \
1023 not OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.is_master"),
1048 self.
_rtcout.RTC_TRACE(
"Manager.getComponent(%s)", instance_name)
1066 self.
_rtcout.RTC_TRACE(
"Manager.getComponents()")
1088 self.
_rtcout.RTC_TRACE(
"Manager.getORB()")
1106 self.
_rtcout.RTC_TRACE(
"Manager.getPOA()")
1124 self.
_rtcout.RTC_TRACE(
"Manager.getPOAManager()")
1152 config.configure(self.
_config)
1161 if OpenRTM_aist.toBool(self.
_config.getProperty(
"timer.enable"),
"YES",
"NO",
True):
1163 tick = self.
_config.getProperty(
"timer.tick")
1165 tm = tm.set_time(float(tick))
1172 if OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.shutdown_auto"),
1173 "YES",
"NO",
True)
and \
1174 not OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.is_master"),
1175 "YES",
"NO",
False):
1177 if self.
_config.findNode(
"manager.auto_shutdown_duration"):
1178 duration = float(self.
_config.getProperty(
"manager.auto_shutdown_duration"))
1180 tm.set_time(duration)
1183 self.
_timer.registerListenerObj(self,
1184 OpenRTM_aist.Manager.shutdownOnNoRtcs,
1189 self.
_timer.registerListenerObj(self,
1190 OpenRTM_aist.Manager.cleanupComponents,
1209 self.
_rtcout.RTC_TRACE(
"Manager.shutdownManager()")
1236 self.
_rtcout.RTC_TRACE(
"Manager::shutdownOnNoRtcs()")
1237 if OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.shutdown_on_nortcs"),
1269 if not OpenRTM_aist.toBool(self.
_config.getProperty(
"logger.enable"),
"YES",
"NO",
True):
1273 logfile =
"./rtc.log" 1275 logouts = self.
_config.getProperty(
"logger.file_name")
1276 logouts = [s.strip()
for s
in logouts.split(
",")]
1280 for i
in range(len(logouts)):
1282 OpenRTM_aist.eraseHeadBlank(tmp)
1283 OpenRTM_aist.eraseTailBlank(tmp)
1285 if logouts[i].lower() ==
"stdout":
1289 self.
_rtcout.addHandler(logouts[i])
1291 if logouts[i] ==
"":
1292 logfile =
"./rtc.log" 1294 logfile = logouts[i]
1299 self.
_rtcout.addHandler(
"FILE",logfile)
1301 self.
_rtcout.setLogLevel(self.
_config.getProperty(
"logger.log_level"))
1302 self.
_rtcout.setLogLock(OpenRTM_aist.toBool(self.
_config.getProperty(
"logger.stream_lock"),
1303 "enable",
"disable",
False))
1305 self.
_rtcout.RTC_INFO(
"%s", self.
_config.getProperty(
"openrtm.version"))
1306 self.
_rtcout.RTC_INFO(
"Copyright (C) 2003-2010")
1307 self.
_rtcout.RTC_INFO(
" Noriaki Ando")
1308 self.
_rtcout.RTC_INFO(
" Intelligent Systems Research Institute, AIST")
1309 self.
_rtcout.RTC_INFO(
"Manager starting.")
1310 self.
_rtcout.RTC_INFO(
"Starting local logging.")
1328 self.
_rtcout.RTC_TRACE(
"Manager.shutdownLogger()")
1351 self.
_rtcout.RTC_TRACE(
"Manager.initORB()")
1354 args.insert(0,
"manager")
1355 argv = OpenRTM_aist.toArgv(args)
1356 self.
_orb = CORBA.ORB_init(argv)
1358 self.
_poa = self.
_orb.resolve_initial_references(
"RootPOA")
1359 if CORBA.is_nil(self.
_poa):
1360 self.
_rtcout.RTC_ERROR(
"Could not resolve RootPOA")
1366 self.
_rtcout.RTC_ERROR(
"Exception: Caught unknown exception in initORB().")
1367 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1388 opt = self.
_config.getProperty(
"corba.args")
1389 self.
_rtcout.RTC_DEBUG(
"corba.args: %s",opt)
1396 self.
_rtcout.RTC_PARANOID(
"ORB options: %s", opt[0])
1423 if self.
_config.findNode(
"corba.endpoints"):
1424 endpoints_ = [s.strip()
for s
in self.
_config.getProperty(
"corba.endpoints").
split(
",")]
1425 for ep
in endpoints_:
1426 endpoints.append(ep)
1428 self.
_rtcout.RTC_DEBUG(
"corba.endpoints: %s", self.
_config.getProperty(
"corba.endpoints"))
1430 if self.
_config.findNode(
"corba.endpoint"):
1431 endpoints_ = [s.strip()
for s
in self.
_config.getProperty(
"corba.endpoint").
split(
",")]
1432 for ep
in endpoints_:
1433 endpoints.append(ep)
1434 self.
_rtcout.RTC_DEBUG(
"corba.endpoint: %s", self.
_config.getProperty(
"corba.endpoint"))
1438 self.
_rtcout.RTC_DEBUG(
"manager.is_master: %s",
1439 self.
_config.getProperty(
"manager.is_master"))
1441 if OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.is_master"),
"YES",
"NO",
False):
1442 mm = self.
_config.getProperty(
"corba.master_manager",
":2810")
1443 mmm = [s.strip()
for s
in mm.split(
":")]
1445 endpoints.insert(0,
":" + mmm[1])
1447 endpoints.insert(0,
":2810")
1449 endpoints = OpenRTM_aist.unique_sv(endpoints)
1468 corba = self.
_config.getProperty(
"corba.id")
1469 self.
_rtcout.RTC_DEBUG(
"corba.id: %s", corba)
1471 for i
in range(len(endpoints)):
1473 endpoint = endpoints[i]
1477 self.
_rtcout.RTC_DEBUG(
"Endpoint is : %s", endpoint)
1478 if endpoint.find(
":") == -1:
1481 if corba ==
"omniORB":
1482 endpoint = OpenRTM_aist.normalize([endpoint])
1483 if OpenRTM_aist.normalize([endpoint]) ==
"all:":
1484 opt[0] +=
" -ORBendPointPublishAllIFs 1" 1486 opt[0] +=
" -ORBendPoint giop:tcp:" + endpoint
1488 elif corba ==
"TAO":
1489 opt[0] +=
"-ORBEndPoint iiop://" + endpoint
1490 elif corba ==
"MICO":
1491 opt[0] +=
"-ORBIIOPAddr inet:" + endpoint
1493 endpoints[i] = endpoint
1513 self.
_rtcout.RTC_TRACE(
"Manager.shutdownORB()")
1518 while self.
_orb.work_pending():
1519 self.
_rtcout.RTC_PARANOID(
"Pending work still exists.")
1520 if self.
_orb.work_pending():
1521 self.
_orb.perform_work()
1524 self.
_rtcout.RTC_DEBUG(
"No pending works of ORB. Shutting down POA and ORB.")
1526 self.
_rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
1529 if not CORBA.is_nil(self.
_poa):
1533 self.
_rtcout.RTC_DEBUG(
"POA Manager was deactivated.")
1534 self.
_poa.destroy(
False,
True)
1535 self.
_poa = PortableServer.POA._nil
1536 self.
_rtcout.RTC_DEBUG(
"POA was destroyed.")
1537 except CORBA.SystemException, ex:
1538 self.
_rtcout.RTC_ERROR(
"Caught SystemException during root POA destruction")
1539 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1541 self.
_rtcout.RTC_ERROR(
"Caught unknown exception during destruction")
1542 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1547 self.
_rtcout.RTC_DEBUG(
"ORB was shutdown.")
1548 self.
_orb = CORBA.Object._nil
1549 except CORBA.SystemException, ex:
1550 self.
_rtcout.RTC_ERROR(
"Caught CORBA::SystemException during ORB shutdown.")
1551 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1553 self.
_rtcout.RTC_ERROR(
"Caught unknown exception during ORB shutdown.")
1554 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1582 self.
_rtcout.RTC_TRACE(
"Manager.initNaming()")
1585 if not OpenRTM_aist.toBool(self.
_config.getProperty(
"naming.enable"),
"YES",
"NO",
True):
1588 meths = OpenRTM_aist.split(self.
_config.getProperty(
"naming.type"),
",")
1591 names = OpenRTM_aist.split(self.
_config.getProperty(meth+
".nameservers"),
",")
1593 self.
_rtcout.RTC_TRACE(
"Register Naming Server: %s/%s", (meth, name))
1596 if OpenRTM_aist.toBool(self.
_config.getProperty(
"naming.update.enable"),
"YES",
"NO",
True):
1598 intr = self.
_config.getProperty(
"naming.update.interval")
1621 self.
_rtcout.RTC_TRACE(
"Manager.shutdownNaming()")
1641 self.
_rtcout.RTC_TRACE(
"Manager.initExecContext()")
1642 OpenRTM_aist.PeriodicExecutionContextInit(self)
1643 OpenRTM_aist.ExtTrigExecutionContextInit(self)
1644 OpenRTM_aist.OpenHRPExecutionContextInit(self)
1664 self.
_rtcout.RTC_TRACE(
"Manager.initComposite()")
1665 OpenRTM_aist.PeriodicECSharedCompositeInit(self)
1691 self.
_rtcout.RTC_TRACE(
"Manager.initFactories()")
1728 self.
_rtcout.RTC_TRACE(
"Manager.initManagerServant()")
1729 if not OpenRTM_aist.toBool(self.
_config.getProperty(
"manager.corba_servant"),
1734 prop = self.
_config.getNode(
"manager")
1735 names = OpenRTM_aist.split(prop.getProperty(
"naming_formats"),
",")
1737 if OpenRTM_aist.toBool(prop.getProperty(
"is_master"),
1746 otherref = file(self.
_config.getProperty(
"manager.refstring_path"),
'r') 1747 refstring = otherref.readline() 1751 reffile = file(self.
_config.getProperty(
"manager.refstring_path"),
'w')
1753 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1756 reffile.write(self.
_orb.object_to_string(self.
_mgrservant.getObjRef()))
1774 self.
_rtcout.RTC_TRACE(
"Manager.shutdownComponents()")
1780 p.mergeProperties(comp.getProperties())
1782 self.
_rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
1785 for ec
in self.
_ecs:
1787 self.
_poa.deactivate_object(self.
_poa.servant_to_id(ec))
1789 self.
_rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
1807 self.
_rtcout.RTC_TRACE(
"Manager.cleanupComponent()")
1828 self.
_rtcout.RTC_VERBOSE(
"Manager.cleanupComponents()")
1830 self.
_rtcout.RTC_VERBOSE(
"%d components are marked as finalized.",
1860 self.
_rtcout.RTC_TRACE(
"Manager.notifyFinalized()")
1883 id_and_conf = [s.strip()
for s
in comp_arg.split(
"?")]
1884 if len(id_and_conf) != 1
and len(id_and_conf) != 2:
1885 self.
_rtcout.RTC_ERROR(
"Invalid arguments. Two or more '?'")
1888 if id_and_conf[0].
find(
":") == -1:
1889 id_and_conf[0] =
"RTC:::" + id_and_conf[0] +
":" 1891 id = [s.strip()
for s
in id_and_conf[0].
split(
":")]
1894 self.
_rtcout.RTC_ERROR(
"Invalid RTC id format.")
1897 prof = [
"RTC",
"vendor",
"category",
"implementation_id",
"version"]
1899 if id[0] != prof[0]:
1900 self.
_rtcout.RTC_ERROR(
"Invalid id type.")
1904 comp_id.setProperty(prof[i], id[i])
1905 self.
_rtcout.RTC_TRACE(
"RTC basic profile %s: %s", (prof[i], id[i]))
1907 if len(id_and_conf) == 2:
1908 conf = [s.strip()
for s
in id_and_conf[1].
split(
"&")]
1909 for i
in range(len(conf)):
1910 keyval = [s.strip()
for s
in conf[i].
split(
"=")]
1912 comp_conf.setProperty(keyval[0],keyval[1])
1913 self.
_rtcout.RTC_TRACE(
"RTC property %s: %s", (keyval[0], keyval[1]))
1922 id_and_conf = [s.strip()
for s
in ec_args.split(
"?")]
1924 if len(id_and_conf) != 1
and len(id_and_conf) != 2:
1925 self.
_rtcout.RTC_ERROR(
"Invalid arguments. Two or more '?'")
1928 if (id_and_conf[0] ==
"")
or id_and_conf[0]
is None:
1929 self.
_rtcout.RTC_ERROR(
"Empty ExecutionContext's name")
1932 ec_id[0] = id_and_conf[0]
1934 if len(id_and_conf) == 2:
1935 conf = [s.strip()
for s
in id_and_conf[1].
split(
"&")]
1936 for i
in range(len(conf)):
1937 k = [s.strip()
for s
in conf[i].
split(
"=")]
1938 ec_conf.setProperty(k[0],k[1])
1939 self.
_rtcout.RTC_TRACE(
"EC property %s: %s",(k[0],k[1]))
1960 category = comp.getCategory()
1961 type_name = comp.getTypeName()
1962 inst_name = comp.getInstanceName()
1964 type_conf = category +
"." + type_name +
".config_file" 1965 name_conf = category +
"." + inst_name +
".config_file" 1971 if self.
_config.getProperty(name_conf) !=
"":
1973 conff = open(self.
_config.getProperty(name_conf))
1975 print "Not found. : %s" % self.
_config.getProperty(name_conf)
1976 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1978 name_prop.load(conff)
1980 if self.
_config.findNode(category +
"." + inst_name):
1981 name_prop.mergeProperties(self.
_config.getNode(category +
"." + inst_name))
1983 if self.
_config.getProperty(type_conf) !=
"":
1985 conff = open(self.
_config.getProperty(type_conf))
1987 print "Not found. : %s" % self.
_config.getProperty(type_conf)
1988 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
1990 type_prop.load(conff)
1992 if self.
_config.findNode(category +
"." + type_name):
1993 type_prop.mergeProperties(self.
_config.getNode(category +
"." + type_name))
1995 comp.setProperties(prop)
1996 type_prop.mergeProperties(name_prop)
1997 comp.setProperties(type_prop)
2001 naming_formats = self.
_config.getProperty(
"naming.formats")
2002 if comp_prop.findNode(
"naming.formats"):
2003 naming_formats = comp_prop.getProperty(
"naming.formats")
2004 naming_formats = OpenRTM_aist.flatten(OpenRTM_aist.unique_sv(OpenRTM_aist.split(naming_formats,
",")))
2006 naming_names = self.
formatString(naming_formats, comp.getProperties())
2007 comp.getProperties().setProperty(
"naming.formats",naming_formats)
2008 comp.getProperties().setProperty(
"naming.names",naming_names)
2030 self.
_rtcout.RTC_ERROR(
"Invalid configuration file name.")
2033 if file_name[0] !=
'\0':
2036 conff = open(file_name)
2038 print "Not found. : %s" % file_name
2039 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2076 name_ = naming_format
2092 if n ==
'{' or n ==
'(':
2095 for i
in xrange(len_):
2096 if n ==
'}' or n ==
')':
2100 envval = os.getenv(env)
2106 if count > 0
and (count % 2):
2108 if n ==
"n": str_ += prop.getProperty(
"instance_name")
2109 elif n ==
"t": str_ += prop.getProperty(
"type_name")
2110 elif n ==
"m": str_ += prop.getProperty(
"type_name")
2111 elif n ==
"v": str_ += prop.getProperty(
"version")
2112 elif n ==
"V": str_ += prop.getProperty(
"vendor")
2113 elif n ==
"c": str_ += prop.getProperty(
"category")
2114 elif n ==
"h": str_ += self.
_config.getProperty(
"manager.os.hostname")
2115 elif n ==
"M": str_ += self.
_config.getProperty(
"manager.name")
2116 elif n ==
"p": str_ += str(self.
_config.getProperty(
"manager.pid"))
2142 if not OpenRTM_aist.toBool(self.
_config.getProperty(
"logger.enable"),
"YES",
"NO",
True):
2146 logbuf.setLogLevel(self.
_config.getProperty(
"logger.log_level"))
2183 splitted_name = os.path.split(file_name)
2184 save_path = sys.path[:]
2185 sys.path.append(splitted_name[0])
2186 import_name = splitted_name[-1].
split(
".py")[0]
2187 mo = __import__(import_name)
2188 sys.path = save_path
2189 _spec = getattr(mo,import_name.lower()+
"_spec",
None)
2190 _klass = getattr(mo,import_name,
None)
2191 if _spec
and _klass:
2195 OpenRTM_aist.Delete)
2197 self.
_rtcout.RTC_ERROR(
"Module load error: %s", file_name)
2198 self.
_rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
2232 def __init__(self, name=None, factory=None, prop=None):
2236 self.
_name = factory.getInstanceName()
2241 return self.
_name == factory.getInstanceName()
2258 def __init__(self, name=None, prop=None, factory=None):
2265 self.
_vendor = prop.getProperty(
"vendor")
2266 self.
_category = prop.getProperty(
"category")
2267 self.
_impleid = prop.getProperty(
"implementation_id")
2268 self.
_version = prop.getProperty(
"version")
2270 self.
_vendor = factory.profile().getProperty(
"vendor")
2271 self.
_category = factory.profile().getProperty(
"category")
2272 self.
_impleid = factory.profile().getProperty(
"implementation_id")
2273 self.
_version = factory.profile().getProperty(
"version")
2282 if self.
_impleid != _prop.getProperty(
"implementation_id"):
2285 if self.
_vendor !=
"" and self.
_vendor != _prop.getProperty(
"vendor"):
2317 self.
_name = factory.name()
2320 return self.
_name == factory.name()
2344 if self.
_prop.getProperty(
"implementation_id") != prop.getProperty(
"implementation_id"):
2347 if self.
_prop.getProperty(
"vendor")
and \
2348 self.
_prop.getProperty(
"vendor") != prop.getProperty(
"vendor"):
2351 if self.
_prop.getProperty(
"category")
and \
2352 self.
_prop.getProperty(
"category") != prop.getProperty(
"category"):
2355 if self.
_prop.getProperty(
"version")
and \
2356 self.
_prop.getProperty(
"version") != prop.getProperty(
"version"):
2423 print OpenRTM_aist.Logger.print_exception()
def getComponent(self, instance_name)
Get RT-Component's pointer.
def __call__(self, factory)
def initFactories(self)
Factories initialization.
def formatString(self, naming_format, prop)
def cleanupComponent(self, comp)
def unregisterComponent(self, comp)
Register RT-Component directly without Factory.
def registerECFactory(self, name, new_func, delete_func)
Register ExecutionContext Factory.
def split(input, delimiter)
Split string by delimiter.
def registerComponent(self, comp)
Register RT-Component directly without Factory.
def load(self, fname, initfunc)
[CORBA interface] Load module
def setModuleInitProc(self, proc)
Run the Manager.
def createORBEndpoints(self, endpoints)
Create Endpoints.
Manager configuration class.
The Properties class represents a persistent set of properties.
def __call__(self, factory)
def __init__(self, name=None, factory=None, prop=None)
def registerFactory(self, profile, new_func, delete_func)
Register RT-Component Factory.
def initManager(self, argv)
Manager internal initialization.
def initExecContext(self)
def getModulesFactories(self)
Get the list of all RT-Component Factory.
def __call__(self, factory)
def getLoadableModules(self)
Get loadable module names.
def shutdownLogger(self)
System Logger finalization.
def getFactoryProfiles(self)
Get profiles of factories.
def createContext(self, ec_args)
Create Context.
def __init__(self, _manager=None)
Protected Copy Constructor.
def mergeProperty(self, prop, file_name)
def unload(self, fname)
Unload module.
def configureComponent(self, comp, prop)
void configureComponent(RTObject_impl* comp, const coil::Properties& prop);
def createComponent(self, comp_args)
Create RT-Components.
def getComponents(self)
Get all RT-Component's pointer.
def __init__(self, name=None, factory=None)
def initORB(self)
CORBA ORB initialization.
def shutdownManager(self)
def createORBEndpointOption(self, opt, endpoints)
Create a command optional line of Endpoint of ORB.
def shutdownORB(self)
ORB finalization.
def shutdownComponents(self)
def deleteComponent(self, instance_name=None, comp=None)
Unregister RT-Component that is registered in the Manager.
def shutdownOnNoRtcs(self)
Shutdown Manager.
def __init__(self, orb)
Constructor.
def find(seq, f)
Return the index of CORBA sequence element that functor matches.
def createORBOptions(self)
ORB command option creation.
def __init__(self, name=None, prop=None, factory=None)
def runManager(self, no_block=None)
Run the Manager.
def getLogbuf(self, name="manager")
def getORB(self)
Get the pointer to the ORB.
def initManagerServant(self)
ManagerServant initialization.
def handler(signum, frame)
def procComponentArgs(self, comp_arg, comp_id, comp_conf)
bool procComponentArgs(const char* comp_arg, coil::Properties& comp_id, coil::Properties& comp_conf) ...
def unloadAll(self)
Unload module.
def __try_direct_load(self, file_name)
def getPOA(self)
Get the pointer to the RootPOA.
def initLogger(self)
System logger initialization.
def instance()
Get instance of the manager.
def activateManager(self)
Activate Manager.
def notifyFinalized(self, comp)
This method deletes RT-Components.
def getLoadedModules(self)
Get loaded module names std::vector<coil::Properties> getLoadedModules();.
def procContextArgs(self, ec_args, ec_id, ec_conf)
def initComposite(self)
PeriodicECSharedComposite initialization.
def cleanupComponents(self)
This method deletes RT-Components.
def __init__(self, manager)
Constructor.