ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
-1

ROS message filter

asked 2019-09-24 01:34:31 -0500

shoaibazam gravatar image

I have two topics and I want to synchronize them. So, I have used the message filter but it not entering in the callback. The two topics are different and coming at different rate. So kindly help me with the solution.

edit retag flag offensive close merge delete

Comments

2

I would suggest you show some code and provide more information on the message types and application setup.

Without that, I doubt many members here would be able to help you -- we don't have crystal balls.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-24 02:31:12 -0500 )edit

yes sure. Actually I am subscribing the two topics. One is from camera running at 10Hz and one is gps data running at 100 Hz and I want to fuse their information or to sync them so that for every gps position i have respective image.

shoaibazam gravatar image shoaibazam  ( 2019-09-24 03:40:58 -0500 )edit
5

Since you're claiming that:

I have used the message filter but it not entering in the callback

we're going to need to see said code. Note: we don't need all code. But seeing the callbacks and how you setup the message_filter classes would help.

And examples of the messages that are published on those topics. You can use rostopic echo -n1 --noarr /name/of/topic and copy-paste the output into your question.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-24 04:21:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-10-03 12:17:00 -0500

Mark Rose gravatar image

You could use ApproximateTimeSynchronizer for this, but with topics that have such different frequencies you may be better off having two separate callbacks and storing a reference to the most recent data in one of the callbacks, and letting the second callback use the stored data along with its new message.

I'd probably perform the processing in the image callback only, using the most recent (stored) GPS position, since that's going to have the smallest average position error from the image capture position.

If you want to use message_filters, you'll need to use the approximate time policy, since the messages won't have exactly matching timestamps. See https://docs.ros.org/api/message_filt... (Python) or https://wiki.ros.org/message_filters#... (C++).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2019-09-24 01:34:31 -0500

Seen: 456 times

Last updated: Oct 03 '19