9 if __name__==
'__main__':
10 rospy.init_node(
'rosbaglive')
15 for arg
in sys.argv[1:]:
21 loop_sleep = float(arg[2:])
24 rospy.logerr(
"No Bag specified!")
29 rospy.loginfo(
'Start read')
33 for topic, msg, t
in bag.read_messages():
35 pub = rospy.Publisher(topic, type(msg), latch=(
'map' in topic))
39 data.append( (t, []) )
41 data[-1][1].append( (topic, msg) )
42 rospy.loginfo(
'Done read')
43 start = rospy.Time.now()
45 while not rospy.is_shutdown():
47 now = rospy.Time.now()
51 real_time = now - start
52 sim_time = t - sim_start
53 if sim_time > real_time:
54 rospy.sleep( sim_time - real_time)
56 for (topic, msg)
in msgs:
57 if 'header' in dir(msg):
58 msg.header.stamp = now
59 elif 'transforms' in dir(msg):
60 for tf
in msg.transforms:
64 if rospy.is_shutdown():
69 rospy.sleep(loop_sleep)