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

Matching multiple topics, where one topic is processed

asked 2019-02-28 06:10:35 -0600

Jenas gravatar image

Hello, im quite new to ROS and am wondering how to subscribe to multiple topics where one topic comes from another node than the others. In my system I have three nodes: one who captures data from a sensor and publishes the data through multiple topics. The second node subscribes to some of the topics from the first node, processes the data and sends it to the third node. My third node receives data from both the second node and some processed data from the third node.

The thing is, that Im afraid the data from the processing node(second node) will lag behind the sensor node(first node), do you think that will be the case? Do you have any advice how to match the processed data with the data from the sensor?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-03-01 03:59:05 -0600

mali gravatar image

do you think that will be the case?

I think yes it could be the case because there is no grantee that the data coming from the first and second nodes will be synchronized.

Do you have any advice how to match the processed data with the data from the sensor?

one possible solution is to use the timestamp of the original data as a reference, in such a way that the first node time stamp raw data, the second node process data and send them with the same timestamp of the original data, the third node checks the time stamp of the raw and processed data, you can match them according to time stamp. I think there is no grantee that messages will be synchronized

edit flag offensive delete link more
0

answered 2019-03-01 04:10:19 -0600

mgruhler gravatar image

I agree with @mali that the data will not be synchronized.

For synchronizing data by timestamp (essentially @mali s suggestion), there is the message_filters package which offers a TimeSynchronizer and an ApproximateTimePolicy to sync incoming topics by timestamps. Which one you choose depends a little bit on the kind of data you expact.

(Without more details about your setup, I can only guess: TimeSynchronizer seems reasonable for the second node, if required, as I guess it should act on the topics published from the first node simultaneously, for the third node the ApproximateTimePolicy makes most sense, I guess)

edit flag offensive delete link more

Comments

I read the documentation of message_filters package, you are right it is the convenient way to solve the topic matching issue.

mali gravatar image mali  ( 2019-03-01 07:13:30 -0600 )edit

Awesome, thanks guys!

Jenas gravatar image Jenas  ( 2019-03-02 05:25:22 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-02-28 06:10:35 -0600

Seen: 417 times

Last updated: Mar 01 '19