Created
April 22, 2018 17:36
-
-
Save ddimarco/f3e22b27d16f7d3d8f2b9c5dece3a78c to your computer and use it in GitHub Desktop.
Opens a rosbag & shows connection information on all topics. Requires a patched `rosbag` package.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
from __future__ import print_function | |
import sys | |
from rosbag.bag import Bag | |
def main(): | |
if len(sys.argv) != 2: | |
print ('usage: {script} <bagfile>'.format(script=sys.argv[0])) | |
sys.exit(-1) | |
inbag = Bag(sys.argv[1], 'r') | |
headers = {} | |
for topic, _, _, conn_header in inbag.read_messages(raw=True, return_connection_header=True): | |
headers[topic] = conn_header | |
for topic, header in headers.iteritems(): | |
print ('{topic}: {header}'.format(topic=topic, header=header)) | |
inbag.close() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment