當前位置: 首頁>>代碼示例>>Python>>正文


Python Timeline.record_bag方法代碼示例

本文整理匯總了Python中timeline.Timeline.record_bag方法的典型用法代碼示例。如果您正苦於以下問題:Python Timeline.record_bag方法的具體用法?Python Timeline.record_bag怎麽用?Python Timeline.record_bag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在timeline.Timeline的用法示例。


在下文中一共展示了Timeline.record_bag方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: OnInit

# 需要導入模塊: from timeline import Timeline [as 別名]
# 或者: from timeline.Timeline import record_bag [as 別名]
    def OnInit(self):
        try:
            if self.options.record:
                # Connect to ROS master
                if not self.connect_to_ros():
                    raise Exception('recording requires connection to master')

                # Get filename to record to
                record_filename = time.strftime('%Y-%m-%d-%H-%M-%S.bag', time.localtime(time.time()))
                if self.options.name:
                    record_filename = self.options.name
                    if not record_filename.endswith('.bag'):
                        record_filename += '.bag'
                elif self.options.prefix:
                    prefix = self.options.prefix
                    if prefix.endswith('.bag'):
                        prefix = prefix[:-len('.bag')]
                    if prefix:
                        record_filename = '%s_%s' % (prefix, record_filename)

                rospy.loginfo('Recording to %s.' % record_filename)

            # Create main timeline frame
            self.frame = BaseFrame(None, 'rxbag', 'Timeline')
            self.frame.BackgroundColour = wx.WHITE
            self.frame.Bind(wx.EVT_CLOSE, lambda e: wx.Exit())

            scroll = wx.ScrolledWindow(self.frame, -1)
            scroll.BackgroundColour = wx.WHITE
            
            timeline = Timeline(scroll, -1)
            timeline.Size = (100, 100)
            
            self.frame.Show()
            self.SetTopWindow(self.frame)

            timeline.SetFocus()

            if self.options.record:
                timeline.record_bag(record_filename, all=self.options.all, topics=self.args, regex=self.options.regex, limit=self.options.limit)
            else:
                RxBagInitThread(self, timeline)

        except Exception, ex:
            print >> sys.stderr, 'Error initializing application:', ex
            #import traceback
            #traceback.print_exc()
            return False
開發者ID:strawlab,項目名稱:rx,代碼行數:50,代碼來源:rxbag_app.py


注:本文中的timeline.Timeline.record_bag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。