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

Is the .msg in memory format the same for ROS1 and ROS2?

asked 2018-05-04 13:43:26 -0600

alcoholiday gravatar image

If I defined some some type FOO, with members X and Y, will the in memory structure generated from .msg "rosidl" be the same as the the in memory structure generated from the rosidl_dds generated .idl? That is, if I do pointer math like (void) myfoo.X - (void) myfoo.Y will I get the same answer in ROS1 and ROS2?

I understand that there are wire format differences, but does the DDS version basically wrap the ROS1 version, such that if I get a pointer to my FOO, I can pass it to the same function regardless of which transport we use?

Realize this is pretty basic, so appreciate the help and patience!

edit retag flag offensive close merge delete

Comments

I don't understand what (void) myfoo.X - (void) myfoo.Y should do, are you calculating an offset into the message structure?

William gravatar image William  ( 2018-05-04 15:57:39 -0600 )edit

It was just my lame way of saying that the byte layout of the structure was the same. It may not have been a helpful clarification. :)

alcoholiday gravatar image alcoholiday  ( 2018-05-04 19:32:32 -0600 )edit

Ok, that's fine. I don't think the byte layout will be the same, since some of the types have changed (byte is now unsigned, and time and duration are now messages, not built-in types). You can compare the ROS 1 with the ROS 2: http://design.ros2.org/articles/inter...

William gravatar image William  ( 2018-05-04 19:35:17 -0600 )edit

It looks like the primitive types like byte/char/uint8/uint16, etc are all the same, so maybe as long as the messages are expressed using the those primitives, the structures would be the same.

But if the "time" type has a different layout in ros2, then I would not expect those to be compatible.

alcoholiday gravatar image alcoholiday  ( 2018-05-04 20:04:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-04 15:47:49 -0600

tfoote gravatar image

No the in memory layouts are not exactly the same. They are similar and have similar APIs for easier porting, but they are not intended to be compatible.

edit flag offensive delete link more

Comments

Thanks. I thought I read that when using FastRTPS that the DDS .idl is ignored. So maybe my question should be, is this ALSO the case when using the default middleware on top of FastRTPS?

alcoholiday gravatar image alcoholiday  ( 2018-05-04 19:34:04 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2018-05-04 13:42:41 -0600

Seen: 361 times

Last updated: May 04 '18