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

'Use the cfg File' tutorial last command unclear

asked 2015-05-26 06:43:22 -0500

andrewwi gravatar image

updated 2018-06-26 00:08:21 -0500

130s gravatar image

Hi. Working through the tutorials in sequence. Following the last section 'Use the cfg File' on this page I edited CMakeLists.txt and added the following at line 13:

generate_dynamic_reconfigure_options(
  cfg/Tutorials.cfg
)

Ran $ ~/catkin_ws$ catkin_make and this did a build with no errors.

When I ran $ rosrun rqt_gui rqt_gui -s reconfigure , the gui opens but is blank and is missing any fields similar to that shown at the end of the tutorial page - http://wiki.ros.org/dynamic_reconfigu...

When I then add the rest of the CMakeLists.txt entries listed in the section 'Use the cfg File' ...

// make sure configure headers are built before any node using them
add_dependencies(server dynamic_tutorials_gencfg)

... I get this build CMake Error:

CMake Error at dynamic_tutorials/CMakeLists.txt:18 (add_dependencies):
  Cannot add target-level dependencies to non-existent target "server".

  The add_dependencies works for top-level logical targets created by the
  add_executable, add_library, or add_custom_target commands.  If you want to
  add file-level dependencies see the DEPENDS option of the add_custom_target
  and add_custom_command commands.

The tutorial is not clear on how to use add_dependencies() in CMakeLists.txt i.e. is tells the reader ...

// make sure configure headers are built before any node using them
add_dependencies(example_node ${PROJECT_NAME}_gencfg)

Does anyone know how to use this command correctly to get the server.py node show correctly in the gui?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-23 16:04:01 -0500

ams gravatar image

I had this problem when I was adding dynamic reconfiguration to a project of mine.

Make sure that the add_dependencies line is AFTER the line that declares the library or executable that the dependencies refer to. In my file, the relevant lines are :

## Declare a C++ executable
add_executable(cloud_segmenter src/CloudSegMain.cpp src/CloudSeg.cpp)

## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(cloud_segmenter ${PROJECT_NAME}_gencfg)

If they are the other way around, CMAKE tries to add dependencies to an executable or library that hasn't been declared yet, which is why it says the target is non-existent.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-05-26 06:43:22 -0500

Seen: 1,032 times

Last updated: Jun 26 '18