7 from sensor_msgs.msg
import Image
10 print "Usage: {} <bag_name> <topic> <timeshift>".format(os.path.basename(sys.argv[0]))
13 input_bag_name = sys.argv[1]
14 topic_name = sys.argv[2]
15 time_shift = rospy.Duration(float(sys.argv[3]))
21 print "Could not open bag {}".format(input_bag_name)
25 name, ext = os.path.splitext(input_bag_name)
26 output_bag_name =
"{name}_timeshifted{ext}".format(name=name, ext=ext)
29 for topic, msg, t
in input_bag.read_messages():
30 if topic == topic_name:
31 msg.header.stamp += time_shift
32 output_bag.write(topic, msg, t)
34 output_bag.write(topic, msg, t)