Time synchronization rosbag file with python (no roscore)

asked 2020-11-23 04:47:57 -0500

EdoardoSerri gravatar image

updated 2021-02-05 22:46:19 -0500

lucasw gravatar image

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.

edit retag flag offensive close merge delete

Comments

1

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 the TimeSynchronizer 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.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-23 05:42:35 -0500 )edit

Thank you, I wrote in the title about python. I will look for it in C++ examples and try to convert them in python.

EdoardoSerri gravatar image EdoardoSerri  ( 2020-11-23 08:45:05 -0500 )edit

I wrote in the title about python

seems like you did. Apologies, I missed that.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-23 09:26:51 -0500 )edit