How to use two topics without using TimeSynchronizer

asked 2019-05-17 18:54:03 -0500

paul_shuvo gravatar image

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.

edit retag flag offensive close merge delete

Comments

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.

Reamees gravatar image Reamees  ( 2019-05-20 01:21:49 -0500 )edit