Go to the documentation of this file.00001 import rosbag
00002
00003 num_msgs = 100
00004
00005 with rosbag.Bag('head.bag', 'w') as outbag:
00006 for topic, msg, t in rosbag.Bag('raw.bag').read_messages():
00007 if num_msgs < 1:
00008 break
00009 num_msgs -= 1
00010 outbag.write(topic, msg, t)