ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to use registerCallback of message_filters with unpublished topics?

asked 2019-01-25 02:25:08 -0500

Hsi-Hsuan Wu gravatar image

I try to use message_filters to fuse the pointclouds, and output one topic. But it seems like message_filters's callback function need all topics are published, otherwise it doesn't callback. But sometimes I would like to close some sensors and stop to publishing. How to solve this problem?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-25 02:47:36 -0500

gvdhoorn gravatar image

updated 2019-01-25 02:51:21 -0500

The idea behind message_filters is that it only invokes callbacks when it has messages in its queues for all subscriptions and those messages make the associated predicates true (ie: for an ApproximateTimeSynchronizer all stamps fall within a certain range of time).

Your callbacks not getting called when one of the datastreams is no longer carrying messages would seem to be expected (and desired) behaviour.

Perhaps message_filters is not the best approach for your use-case: if you could describe what you're trying to do with a little more detail, perhaps we can suggest an alternative.

Edit: you could perhaps implement your own filter that behaves like you describe, using the infrastructure of message_filters. And perhaps take a look at fkie_message_filters, which offers some additional / alternative functionality.

edit flag offensive delete link more


@gvdhoorn Thanks for the suggestion. I understand that how the API working. I'm trying to merge two Lidars signal into one pointcloud, but I need single data of Lidar in some scenarios. My original plan is that if I close one of the Lidars, I can get other Lidar's data without additional steps.

Hsi-Hsuan Wu gravatar image Hsi-Hsuan Wu  ( 2019-01-25 03:57:56 -0500 )edit

I will try fkie_message_filters. If it doesn't work I will try to assign name of updating topic in the command line. Thanks.

Hsi-Hsuan Wu gravatar image Hsi-Hsuan Wu  ( 2019-01-25 04:01:54 -0500 )edit

You could consider writing a time-synchroniser filter that always calls registered callbacks, but uses old msgs it has cached for the subscriptions that have not published any msgs in a certain amount of time.

Perhaps fkie_message_filters makes this easier. I don't know.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-25 05:46:15 -0500 )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


Asked: 2019-01-25 02:22:02 -0500

Seen: 188 times

Last updated: Jan 25 '19