Matching multiple topics, where one topic is processed
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?
Asked by Jenas on 2019-02-28 07:10:35 UTC
Answers
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
Asked by mali on 2019-03-01 04:59:05 UTC
Comments
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)
Asked by mgruhler on 2019-03-01 05:10:19 UTC
Comments
I read the documentation of message_filters package, you are right it is the convenient way to solve the topic matching issue.
Asked by mali on 2019-03-01 08:13:30 UTC
Awesome, thanks guys!
Asked by Jenas on 2019-03-02 06:25:22 UTC
Comments