# Modifying Catkin Include Order to use Source Package over Debian Package

I am attempting to use a custom set of ros_control headers (specifically for the controller_manager class) in a package that depends on nearly a dozen other packages, some of which I cannot modify. I am building the ROS ros_control package from source and I expected this to supersede the Debian version of ros_control, however, it is still using the Debian headers.

The problem appears to stem from the include path used by catkin_make. With verbosity turned on, catkin_make shows /opt/ros/indigo/include/ as the first include path. Ideally, this should be one of the last include paths. I'm guessing that one of my dependencies is messing up the include path, but I don't know find which one or if I can even modify the package.

How do I ensure that /opt/ros/indigo/include gets put at the end of the include path list? I would preferably like to only modify my current package's CMakeList.txt.

I'm getting the following error. The getRunningControllersListRealTime(std::vector<std::string>& v) is a custom function that I know works in other parts of the system, so I know that the wrong set of headers are being used for some reason.

/home/USERNAME/flor_repo/catkin_ws/src/thor_control/valor_ros_control/valor_escher_controller/src/ValorEscherController.cpp:314:13: error: ‘class controller_manager::ControllerManager’ has no member named   ‘getRunningControllersListRealTime’
mode_cm_->getRunningControllersListRealTime(running_controllers_list); // get list of all controllers currently loaded in this manager
^


With Catkin's verbose flag turned on, I get the following output indicating that the Indigo headers are first in the include list. I don't know how those headers got put first, but I need a way of moving them to the end of my include list using my package's CMakeList.txt.

[ 80%] Building CXX object thor_control/valor_ros_control/valor_escher_controller/CMakeFiles/valor_escher_controller.dir/src/ValorEscherController.cpp.o
cd /home/james/flor_repo/catkin_ws/build/thor_control/valor_ros_control/valor_escher_controller && /usr/bin/c++   -DROSCONSOLE_BACKEND_LOG4CXX -DROS_BUILD_SHARED_LIBS=1 -DROS_PACKAGE_NAME=\"valor_escher_controller\" -Dvalor_escher_controller_EXPORTS -std=gnu++0x -O3 -DNDEBUG -fPIC **-I/opt/ros/indigo/include** -I/usr/include/eigen3 -I/home/james/flor_repo/catkin_ws/src/ros_control/hardware_interface/include -I/home/james/flor_repo/catkin_ws/src/ros_control/controller_manager/include -I/home/james/flor_repo/catkin_ws/src/ros_control/controller_interface/include ... [Additional paths]    -o CMakeFiles/valor_escher_controller.dir/src/ValorEscherController.cpp.o -c /home/james/flor_repo/catkin_ws/src/thor_control/valor_ros_control/valor_escher_controller/src/ValorEscherController.cpp


Edit 2: Added CMakeLists.txt file for package.

Here is my CMakeLists for the current package. I've stripped out the comments and boiler plate language, as well as the project specific packages that I know work in other locations.

cmake_minimum_required(VERSION 2.8.3)
project(valor_escher_controller)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x") find_package(Boost REQUIRED COMPONENTS system) find_package(catkin REQUIRED COMPONENTS cmake_modules) find_package(Eigen REQUIRED) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs eigen_stl_containers eigen_conversions hardware_interface controller_manager ... [Additional project specific packages]) include_directories(include${Boost_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) set(EXECUTABLE_OUTPUT_PATH${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) SET(HEADERS [List of 12 in-package headers] ) SET(SOURCE [List of 3 in-package source files] ) SET(ASGARD_HEADER_PATHS ... edit retag close merge delete ## 2 Answers Sort by » oldest newest most voted If you have the modified version of ros_control in your workspace alongside the pakage you're trying to build, catkin should do this automatically (this is one of the core design goals of catkin). Do you have any output from the compilation process (other than the include path order) that indicates that it isn't using your custom headers? You could try adding an #error preprocessor defiintion in one of your custom headers to confirm that it is being included properly. more ## Comments I've add some additional information. I'm sure that the standard ros_control headers are being used instead of the custom ones. For some reason, the Indigo headers are first in the include order. ( 2015-03-04 09:17:04 -0600 )edit Could you add your CMakelists.txt as well? Please without all the verbose boilerplate comments. ( 2015-03-04 09:53:57 -0600 )edit Just some comments: find_package(Boost REQUIRED COMPONENTS system) find_package(catkin REQUIRED COMPONENTS cmake_modules) find_package(Eigen REQUIRED) find_package(catkin REQUIRED COMPONENTS ..)  Not sure if this is the cause of your issue, but don't invoke find_package(..) twice (or more than once actually) with the same find script (in this case catkin). They are not cumulative, and depending on the implementation, results will be overwritten, or the second invocation will return early (and use cached, earlier results). set(EXECUTABLE_OUTPUT_PATH${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)  Also not the cause of your issue, but this has been deprecated since the move to catkin. include_directories(include${Boost_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) [..] include_directories( include${ASGARD_HEADER_PATHS}
${Boost_INCLUDE_DIRS}${catkin_INCLUDE_DIRS}
)


Any particular reason to duplicate this (include path is set right after the second find_package(catkin ..))?

more

1

I think the root of the issue is doing find_package(catkin) more than once. The find_package(catkin) will order the include directories to avoid exactly this issue, but if you do it more then once then the ordering is not done over the set.

( 2015-03-04 13:41:29 -0600 )edit