本文整理汇总了Python中OpenRTM_aist.flatten方法的典型用法代码示例。如果您正苦于以下问题:Python OpenRTM_aist.flatten方法的具体用法?Python OpenRTM_aist.flatten怎么用?Python OpenRTM_aist.flatten使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRTM_aist
的用法示例。
在下文中一共展示了OpenRTM_aist.flatten方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initProviders
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def initProviders(self):
self._rtcout.RTC_TRACE("initProviders()")
# create InPort providers
factory = OpenRTM_aist.InPortProviderFactory.instance()
provider_types = factory.getIdentifiers()
self._rtcout.RTC_DEBUG("available providers: %s",
OpenRTM_aist.flatten(provider_types))
if self._properties.hasKey("provider_types") and \
OpenRTM_aist.normalize(self._properties.getProperty("provider_types")) != "all":
self._rtcout.RTC_DEBUG("allowed providers: %s",
self._properties.getProperty("provider_types"))
temp_types = provider_types
provider_types = []
active_types = OpenRTM_aist.split(self._properties.getProperty("provider_types"), ",")
temp_types.sort()
active_types.sort()
set_ptypes = set(temp_types).intersection(set(active_types))
provider_types = provider_types + list(set_ptypes)
# InPortProvider supports "push" dataflow type
if len(provider_types) > 0:
self._rtcout.RTC_DEBUG("dataflow_type push is supported")
self.appendProperty("dataport.dataflow_type", "push")
self.appendProperty("dataport.interface_type",
OpenRTM_aist.flatten(provider_types))
self._providerTypes = provider_types
return
示例2: initConsumers
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def initConsumers(self):
self._rtcout.RTC_TRACE("initConsumers()")
# create OuPort consumers
factory = OpenRTM_aist.OutPortConsumerFactory.instance()
consumer_types = factory.getIdentifiers()
self._rtcout.RTC_DEBUG("available consumers: %s",
OpenRTM_aist.flatten(consumer_types))
if self._properties.hasKey("consumer_types") and \
OpenRTM_aist.normalize(self._properties.getProperty("consumer_types")) != "all":
self._rtcout.RTC_DEBUG("allowed consumers: %s",
self._properties.getProperty("consumer_types"))
temp_types = consumer_types
consumer_types = []
active_types = OpenRTM_aist.split(self._properties.getProperty("consumer_types"), ",")
temp_types.sort()
active_types.sort()
set_ctypes = set(temp_types).intersection(set(active_types))
consumer_types = consumer_types + list(set_ctypes)
# OutPortConsumer supports "pull" dataflow type
if len(consumer_types) > 0:
self._rtcout.RTC_PARANOID("dataflow_type pull is supported")
self.appendProperty("dataport.dataflow_type", "pull")
self.appendProperty("dataport.interface_type",
OpenRTM_aist.flatten(consumer_types))
self._consumerTypes = consumer_types
return
示例3: createProvider
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def createProvider(self, cprof, prop):
if not prop.getProperty("interface_type") and \
not OpenRTM_aist.includes(self._providerTypes, prop.getProperty("interface_type")):
self._rtcout.RTC_ERROR("no provider found")
self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
self._rtcout.RTC_DEBUG("interface_types: %s",
OpenRTM_aist.flatten(self._providerTypes))
return 0
self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
provider = OpenRTM_aist.InPortProviderFactory.instance().createObject(prop.getProperty("interface_type"))
if provider != 0:
self._rtcout.RTC_DEBUG("provider created")
provider.init(prop.getNode("provider"))
if not provider.publishInterface(cprof.properties):
self._rtcout.RTC_ERROR("publishing interface information error")
OpenRTM_aist.InPortProviderFactory.instance().deleteObject(provider)
return 0
return provider
self._rtcout.RTC_ERROR("provider creation failed")
return 0
示例4: getConnectorNames
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def getConnectorNames(self):
names = []
for con in self._connectors:
names.append(con.name())
self._rtcout.RTC_TRACE("getConnectorNames(): %s", OpenRTM_aist.flatten(names))
return names
示例5: __init__
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def __init__(self, name, data_type):
OpenRTM_aist.PortBase.__init__(self,name)
self._rtcout.RTC_DEBUG("Port name: %s", name)
self._rtcout.RTC_DEBUG("setting port.port_type: DataOutPort")
self.addProperty("port.port_type", "DataOutPort")
self._rtcout.RTC_DEBUG("setting dataport.data_type: %s", data_type)
self.addProperty("dataport.data_type", data_type)
# publisher list
factory = OpenRTM_aist.PublisherFactory.instance()
pubs = OpenRTM_aist.flatten(factory.getIdentifiers())
# blank characters are deleted for RTSE's bug
pubs = pubs.lstrip()
self._rtcout.RTC_DEBUG("available subscription_type: %s", pubs)
self.addProperty("dataport.subscription_type", pubs)
self._properties = OpenRTM_aist.Properties()
self._name = name
self._connectors = []
self._consumers = []
self._providerTypes = ""
self._consumerTypes = ""
self._connector_mutex = threading.RLock()
self._listeners = OpenRTM_aist.ConnectorListeners()
示例6: createConsumer
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def createConsumer(self, cprof, prop):
if prop.getProperty("interface_type") and \
not self._consumerTypes.count(prop.getProperty("interface_type")):
self._rtcout.RTC_ERROR("no consumer found")
self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
self._rtcout.RTC_DEBUG("interface_types: %s",
OpenRTM_aist.flatten(self._consumerTypes))
return 0
self._rtcout.RTC_DEBUG("interface_type: %s", prop.getProperty("interface_type"))
consumer = OpenRTM_aist.InPortConsumerFactory.instance().createObject(prop.getProperty("interface_type"))
if consumer != 0:
self._rtcout.RTC_DEBUG("consumer created")
consumer.init(prop.getNode("consumer"))
if not consumer.subscribeInterface(cprof.properties):
self._rtcout.RTC_ERROR("interface subscription failed.")
OpenRTM_aist.InPortConsumerFactory.instance().deleteObject(consumer)
return 0
return consumer
self._rtcout.RTC_ERROR("consumer creation failed")
return 0
示例7: getConnectorIds
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def getConnectorIds(self):
ids = []
for con in self._connectors:
ids.append(con.id())
self._rtcout.RTC_TRACE("getConnectorIds(): %s", OpenRTM_aist.flatten(ids))
return ids
示例8: isExistingConsumerType
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def isExistingConsumerType(self, sProfile):
factory = OpenRTM_aist.SdoServiceConsumerFactory.instance()
consumerTypes = factory.getIdentifiers()
for i in range(len(consumerTypes)):
if consumerTypes[i] == str(sProfile.interface_type):
self._rtcout.RTC_DEBUG("%s exists in the SDO service factory.", str(sProfile.interface_type))
self._rtcout.RTC_PARANOID("Available SDO serices in the factory: %s", str(OpenRTM_aist.flatten(consumerTypes)))
return True
self._rtcout.RTC_WARN("No available SDO service in the factory: %s",
str(sProfile.interface_type))
return False
示例9: updateDelegatedPorts
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def updateDelegatedPorts(self):
oldPorts = self._expPorts
ports = self._rtobj.getProperties().getProperty("conf.default.exported_ports")
newPorts = ports.split(",")
removedPorts = list(set(oldPorts).difference(set(newPorts)))
createdPorts = list(set(newPorts).difference(set(oldPorts)))
self._rtcout.RTC_VERBOSE("old ports: %s", OpenRTM_aist.flatten(oldPorts))
self._rtcout.RTC_VERBOSE("new ports: %s", OpenRTM_aist.flatten(newPorts))
self._rtcout.RTC_VERBOSE("remove ports: %s", OpenRTM_aist.flatten(removedPorts))
self._rtcout.RTC_VERBOSE("add ports: %s", OpenRTM_aist.flatten(createdPorts))
for member in self._rtcMembers:
self.removePort(member, removedPorts)
self.addPort(member, createdPorts)
self._expPorts = newPorts
return
示例10: createTask
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def createTask(self, prop):
factory = OpenRTM_aist.PeriodicTaskFactory.instance()
th = factory.getIdentifiers()
self._rtcout.RTC_DEBUG("available task types: %s", OpenRTM_aist.flatten(th))
self._task = factory.createObject(prop.getProperty("thread_type", "default"))
if not self._task:
self._rtcout.RTC_ERROR("Task creation failed: %s",
prop.getProperty("thread_type", "default"))
return self.INVALID_ARGS
self._rtcout.RTC_PARANOID("Task creation succeeded.")
# setting task function
self._task.setTask(self.svc)
# Task execution rate
rate = prop.getProperty("publisher.push_rate")
if rate != "":
hz = float(rate)
if hz == 0:
hz = 1000.0
self._rtcout.RTC_DEBUG("Task period %f [Hz]", hz)
else:
hz = 1000.0
self._task.setPeriod(1.0/hz)
# Measurement setting
mprop = prop.getNode("measurement")
self._task.executionMeasure(OpenRTM_aist.toBool(mprop.getProperty("exec_time"),
"enable", "disable", True))
ecount = [0]
if OpenRTM_aist.stringTo(ecount, mprop.getProperty("exec_count")):
self._task.executionMeasureCount(ecount[0])
self._task.periodicMeasure(OpenRTM_aist.toBool(mprop.getProperty("period_time"),
"enable", "disable", True))
pcount = [0]
if OpenRTM_aist.stringTo(pcount, mprop.getProperty("period_count")):
self._task.periodicMeasureCount(pcount[0])
# Start task in suspended mode
self._task.suspend()
self._task.activate()
self._task.suspend()
return self.PORT_OK
示例11: addPort
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def addPort(self, member, portlist):
self._rtcout.RTC_TRACE("addPort(%s)", OpenRTM_aist.flatten(portlist))
if len(portlist) == 0:
return
comp_name = member._profile.instance_name
plist = member._profile.port_profiles
# port delegation
for prof in plist:
# port name -> comp_name.port_name
port_name = prof.name
self._rtcout.RTC_DEBUG("port_name: %s is in %s?", (port_name,OpenRTM_aist.flatten(portlist)))
if not port_name in portlist:
self._rtcout.RTC_DEBUG("Not found: %s is in %s?", (port_name,OpenRTM_aist.flatten(portlist)))
continue
self._rtcout.RTC_DEBUG("Found: %s is in %s", (port_name,OpenRTM_aist.flatten(portlist)))
self._rtobj.addPort(prof.port_ref)
self._rtcout.RTC_DEBUG("Port %s was delegated.", port_name)
return
示例12: remove_member
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def remove_member(self, id):
self._rtcout.RTC_DEBUG("remove_member(id = %s)", id)
rm_rtc = []
for member in self._rtcMembers:
if str(id) != str(member._profile.instance_name):
continue
self.removePort(member, self._expPorts)
self._rtobj.getProperties().setProperty("conf.default.exported_ports", OpenRTM_aist.flatten(self._expPorts))
self.removeParticipantFromEC(member)
self.removeOrganizationFromTarget(member)
self.startOwnedEC(member)
rm_rtc.append(member)
for m in rm_rtc:
self._rtcMembers.remove(m)
result = OpenRTM_aist.Organization_impl.remove_member(self, id)
return result
示例13: createTask
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def createTask(self, prop):
factory = OpenRTM_aist.PeriodicTaskFactory.instance()
th = factory.getIdentifiers()
self._rtcout.RTC_DEBUG("available task types: %s", OpenRTM_aist.flatten(th))
self._task = factory.createObject(prop.getProperty("thread_type", "default"))
if not self._task:
self._rtcout.RTC_ERROR("Task creation failed: %s",
prop.getProperty("thread_type", "default"))
return self.INVALID_ARGS
self._rtcout.RTC_PARANOID("Task creation succeeded.")
mprop = prop.getNode("measurement")
# setting task function
self._task.setTask(self.svc)
self._task.setPeriod(0.0)
self._task.executionMeasure(OpenRTM_aist.toBool(mprop.getProperty("exec_time"),
"enable", "disable", True))
ecount = [0]
if OpenRTM_aist.stringTo(ecount, mprop.getProperty("exec_count")):
self._task.executionMeasureCount(ecount[0])
self._task.periodicMeasure(OpenRTM_aist.toBool(mprop.getProperty("period_time"),
"enable", "disable", True))
pcount = [0]
if OpenRTM_aist.stringTo(pcount, mprop.getProperty("period_count")):
self._task.periodicMeasureCount(pcount[0])
self._task.suspend()
self._task.activate()
self._task.suspend()
return self.PORT_OK
示例14: __init__
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import flatten [as 别名]
def __init__(self, rtobj):
self._rtobj = rtobj
self._consumerTypes = []
self._providers = []
self._allConsumerEnabled = True
##
# @if jp
# @brief Lock 付き SDO ServiceProfileList
# @else
# @brief SDO ServiceProfileList with mutex lock
# @endif
self._providerProfiles = []
self._provider_mutex = threading.RLock()
##
# @if jp
# @brief Lock 付き SDO ServiceProfileList
# @else
# @brief SDO ServiceProfileList with mutex lock
# @endif
self._consumers = []
self._consumer_mutex = threading.RLock()
##
# @if jp
# @brief logger
# @else
# @brief logger
# @endif
self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("SdoServiceAdmin")
self._rtcout.RTC_TRACE("SdoServiceAdmin::SdoServiceAdmin(%s)",
rtobj.getProperties().getProperty("instance_name"))
prop = self._rtobj.getProperties()
# ------------------------------------------------------------
# SDO service provider
enabledProviderTypes = [s.strip() for s in prop.getProperty("sdo.service.provider.enabled_services").split(",")]
self._rtcout.RTC_DEBUG("sdo.service.provider.enabled_services: %s",
prop.getProperty("sdo.service.provider.enabled_services"))
availableProviderTypes = OpenRTM_aist.SdoServiceProviderFactory.instance().getIdentifiers()
prop.setProperty("sdo.service.provider.available_services",
str(OpenRTM_aist.flatten(availableProviderTypes)))
self._rtcout.RTC_DEBUG("sdo.service.provider.available_services: %s",
prop.getProperty("sdo.service.provider.available_services"))
# If types include '[Aa][Ll][Ll]', all types enabled in this RTC
activeProviderTypes = []
for i in range(len(enabledProviderTypes)):
tmp = enabledProviderTypes[i].lower()
if tmp == "all":
activeProviderTypes = availableProviderTypes
self._rtcout.RTC_DEBUG("sdo.service.provider.enabled_services: ALL")
break
for j in range(len(availableProviderTypes)):
if availableProviderTypes[j] == enabledProviderTypes[i]:
activeProviderTypes.append(availableProviderTypes[j])
factory = OpenRTM_aist.SdoServiceProviderFactory.instance()
for i in range(len(activeProviderTypes)):
svc = factory.createObject(activeProviderTypes[i])
propkey = self.ifrToKey(activeProviderTypes[i])
properties = []
OpenRTM_aist.NVUtil.copyFromProperties(properties,
prop.getNode(str(propkey)))
prof = SDOPackage.ServiceProfile(str(activeProviderTypes[i]),
str(activeProviderTypes[i]),
properties,
svc._this())
svc.init(rtobj, prof)
self._providers.append(svc)
# ------------------------------------------------------------
# SDO service consumer
# getting consumer types from RTC's properties
constypes = prop.getProperty("sdo.service.consumer.enabled_services")
self._consumerTypes = [s.strip() for s in constypes.split(",")]
self._rtcout.RTC_DEBUG("sdo.service.consumer.enabled_services: %s",
str(constypes))
prop.setProperty("sdo.service.consumer.available_services",
str(OpenRTM_aist.flatten(OpenRTM_aist.SdoServiceConsumerFactory.instance().getIdentifiers())))
self._rtcout.RTC_DEBUG("sdo.service.consumer.available_services: %s",
prop.getProperty("sdo.service.consumer.available_services"))
# If types include '[Aa][Ll][Ll]', all types allowed in this RTC
for ctype in self._consumerTypes:
tmp = ctype.lower()
if tmp == "all":
self._allConsumerEnabled = True
self._rtcout.RTC_DEBUG("sdo_service.consumer_types: ALL")
return