本文整理汇总了Python中bag.Bag._get_yaml_info方法的典型用法代码示例。如果您正苦于以下问题:Python Bag._get_yaml_info方法的具体用法?Python Bag._get_yaml_info怎么用?Python Bag._get_yaml_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bag.Bag
的用法示例。
在下文中一共展示了Bag._get_yaml_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: info_cmd
# 需要导入模块: from bag import Bag [as 别名]
# 或者: from bag.Bag import _get_yaml_info [as 别名]
def info_cmd(argv):
parser = optparse.OptionParser(usage='rosbag info [options] BAGFILE1 [BAGFILE2 BAGFILE3 ...]',
description='Summarize the contents of one or more bag files.')
parser.add_option('-y', '--yaml', dest='yaml', default=False, action='store_true', help='print information in YAML format')
parser.add_option('-k', '--key', dest='key', default=None, action='store', help='print information on the given key')
parser.add_option( '--freq', dest='freq', default=False, action='store_true', help='display topic message frequency statistics')
(options, args) = parser.parse_args(argv)
if len(args) == 0:
parser.error('You must specify at least 1 bag file.')
if options.key and not options.yaml:
parser.error('You can only specify key when printing in YAML format.')
for i, arg in enumerate(args):
try:
b = Bag(arg, 'r', skip_index=not options.freq)
if options.yaml:
info = b._get_yaml_info(key=options.key)
if info is not None:
print info
else:
print b
b.close()
if i < len(args) - 1:
print '---'
except ROSBagUnindexedException, ex:
print >> sys.stderr, 'ERROR bag unindexed: %s. Run rosbag reindex.' % arg
except ROSBagException, ex:
print >> sys.stderr, 'ERROR reading %s: %s' % (arg, str(ex))