Ask Your Question
1

Time Synchronizer with more than 9 incoming channels

asked 2012-06-29 00:29:33 -0600

andreas gravatar image

updated 2014-01-28 17:12:50 -0600

ngrennan gravatar image

Hi,

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?

edit retag flag offensive close merge delete

Comments

3

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.

Lorenz gravatar imageLorenz ( 2012-06-29 00:34:03 -0600 )edit

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.

Faizan A. gravatar imageFaizan A. ( 2013-10-08 04:16:08 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2012-07-01 01:43:10 -0600

Thomas gravatar image

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.

edit flag offensive delete link more
0

answered 2012-06-29 04:41:46 -0600

John Hoare gravatar image

updated 2012-06-29 04:42:22 -0600

This is a hack, but I believe the python version supports an arbitrarily long number of topics to synchronize. So you could write a node in python which synchronizes all 32 messages, puts them into a single message, and sends it on to your C++ program. Of course you're now hard-coding 32 image topics into that message, but maybe that's okay for your application?

Edit: Or of course, you could write your whole application in Python instead, but I was assuming from the question that it has to be in C++.

edit flag offensive delete link more

Comments

Hi John, thanks for you answer. Yes, it is possible in python. However, as performance is an issue in the application (especially with images) using python wouldn't be a good choice for me.

andreas gravatar imageandreas ( 2012-06-29 05:29:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-06-29 00:29:33 -0600

Seen: 551 times

Last updated: Jul 01 '12