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

How can I use my own .msg?

asked 2013-10-28 21:57:23 -0500

Mr Hillgren gravatar image

I've created my own .msg and can perform "rosmsg show MyMessage". The question is how can I use it in my C++ code?

I've seen this link that is exactly the same question ( however I don't really get it all. =(

Why is there a Header header in the .msg file? Is it "standard" to have in a msg?

Where Is the MyMessage.h file saved? How do I create It? I can only find the .msg file. Since I can't find it I cant Include it in the cpp file naturally.

It also states that I should add the line <depend package="my_custom_msg_package"/> in the manifest. When I do this i get an error saying: - The manifest must not contain the following tags: depend

How can I solve this?

Many Thanks, Patrik

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-28 23:05:23 -0500

Thomas gravatar image

1/ manifest.xml is now package.xml. Your should look like this one:

As the syntax changed the link you mention is now obsolete.

See the tutorial example here:

2/ A header is used to associate a timestamp and/or a frame with your message, this is very useful but not mandatory.

3/ Once you run cmake in your package, a directory called msg_gen will be created containing the headers and required source files. You don't have to really know where this directory is located. Just include #include <PACKAGE/MESSAGE> where PACKAGE is you package name and MESSAGE your message filename without the extension (mymsg.msg becomes mymsg).

edit flag offensive delete link more


Thanks for the quick response Thomas! I still have some trouble though, I explained it in the following question:

Mr Hillgren gravatar image Mr Hillgren  ( 2013-10-29 03:01:19 -0500 )edit

Question Tools

1 follower


Asked: 2013-10-28 21:57:23 -0500

Seen: 552 times

Last updated: Oct 28 '13