Rosanswers logo


I need to synchronize 32 image topics, which then trigger one common callback function. Unfortunately message_filters::TimeSynchronizer only supports up to 9 topics, and so does message_filters::sync_policies::ApproximateTime. I found a note to a DynamicTimeSynchronizer in the source code, but apparently it's not implemented yet. Is there an easy solution / workaround?

Cheers, Andreas

Btw: Is there a reason why the number of topics is hard coded?

Originally posted by andreas on ROS Answers with karma: 168 on 2012-06-29

Post score: 1

Original comments

Comment by Lorenz on 2012-06-29:
The reason why it is hard-coded is that the time synchronizer works on topics with different type, i.e. it needs to be templated on all types. Since C++ didn't support variadic templates before C++11, hard-coding was the only possibility.

Comment by Faizan A. on 2013-10-08:
Hi, I was just wondering if it is a good idea to divide the problem in 2 steps. i.e first synchronize 8 images and make them a new custom topic lets say "Image8" and publish it. That way the Image set of 32 is divided in to 4 sets. and then we can synchronize the 4 "Image8" topics aftwards.


1 Answer 1


Rosanswers logo

Your options are limited.

You can either use C++11 to extend the current TimeSynchronizer. By using cpp macros properly, you can make this mechanism totally optional which would allow to achieve your goal without imposing C++11 to the whole ROS community. It would be a reasonable design choice IMHO.

Another possibility is writing a TimeSynchronizer for several instance of one type. It is possible to do so without relying on metaprogramming. In your case, it would be sufficient.

Both would be interesting addition to message_filters, I think. But you'll probably need to fork the class you use by copying them into your own project as long as they are not integrated and part of the official release.

Originally posted by Thomas with karma: 4478 on 2012-07-01

This answer was ACCEPTED on the original site

Post score: 3


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.