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

How do you locate message source files based on a package name in catkin?

asked 2013-06-07 08:26:57 -0500

jbohren gravatar image

Previously, the orocos typekits for enabling orocos-ros integration were generated by processing each ".msg" file given a package name and then resolving the path to that package with rosbuild [1]. Now with catkin, we can't use rosbuild_find_package to find the message source files, is there some mechanism that we can use that works in both devel and install spaces?


edit retag flag offensive close merge delete


What exactly is happening, are you iterating over messages in specific packages on demand or should this behave more like a message generator which gets invoked each time a package which contains messages is built?

William gravatar image William  ( 2013-06-07 08:38:24 -0500 )edit

It might be suitable to be turned into a message generator, but you might not want it to happen for every package. Is there any documentation on writing custom message generators?

jbohren gravatar image jbohren  ( 2013-06-07 08:40:53 -0500 )edit

I'm not sure about that, but I would expect that there is not, @Dirk Thomas can probably say one way or the other.

William gravatar image William  ( 2013-06-07 08:43:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-07 09:04:19 -0500

Dirk Thomas gravatar image

updated 2013-06-07 09:04:59 -0500

The command line tool "rosmsg" provides the information you seem to need. "rosmsg package PKGNAME" outputs a list of messages for a specific package. "rosmsg show MSGNAME" than outputs the message definition. But the console tools might actually not be what you want to invoke from within CMake.

From withing CMake only the path of the directories where the message files are location can be accessed. A package does not expose a list of actual messages. To access these information you would need to include a specific CMake file generated and only used inside of genmsg. (But be aware that globbing the files might catch messages files which are never getting installed.)

find_package(catkin REQUIRED COMPONENTS std_msgs)
# std_msgs_MSG_INCLUDE_DIRS lists all folders from where messages (and services) of that package are located

Probably it is not desired to make the typekit generator a normal message generator since that would generate and embed the generated code into each and every message package and requires the message_generation package to depend on the typekit generator.

Probably the best way would be if every message package (after find_package()-ing) exposes a variable pointing to all available message files. That should be pretty easy to generate in genmsg using a CMake config extra files.

edit flag offensive delete link more


This sounds like exactly what we need. Thanks!

jbohren gravatar image jbohren  ( 2013-06-07 09:31:56 -0500 )edit

Question Tools


Asked: 2013-06-07 08:26:57 -0500

Seen: 1,454 times

Last updated: Jun 07 '13