Sure. It may be easier to just use rosbag play on a bag in which the message timestamps have been rewritten to their header timestamp (if available), i.e.
import roslib; roslib.load_manifest('rosbag')import sys, rosbagoutbag = rosbag.Bag(sys.argv[2], 'w')try:for topic, msg, t in rosbag.Bag(sys.argv[1]).read_messages():outbag.write(topic, msg, msg.header.stamp if msg._has_header else t)finally:outbag.close()
-- Armin Hornung Albert-Ludwigs-Universität www.informatik.uni-freiburg.de/~hornunga Dept. of Computer Science HornungA@informatik.uni-freiburg.de Humanoid Robots Lab Tel.: +49 (0)761-203-8010 Georges-Köhler-Allee 79 Fax : +49 (0)761-203-8007 D-79110 Freiburg, Germany