ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS2: how are msgs serialised (compared to ROS1)?

asked 2021-02-09 08:21:37 -0500

Ariel gravatar image

updated 2021-02-10 10:51:16 -0500

gvdhoorn gravatar image


I have two questions about the Connection Header:

  1. I have a ROS1 application where I rely on the Connection Header and I would like to know how is that handle in ROS2? I am only concerned about messages.
  2. Is it possible to "dump" the connection header (in ROS1 and/or ROS2) of a publisher for a given topic to a file?

Basically what I am trying to figure out if data is serialized the same way in ROS2 as it was in ROS1 to be transmitted. That means, starting 4 bytes with total length of the entire message and then each variable with its bytes and its length if it is a string or array.

Thanks for the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-09 13:09:22 -0500

gvdhoorn gravatar image

Basically what I am trying to figure out if data is serialized the same way in ROS2 as it was in ROS1 to be transmitted.

No, not at all.

ROS 2 uses DDS by default (there are other middleware choices).

See the ROS 2 design site. The articles about the middleware choice(s) are probably interesting and relevant.

edit flag offensive delete link more


So that is for the communication part, but for what I understood, ROS2uses FAST-CDR for the serialization, before broadcasting it. So my 2nd question was if it is possible to get that serialization as well for a given message in the node itself?

Ariel gravatar image Ariel  ( 2021-02-10 02:48:38 -0500 )edit

As you should know, posting follow-up questions as comments under questions which have been answered is not a good idea. Those questions (and any potential answers) have very low visibility.

Asking two questions in a single post here on ROS Answers isn't a good idea in general.

You might want to post a new question.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-10 02:50:01 -0500 )edit

Good point. Just in case, I found the answer by using this:

Ariel gravatar image Ariel  ( 2021-02-10 12:17:20 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-02-09 08:21:37 -0500

Seen: 189 times

Last updated: Feb 10 '21