Rosanswers logo

Hi, I noticed that ROS does not correctly see message files in subfolders of the "msg" folder. The add_message_files command can take a DIRECTORY command which works partly:


Both catkin_make_isolated and catkin build run perfectly but after a source devel/setup.bash, the rosmsg list command does not show this testmessage. If I change the subfolder name to something different in the CMakeLists file, cmake complaints about the missing path. Hence, the folder path is recognized partly.

The only solution I found was to move all message files out of subfolders such they are directly placed at e.g., msg/testmessage.msg. Then, the rosmsg list command shows the message.

Is there another way to use subfolders for message definitions?


Originally posted by inspire on ROS Answers with karma: 23 on 2017-01-31

Post score: 1


1 Answer 1


Rosanswers logo

I confirmed this (my code, which modifies beginner_tutorial to add a new msg file "Num5.msg" in a sub folder). Although msg artifact is generated, the new msg doesn't appear in rosmsg list. Used catkin_make. I can, however, use the new message Num5.msg in my ROS program. E.g. rostopic pub Num5 beginner_tutorials/Num5 1 then subscribing to it can be done without problem.

More concrete commands and result:

roscd beginner_tutorials/msg
mkdir subfolder
(edit CMakeLists.txt to add subfolder to `add_message_files`)
echo "int64 num" > subfolder/Num2.msg
cd -
source devel/setup.bash


find ./devel -iname *Num2*    --> Generated.
rosmsg list|grep Num          --> Num2 not listed.
rostopic pub Num2 beginner_tutorials/Num2 1    --> Published.
rostopic echo /Num2    --> Printed as expected.

So maybe a specific issue with rosmsg list.

$ apt-cache policy ros-kinetic-catkin ros-kinetic-rosmsg   |grep Inst 
  Installed: 0.7.6-0xenial-20170217-212821-0800
  Installed: 1.12.7-0xenial-20170308-194441-0800

Originally posted by 130s with karma: 10937 on 2017-03-18

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by 130s on 2017-03-18:
Reported on ros_comm repo.


Your Answer

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