How can I synchronize messages having the header and the value in two different topics?
Hi,
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
Asked by EdoardoSerri on 2020-11-16 06:49:21 UTC
Answers
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.
Asked by EdoardoSerri on 2020-11-17 03:04:54 UTC
Comments
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.
Asked by gvdhoorn on 2020-11-17 12:12:39 UTC
I just need to make it work...I have problems with the write function for rosbags
Asked by EdoardoSerri on 2020-11-18 03:48:28 UTC
Comments
What is a "header topic" and what is a "value topic"? Do you have a topic carrying just
std_msgs/Header
s?All the time synchronisers absolutely require messages to have
std_msgs/Header
s 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).Asked by gvdhoorn on 2020-11-16 11:58:57 UTC
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.Asked by EdoardoSerri on 2020-11-16 12:08:02 UTC
Why? That seems rather useless.
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.Asked by gvdhoorn on 2020-11-16 12:18:45 UTC