本文整理汇总了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