0
$\begingroup$

Rosanswers logo

I'm struggling compiling a catkin package with a Python node using dynamic_reconfigure.

This is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(motors)

find_package(catkin REQUIRED COMPONENTS
  rospy
  std_msgs
  message_generation
  dynamic_reconfigure
)

add_message_files(
  FILES
  MotorPower.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

generate_dynamic_reconfigure_options(
  cfg/pig.cfg
)

catkin_package(
  CATKIN_DEPENDS rospy std_msgs
)

add_dependencies(pid ${PROJECT_NAME}_gencfg)

And this is my package.xml:

<?xml version="1.0"?>
<package>
  <name>motors</name>
  <version>0.0.0</version>
  <description>The motors package</description>

  <maintainer email="[email protected]">ubuntu</maintainer>

  <license>todo</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>dynamic_reconfigure</build_depend>
  <run_depend>rospy</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>dynamic_reconfigure</run_depend>

  <export>
  </export>
</package>

Unfortunately I'm getting the error:

CMake Error at motors/CMakeLists.txt:29 (add_dependencies): Cannot add target-level dependencies to non-existent target "pid".

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.

How can I introduce the "pid" node (located in the file scripts/pid.py) as a target? add_executable and add_library only seem to work for C nodes.

Or is there any self-containing example project or tutorial? Currently I'm following the default ROS tutorial on dynamic_reconfigure.


Originally posted by Falko on ROS Answers with karma: 268 on 2016-03-10

Post score: 3

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Afaik, you don't need to add_dependencies(..) for a Python node. You won't be compiling the Python node, so it won't need the dyn cfg files at compile time. add_dependencies(..) is used to make sure dyn cfg is generated before C/C++ nodes are compiled that include the headers.

Also: note that your DynCfg file is called cfg/piG.cfg, while your add_dependencies(..) statement references something called piD.

And: see catkin 0.6.17 documentation - Dynamic reconfiguration for documentation on what to do for Dynamic Reconfigure (but again: some steps are for C++ only).


Originally posted by gvdhoorn with karma: 86574 on 2016-03-10

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by Falko on 2016-03-10:
Oh wow, @gvdhoorn! It just was the typo "pig" instead of "pid"! Thanks so much! Now it's compiling (without add_dependencies). :)

Comment by gvdhoorn on 2016-03-10:
Good to hear. Glad the world still makes sense :).

Comment by joq on 2016-03-10:
If your problem is solved, please check mark the answer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.