How to subscribe to dynamic number of topics while using message_filters.TimeSynchronizer
I want to create a time syncronizer for n
topics.
Is there a way to create a callback function that can accept dynamic number of arguments?
I tried to do the following for n=4, but I got the error callback() takes exactly 2 argument (5 given)
n = 4
subs = []
for i in range(n):
sub = message_filters.Subscriber("/camera_{}".format(i), CompressedImage)
subs.append(sub)
time_sync = message_filters.ApproximateTimeSynchronizer(subs, 1, slop=0.05)
time_sync.registerCallback(callback)
def callback(self, **all_msgs):
pass
any updates? I'm working on the same problem.