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

Self defined messages

asked 2019-09-23 03:00:43 -0500

drodgu gravatar image

Hi everyone,

I'm a bit new in ROS and I want to know how to create a self described message and use it in ROS to exchange information between ROS nodes. I've found this ros answer 1 and this video 2 about how to create and use you own ROS message. But there's still some question that remains unanswer or unclear for me.

1) You have to call a header file to start using your own message as the video and the answer question show, but what should I code in that header file (my_msg.h) and its realated cpp file (my_msg.cpp)? Or they must stay empty and its a trick ROS use to call self described messages? If anyone could done or refer me to a github easy example of an self defined message I will be very pleased.

2) Do you have to add any dependence or export any dependence of that package? If so, how can I do it?

Thanks in advance for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-23 03:21:37 -0500

Choco93 gravatar image
  1. No, you don't have to create header, when you build your message it will do that for you.
  2. If the message you built is in the same package as your node, then you don't need to add package dependency, but if message was built in a different package, then you need to add that package as a dependency.
edit flag offensive delete link more


Thank you very much! I add also this video in which is explained how to setup your own message. Video

drodgu gravatar image drodgu  ( 2019-09-23 03:25:50 -0500 )edit

Question Tools

1 follower


Asked: 2019-09-23 03:00:43 -0500

Seen: 621 times

Last updated: Sep 23 '19