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

How can I synchronize messages having the header and the value in two different topics?

asked 2020-11-16 05:49:21 -0500

EdoardoSerri gravatar image


I'm trying to Approximately Synchronize messages, without success. I've tried to do a subscriber that reads the messages I want to synchronize, but it gives me out a warning telling me there is no header, the same if I try to synchronize the headers topics or the header topic with the corresponding value topic.

I know I can use allow_headerless = True, but I need to use time stamps given in the rosbag.

My idea was to merge the two topics (header and value) together, to finally be able to use AppoximateTimeSynchronizer with the rosbag timestamp, but I didn't find much around and I don' know if it is possible to be done. It is possible to do how I've thought about? If not, is there another way to solve this problem?

Thank you

edit retag flag offensive close merge delete


What is a "header topic" and what is a "value topic"? Do you have a topic carrying just std_msgs/Headers?

All the time synchronisers absolutely require messages to have std_msgs/Headers embedded in them. They cannot work otherwise (except the Python implementation, but that's essentially cheating: it'll take the value of reception of a message, instead of an actual stamp).

gvdhoorn gravatar image gvdhoorn  ( 2020-11-16 10:58:57 -0500 )edit

Hi, yes exactly. I have a topic carrying only std_msgs/Header. In fact, I'm looking for ways to solve this problem, even cheating.

EdoardoSerri gravatar image EdoardoSerri  ( 2020-11-16 11:08:02 -0500 )edit

Hi, yes exactly. I have a topic carrying only std_msgs/Header.

Why? That seems rather useless.

In fact, I'm looking for ways to solve this problem, even cheating.

Without writing custom code, only the Python version supports using headerless messages. But I guess you already figured that out.

As you mention this is in a .bag: what about fixing the bag? The Python rosbag API cookbook has quite a few examples you could use.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-16 11:18:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-11-17 02:04:54 -0500

EdoardoSerri gravatar image

Thank you for the help. I kind solved the problem by creating another rosbag with new format messages with the header and the value together, as it should be.

edit flag offensive delete link more


If you could post (some snippets of) the program you used to combine the Header topic with the value topic, that would make your answer really valuable to future readers.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-17 11:12:39 -0500 )edit

I just need to make it work...I have problems with the write function for rosbags

EdoardoSerri gravatar image EdoardoSerri  ( 2020-11-18 02:48:28 -0500 )edit

Question Tools

1 follower


Asked: 2020-11-16 05:49:21 -0500

Seen: 203 times

Last updated: Nov 16 '20