本文整理匯總了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))