0
$\begingroup$

Rosanswers logo

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.

http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv

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

roscpp

rospy

std_msgs

message_generation

)

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:

add_message_files(

FILES

Message1.msg

Message2.msg

)

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:

add_message_files(

FILES

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


Originally posted by jimc91 on ROS Answers with karma: 29 on 2020-05-07

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by gvdhoorn with karma: 86574 on 2020-05-07

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by jimc91 on 2020-05-07:
I found the correct .txt file, thank you for your help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.