extract_scans.py
Go to the documentation of this file.
1 import rosbag
2 import tf
3 import sys
4 from tf.msg import tfMessage
5 
6 if len(sys.argv) < 2:
7  print 'Usage: $ python extract_scans.py "2012-01-25-12-14-25"'
8  sys.exit(0)
9 
10 bagName = sys.argv[1]
11 with rosbag.Bag(bagName + '_scans.bag', 'w') as outbag:
12  print 'Processing ' + bagName + '.bag...'
13  for topic, msg, t in rosbag.Bag(bagName + '.bag').read_messages():
14  if topic == "/tf":
15  outbag.write(topic, msg, t)
16  elif topic == "/base_scan":
17  outbag.write(topic, msg, t)
18  elif topic == "/robot_pose_ekf/odom_combined":
19  outbag.write(topic, msg, t)
20 
21 print 'Output: ' + bagName + '_out.bag'


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Tue Jan 24 2023 04:04:40