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

ROS message subfolder

asked 2017-01-31 09:25:59 -0600

inspire gravatar image

updated 2017-03-18 08:15:33 -0600

130s gravatar image

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?


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-03-18 08:14:27 -0600

130s gravatar image

updated 2017-03-18 08:49:16 -0600

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
edit flag offensive delete link more


130s gravatar image 130s  ( 2017-03-18 08:50:24 -0600 )edit

Question Tools

1 follower


Asked: 2017-01-31 09:25:59 -0600

Seen: 1,740 times

Last updated: Mar 18 '17