Ask Your Question
0

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

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

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?

[1] http://git.mech.kuleuven.be/?p=robotics/rtt_ros_integration.git;a=blob;f=rtt_rosnode/cmake/GenerateRTTtypekit.cmake;h=0f3db8775c6da823abfdecd448d5741e5b3216a5;hb=HEAD#l16

edit retag flag offensive close merge delete

Comments

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 imageWilliam ( 2013-06-07 08:38:24 -0600 )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 imagejbohren ( 2013-06-07 08:40:53 -0600 )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 imageWilliam ( 2013-06-07 08:43:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

Dirk Thomas gravatar image

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

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)
include("${std_msgs_DIR}/std_msgs-msg-paths.cmake"})
# 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

Comments

This sounds like exactly what we need. Thanks!

jbohren gravatar imagejbohren ( 2013-06-07 09:31:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 565 times

Last updated: Jun 07 '13