Time synchronization rosbag file with python (no roscore)
Hi everybody,
I'm trying to synchronize multiple topics from a rosbag. The problem is I need to do this without running the roscore, so I can't define a subscriber and use ApproximateTimeSynchronizer
function.
My idea was to read the timestamps of the different topics, make the difference and, if the difference was under a certain threshold, I can print out the message from both the topics. The drawback is I cannot do this for 3 or more topics.
My question is, does a smarter way to do this exist? Some useful function? Because I can't find anything about this.
You didn't say in which language you're trying to do this, so: the
rosbag
API cookbook page has a C++ example of using theTimeSynchronizer
with a.bag
: Analyzing Stereo Camera Data.It essentially uses the exact same
message_filters
class, but then feeds it messages from the.bag
, instead of "live messages".And I haven't checked, but it could be that fkie_message_filters makes this easier.
Thank you, I wrote in the title about python. I will look for it in C++ examples and try to convert them in python.
seems like you did. Apologies, I missed that.