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

Catkin_make a package with dynamic_reconfigure for Python node

asked 2016-03-10 06:00:18 -0500

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="ubuntu@todo.todo">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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2016-03-10 06:56:58 -0500

gvdhoorn gravatar image

updated 2016-03-10 07:36:37 -0500

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).

edit flag offensive delete link more

Comments

1

Oh wow, @gvdhoorn! It just was the typo "pig" instead of "pid"! Thanks so much! Now it's compiling (without add_dependencies). :)

Falko gravatar image Falko  ( 2016-03-10 07:18:18 -0500 )edit

Good to hear. Glad the world still makes sense :).

gvdhoorn gravatar image gvdhoorn  ( 2016-03-10 07:37:41 -0500 )edit

If your problem is solved, please check mark the answer.

joq gravatar image joq  ( 2016-03-10 10:32:10 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-10 06:00:18 -0500

Seen: 1,336 times

Last updated: Mar 10 '16