rospy TimeSynchronizer with rosbag play *.bag --clock --loop -r 0.1, use_sim_time=true?

asked 2022-04-22 07:15:36 -0500

lucasw gravatar image

updated 2022-10-07 12:13:03 -0500

When I was playing back 3 bag files using use_sim_time true and --clock and --loop I noticed the more I lowered the real time playback factor the less a python exact time synchronizer (with three topics) callback was called (factoring out the lower play back rate of course). So -r 0.1 triggered the callback at a tiny rate of the 3 subscribed topics, maybe 1 in a hundred, -r 0.5 is maybe getting a half or third of the syncs that ought to happen.

There are a lot of interacting pieces here so multiple things to try: so far increasing the synchronizer queue_size didn't help, I'll try increasing the rosbag play queue size next, see if something in the synchronizer code is using the system time instead of the sim clock time (maybe it throws out old messages that aren't really old in the slow motion sim time), making a minimal reproducible example. https://github.com/ros/ros_comm/issue... suggests calling init() on the synchronizer when time loops, so I can try that and try bag playback without looping.

update

--clock and --loop are unrelated, just playing back a single merged back (with bag stamps rewritten to header.stamp time where available) still exhibits the same poor sync performance.

It looks like syncing an Image topic to a small non-image topic message type causes the issue (possibly other large size topics as well), two compressed images sync to each other well and any two small message type topics sync well.

rosbag play --queue_size 100000 or size 0 seems to help a little, but still nowhere near performance that would be achieved when running the sync live.

https://answers.ros.org/question/1064... looks related to this

edit retag flag offensive close merge delete

Comments

1

I think I'm figuring out just now what I thought were synchronized message actually aren't- they were originally synchronized live but there's a step in my system that regenerates them incorrectly later when I get to playing back the bags- didn't realize that until now

lucasw gravatar image lucasw  ( 2022-10-07 15:07:53 -0500 )edit