当前位置: 首页>>代码示例>>Python>>正文


Python OpenRTM_aist.stringTo方法代码示例

本文整理汇总了Python中OpenRTM_aist.stringTo方法的典型用法代码示例。如果您正苦于以下问题:Python OpenRTM_aist.stringTo方法的具体用法?Python OpenRTM_aist.stringTo怎么用?Python OpenRTM_aist.stringTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenRTM_aist的用法示例。


在下文中一共展示了OpenRTM_aist.stringTo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createTask

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [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
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:55,代码来源:PublisherPeriodic.py

示例2: __initLength

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
 def __initLength(self, prop):
   if prop.getProperty("length"):
     n = [0]
     if OpenRTM_aist.stringTo(n, prop.getProperty("length")):
       n = n[0]
       if n > 0:
         self.length(n)
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:9,代码来源:RingBuffer.py

示例3: parseArgs

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def parseArgs(self, argv):
    try:
      opts, args = getopt.getopt(argv[1:], "adlf:o:p:")
    except getopt.GetoptError:
      print "Error: getopt error!"
      return

    for opt, arg in opts:
      if opt == "-a":
        self._argprop.setProperty("manager.corba_servant","NO")

      if opt == "-f":
        self._configFile = arg

      if opt == "-l":
        pass

      if opt == "-o":
        pos = arg.find(":")
        if pos > 0:
          self._argprop.setProperty(arg[:pos],arg[pos+1:])

      if opt == "-p":
        num = [-1]
        ret = OpenRTM_aist.stringTo(num, arg)
        if ret:
          arg_ = ":" + arg
          self._argprop.setProperty("corba.endpoints",arg_)

      if opt == "-d":
        self._isMaster = True
        pass

    return
开发者ID:yosuke,项目名称:OpenRTM-aist-Python,代码行数:36,代码来源:ManagerConfig.py

示例4: init

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def init(self, prop):
    self._rtcout.RTC_TRACE("init()")

    self._properties.mergeProperties(prop)

    num = [-1]
    if not OpenRTM_aist.stringTo([num], 
                                 self._properties.getProperty("connection_limit","-1")):
      self._rtcout.RTC_ERROR("invalid connection_limit value: %s", 
                             self._properties.getProperty("connection_limit"))

    self.setConnectionLimit(num[0])
开发者ID:yosuke,项目名称:OpenRTM-aist-Python,代码行数:14,代码来源:CorbaPort.py

示例5: createTask

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [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
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:39,代码来源:PublisherNew.py

示例6: __initReadPolicy

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def __initReadPolicy(self, prop):
    policy = prop.getProperty("read.empty_policy")

    if policy == "readback":
      self._readback  = True
      self._timedread = False

    elif policy == "do_nothing":
      self._readback  = False
      self._timedread = False

    elif policy == "block":
      self._readback  = False
      self._timedread = True
      tm = [0.0]
      if OpenRTM_aist.stringTo(tm, prop.getProperty("read.timeout")):
        self._rtimeout.set_time(tm[0])
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:19,代码来源:RingBuffer.py

示例7: init

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def init(self, prop):
    self._rtcout.RTC_TRACE("init()")

    self._properties.mergeProperties(prop)

    self.configure()

    self.initConsumers()
    self.initProviders()

    num = [-1]
    if not OpenRTM_aist.stringTo(num, self._properties.getProperty("connection_limit","-1")):
      self._rtcout.RTC_ERROR("invalid connection_limit value: %s",
                             self._properties.getProperty("connection_limit"))

    self.setConnectionLimit(num[0])
    return
开发者ID:yosuke,项目名称:OpenRTM-aist-Python,代码行数:19,代码来源:OutPortBase.py

示例8: __initWritePolicy

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def __initWritePolicy(self, prop):
    policy = OpenRTM_aist.normalize([prop.getProperty("write.full_policy")])

    if policy == "overwrite":
      self._overwrite  = True
      self._timedwrite = False
    
    elif policy == "do_nothing":
      self._overwrite  = False
      self._timedwrite = False

    elif policy == "block":
      self._overwrite  = False
      self._timedwrite = True

      tm = [0.0]
      if OpenRTM_aist.stringTo(tm, prop.getProperty("write.timeout")):
        tm = tm[0]
        if not (tm < 0):
          self._wtimeout.set_time(tm)
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:22,代码来源:RingBuffer.py

示例9: init

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def init(self,prop):
    self._rtcout.RTC_TRACE("init()")
    self._properties.mergeProperties(prop)
    if self._singlebuffer:
      self._rtcout.RTC_DEBUG("single buffer mode.")
      self._thebuffer = OpenRTM_aist.CdrBufferFactory.instance().createObject("ring_buffer")

      if self._thebuffer is None:
        self._rtcout.RTC_ERROR("default buffer creation failed")
    else:
      self._rtcout.RTC_DEBUG("multi buffer mode.")

    self.initProviders()
    self.initConsumers()

    num = [-1]
    if not OpenRTM_aist.stringTo(num, self._properties.getProperty("connection_limit","-1")):
      self._rtcout.RTC_ERROR("invalid connection_limit value: %s",
                             self._properties.getProperty("connection_limit"))

    self.setConnectionLimit(num[0])
    return
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:24,代码来源:InPortBase.py

示例10: setPushPolicy

# 需要导入模块: import OpenRTM_aist [as 别名]
# 或者: from OpenRTM_aist import stringTo [as 别名]
  def setPushPolicy(self, prop):
    push_policy = prop.getProperty("publisher.push_policy","new")
    self._rtcout.RTC_DEBUG("push_policy: %s", push_policy)

    push_policy = OpenRTM_aist.normalize([push_policy])

    if push_policy == "all":
      self._pushPolicy = self.ALL

    elif push_policy == "fifo":
      self._pushPolicy = self.FIFO

    elif push_policy == "skip":
      self._pushPolicy = self.SKIP

    elif push_policy == "new":
      self._pushPolicy = self.NEW

    else:
      self._rtcout.RTC_ERROR("invalid push_policy value: %s", push_policy)
      self._pushPolicy = self.NEW
  
    skip_count = prop.getProperty("publisher.skip_count","0")
    self._rtcout.RTC_DEBUG("skip_count: %s", skip_count)

    skipn = [self._skipn]
    ret = OpenRTM_aist.stringTo(skipn, skip_count)
    if ret:
      self._skipn = skipn[0]
    else:
      self._rtcout.RTC_ERROR("invalid skip_count value: %s", skip_count)
      self._skipn = 0

    if self._skipn < 0:
      self._rtcout.RTC_ERROR("invalid skip_count value: %d", self._skipn)
      self._skipn = 0

    return
开发者ID:thomas-moulard,项目名称:python-openrtm-aist-deb,代码行数:40,代码来源:PublisherNew.py


注:本文中的OpenRTM_aist.stringTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。