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

How do I generate a dynamic config module that depends on a message defined in the same package?

asked 2017-12-22 17:58:11 -0500

joq gravatar image

The CMakeLists.txt looks like this:

add_message_files(DIRECTORY msg FILES SensorLevels.msg)
catkin_package(CATKIN_DEPENDS dynamic_reconfigure message_runtime etc...)

The build fails the first time, like this:

Errors     << camera1394:make /home/joq/ros/ws/logs/camera1394/build.make.009.log                
Traceback (most recent call last):
  File "/home/joq/ros/ws/src/camera1394/cfg/Camera1394.cfg", line 37, in <module>
    from camera1394.msg import SensorLevels
ImportError: No module named msg
make[2]: *** [/home/joq/ros/ws/devel/.private/camera1394/include/camera1394/Camera1394Config.h] Error 1
make[1]: *** [CMakeFiles/camera1394_gencfg.dir/all] Error 2

Running the build again succeeds. Somehow, I need to force gencfg to wait on message generation.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-22 22:21:06 -0500

Dirk Thomas gravatar image

You will need to add an explicit dependency in CMake between the two steps to ensure that the message generation happens before the .cfg file is being invoked.

dynamic_reconfigure uses the OUTPUT signature a add_custom_command which is not a CMake target and can therefore not easily be dependent on. I think generate_dynamic_reconfigure_options would need to support an optional parameter to pass the expected header file <somewhere>/include/camera1394/Camera1394Config.h here:

edit flag offensive delete link more


Thanks, Dirk. I suspected that was the case, but wanted to ask before giving up on that approach.

joq gravatar image joq  ( 2017-12-23 10:04:57 -0500 )edit

Question Tools

1 follower


Asked: 2017-12-22 17:58:11 -0500

Seen: 252 times

Last updated: Dec 22 '17