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

Creating Msg & Srv issues

asked 2020-05-07 06:59:09 -0500

jimc91 gravatar image

I am very new to ROS & Ubuntu and am working through the ROS tutorials.

Specifically, I am currently creating and customising my own packages (see link below for tutorial I am currently referencing.

I am using ROS Kinetic & Ubuntu16.04 LTS.

In section 2.1 I am trying to create a msg and edit the CMakeLists.txt file, but I am confused with some of the instructions.

I have opened CMakeLists.txt in my text editor but I am unsure where to add the following text.

So the instructions are as follows;

Open CMakeLists.txt in your favorite text editor (rosed from the previous tutorial is a good option).

Add the message_generation dependency to the find_package call which already exists in your CMakeLists.txt so that you can generate messages. You can do this by simply adding message_generation to the list of COMPONENTS such that it looks like this:

Do not just add this to your CMakeLists.txt, modify the existing text to add message_generation before the closing parenthesis

find_package(catkin REQUIRED COMPONENTS






I am unsure where to add this to the text file

The instructions also state the following steps:

Also make sure you export the message runtime dependency.

catkin_package( ... CATKIN_DEPENDS message_runtime ... ...)

Find the following block of code:






Uncomment it by removing the # symbols and then replace the stand in Message*.msg files with your .msg file, such that it looks like this:



Num.msg )

By adding the .msg files manually, we make sure that CMake knows when it has to reconfigure the project after you add other .msg files.

I cannot find this in the text file

If anyone could provide guidance I would very much appreciate it. Sorry if this is a stupid question, but I am very new to this.

I have attached a snap of the CMakeLists.txt file for reference.

C:\fakepath\Page 1.png

C:\fakepath\Page 2.png

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-05-07 07:42:39 -0500

gvdhoorn gravatar image

updated 2020-05-07 07:43:50 -0500

I cannot find this in the text file

That's because the CMakeLists.txt you show in your screenshots (and please do not post screenshots of text, just copy-paste it into your question next time) is the wrong CMakeLists.txt.

Your own package has a CMakeLists.txt, and you should be editing that file.

The file you show is a system provided file, which you should not need to edit for anything. In general: if the tutorials ask you to edit any files, it will be files which are in your own packages.

If anyone could provide guidance I would very much appreciate it. Sorry if this is a stupid question, but I am very new to this.

It's a cliché, but there are no stupid questions.

We all had to start somewhere.

edit flag offensive delete link more


I found the correct .txt file, thank you for your help.

jimc91 gravatar image jimc91  ( 2020-05-07 08:24:37 -0500 )edit

Question Tools

1 follower


Asked: 2020-05-07 06:59:09 -0500

Seen: 242 times

Last updated: May 07 '20