ros2 / message_filters

BSD 3-Clause "New" or "Revised" License
76 stars 66 forks source link

Parallel callback execution with ApproximateTimeSynchronizer #65

Closed karl-schulz closed 3 years ago

karl-schulz commented 3 years ago

Currently, the ApproximateTimeSynchronizer only allows the execution of one callback simultaneously, as the call to self.signalMessage(*msgs) is inside of the lock.

For parallel execution oif callbacks (e.g. using a MultithreadedExecutor) it would be desirable to have the callback call outside of this lock. Parallel threads could then acquire the lock again and start comparing timestamps. This would allow a higher throughput for callbacks that take some time to process, in our case a deep learning model.

Additionally, the usage of a context manager for the lock and more inline comments would probably make the code more readable.

To sum it up, handle inside the lock:

Afterwards, outside of the lock

What do you think about this? We will implement this change internally and report if we can parallel execution to work.

karl-schulz commented 3 years ago

I just realized this is not the Python repo... sorry! Where can I find it?

rawnam commented 1 year ago

Did you find a solution to this problem? Please let me know your thoughts on this.