本文整理汇总了Python中OpenRTM_aist.toBool方法的典型用法代码示例。如果您正苦于以下问题:Python OpenRTM_aist.toBool方法的具体用法?Python OpenRTM_aist.toBool怎么用?Python OpenRTM_aist.toBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRTM_aist
的用法示例。
在下文中一共展示了OpenRTM_aist.toBool方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import toBool [as 别名]
def __init__(self, prop):
self._properties = prop
self._configPath = prop.getProperty(CONFIG_PATH).split(",")
for i in range(len(self._configPath)):
tmp = [self._configPath[i]]
OpenRTM_aist.eraseHeadBlank(tmp)
self._configPath[i] = tmp[0]
self._loadPath = prop.getProperty(MOD_LOADPTH,"./").split(",")
for i in range(len(self._loadPath)):
tmp = [self._loadPath[i]]
OpenRTM_aist.eraseHeadBlank(tmp)
self._loadPath[i] = tmp[0]
self._absoluteAllowed = OpenRTM_aist.toBool(prop.getProperty(ALLOW_ABSPATH),
"yes", "no", False)
self._downloadAllowed = OpenRTM_aist.toBool(prop.getProperty(ALLOW_URL),
"yes", "no", False)
self._initFuncSuffix = prop.getProperty(INITFUNC_SFX)
self._initFuncPrefix = prop.getProperty(INITFUNC_PFX)
self._modules = OpenRTM_aist.ObjectManager(self.DLLPred)
self._rtcout = None
self._mgr = OpenRTM_aist.Manager.instance()
示例2: createTask
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import toBool [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
示例3: update
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import toBool [as 别名]
def update(self):
self._rtcout.RTC_TRACE("NamingManager::update()")
guard = OpenRTM_aist.ScopedLock(self._namesMutex)
rebind = OpenRTM_aist.toBool(self._manager.getConfig().getProperty("naming.update.rebind"),
"YES","NO",False)
for i in range(len(self._names)):
if self._names[i].ns is None:
self._rtcout.RTC_DEBUG("Retrying connection to %s/%s",
(self._names[i].method,
self._names[i].nsname))
self.retryConnection(self._names[i])
else:
try:
if rebind:
self.bindCompsTo(self._names[i].ns)
if not self._names[i].ns.isAlive():
self._rtcout.RTC_INFO("Name server: %s (%s) disappeared.",
(self._names[i].nsname,
self._names[i].method))
del self._names[i].ns
self._names[i].ns = None
except:
self._rtcout.RTC_INFO("Name server: %s (%s) disappeared.",
(self._names[i].nsname,
self._names[i].method))
del self._names[i].ns
self._names[i].ns = None
return
示例4: createTask
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import toBool [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
示例5: setHeartbeat
# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import toBool [as 别名]
def setHeartbeat(self, prop):
if OpenRTM_aist.toBool(prop.getProperty("heartbeat.enable"), "YES", "NO", False):
interval_ = prop.getProperty("heartbeat.interval")
if not interval_:
self._interval.set_time(1.0)
else:
tmp_ = float(interval_)
self._interval.set_time(tmp_)
tm_ = self._interval
self._hblistenerid = self._timer.registerListenerObj(self,
ComponentObserverConsumer.heartbeat,
tm_)
if not self._heartbeat:
self._timer.start()
self._heartbeat = True
else:
if self._heartbeat and self._hblistenerid:
self.unsetHeartbeat()
return