Including custom message inside custom message (.msg files)

asked 2020-08-23 09:09:09 -0600

definitive gravatar image

I know it's possible to include ROS message type (for instance geometry_msgs/Point) inside custom message, you just have to link the message type inside package.xml. But it possible to include custom message in custom message? For example:


Header header
string some_text


int32 x
int32 y

For me it doesn't work. I didn't forget to put both msg files inside CMakeLists.txt. To ensure I created custom message without custom message inside and it works fine. What about custom message inside custom message?

edit retag flag offensive close merge delete



Yes, this is fully supported.

There is no technical difference between "ROS messages" and "custom messages". It's all the same infrastructure.


For me it doesn't work

is not something we can help you with.

If you would show actual error messages, perhaps board members could try to help you.

gvdhoorn gravatar image gvdhoorn  ( 2020-08-23 09:19:16 -0600 )edit

expected identifier before ‘;’ token _class_type class;

One of my fields was called "class". I figured it out after many attempts, but now it works. It should be mentioned in ros wiki, I think.

definitive gravatar image definitive  ( 2020-08-23 11:29:02 -0600 )edit

For future questions: please include complete and verbatim copies of commands you run and any output those generate.

Without sufficient information we cannot help you.

gvdhoorn gravatar image gvdhoorn  ( 2020-08-23 14:42:52 -0600 )edit