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

CMake Error: File /cmake/setup_custom_pythonpath.sh.in does not exist.

asked 2019-03-20 03:28:23 -0600

Jägermeister gravatar image

updated 2019-03-20 04:09:14 -0600

I have the following lines in my CMakeLists.txt and I am not able to use catkin_make.

generate_dynamic_reconfigure_options(
   config/dyn_reconf.cfg
)

The full error message:

CMake Error: File /cmake/setup_custom_pythonpath.sh.in does not exist.
CMake Error at /opt/ros/melodic/share/dynamic_reconfigure/cmake/dynamic_reconfigure-macros.cmake:42 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  ../project/CMakeLists.txt:94 (generate_dynamic_reconfigure_options)

Here is my dyn_reconf.cfg:

#!/usr/bin/env python
PACKAGE = "project"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

gen.add("Resizing Factor",   double_t, 0, "A float parameter to make the original image's resolution",  0.3) 
gen.add("Hough Circle Upper Threshold", int_t, 0, "One of the Hough parameters", 100)
gen.add("Hough Circle Lower Threshold", int_t, 0, "One of the Hough parameters", 30)
gen.add("Hough Circle Min Radius", int_t, 0, "One of the Hough parameters", 10)
gen.add("Hough Circle Max Radius", int_t, 0, "One of the Hough parameters", 30)

exit(gen.generate(PACKAGE, "project", "dyn_reconf"))

and this is how I imported it:

from dynamic_reconfigure.server import Server
from dyn_reconf.cfg import dyn_reconf

EDIT: Adding the rest of CMakeLists.txt:

EDIT2: Updated CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(project)

find_package(catkin REQUIRED COMPONENTS
  image_geometry
  rospy
  sensor_msgs
  std_msgs
  dynamic_reconfigure
)

generate_dynamic_reconfigure_options(
   config/dyn_reconf.cfg
)

catkin_package(
   CATKIN_DEPENDS image_geometry  rospy sensor_msgs std_msgs dynamic_reconfigure
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

add_dependencies(project ${${PROJECT_NAME}_EXPORTED_TARGETS})
edit retag flag offensive close merge delete

Comments

Can you show your CMakeLists.txt? Did this ever work, or is it a new package / have you just added dyn recfg to it?

According to this, ${dynamic_reconfigure_BASE_DIR} would have to be empty for this to happen, if I interprete things correctly.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-20 03:36:26 -0600 )edit

My package has been working all OK. Now that I want to use dynamic reconfigure, it doesn't compile. In other words, I am facing this error while trying to use dynamic reconfigure for the first time.

Jägermeister gravatar image Jägermeister  ( 2019-03-20 03:44:02 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-03-20 03:46:16 -0600

gvdhoorn gravatar image

updated 2019-03-20 03:48:14 -0600

I'm not sure how you are even able to call generate_dynamic_reconfigure_options(..), but as explained in the first tutorial, you must add the dynamic_reconfigure dependency to your package, otherwise it won't work.

You have to add dynamic_reconfigure to the find_package(catkin REQUIRED COMPONENTS ..) call in your CMakeLists.txt (and to your package.xml as a dependency).

Note: you also don't have a catkin_package(..) there, which you should probably add.

See also the Catkin documentation on dynamic_reconfigure: Dynamic reconfiguration.

edit flag offensive delete link more

Comments

I tried adding add_dependencies(project ${${PROJECT_NAME}_EXPORTED_TARGETS}) but it throws the error of Cannot add target-level dependencies to non-existent target "project".

Jägermeister gravatar image Jägermeister  ( 2019-03-20 04:00:05 -0600 )edit

Ignore that bit for now. First get your dependency declarations correct.

Is this a Python package? Or have you not shown us your full CMakeLists.txt?

gvdhoorn gravatar image gvdhoorn  ( 2019-03-20 04:01:49 -0600 )edit

This is a Python package, and I did everything written in the page above. The error in the above comment came after I followed the instructions. Anyway, updating the question so that you see the new CMakeLists.txt.

Jägermeister gravatar image Jägermeister  ( 2019-03-20 04:09:16 -0600 )edit
1

Don't add the add_dependencies(..) bit. That is for C++ packages only.

You don't need the include_directories(..) call either. Python doesn't use any of that.


Edit: I've submitted a PR to note that add_dependencies(..) is only for C++ packages (ros/catkin#1001).

gvdhoorn gravatar image gvdhoorn  ( 2019-03-20 04:11:35 -0600 )edit

Yes, that was the problem now. Thanks, now it's compiling.

EDIT: Great idea, that would save time for the future learners.

Jägermeister gravatar image Jägermeister  ( 2019-03-20 04:13:25 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-03-20 03:28:23 -0600

Seen: 698 times

Last updated: Mar 20 '19