How to use two topics without using TimeSynchronizer
I need an Image
topic and a PointCloud2
topic to find pose but it takes so long to get the PointCloud2
message that the process hangs and never triggers the callback. I've used both TimeSynchronizer
and ApproximateTImeSynchronizer
to no avail.
I was wondering if there's a way where I can use two different functions that keep the last received messages in a global or class variable for the two topics and updates it, and I can work with the two topics in a different function.
I'd really appreciate any help. Thanks.
I was wondering if there's a way where I can use two different functions that keep the last received messages in a global or class variable for the two topics and updates it, and I can work with the two topics in a different function.
Yes you can do that.
Simplest thing to implement would be to have two callbacks, one each for the image and pointcloud topic. Store latest values, if both of the values are set call the processing function.