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++).
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.
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.
Since you're claiming that:
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.