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

Modifying Catkin Include Order to use Source Package over Debian Package

asked 2015-03-03 20:15:42 -0500

James Burton gravatar image

updated 2015-03-04 12:43:46 -0500

gvdhoorn gravatar image

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.

Edit 1: Additional Information:

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)

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
 ... [Additional project specific packages])

include_directories(include ${Boost_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})


  [List of 12 in-package headers]

  [List of 3 in-package source files]

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-03-03 21:53:52 -0500

ahendrix gravatar image

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.

edit flag offensive delete link more


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.

James Burton gravatar image James Burton  ( 2015-03-04 09:17:04 -0500 )edit

Could you add your CMakelists.txt as well? Please without all the verbose boilerplate comments.

gvdhoorn gravatar image gvdhoorn  ( 2015-03-04 09:53:57 -0500 )edit

answered 2015-03-04 12:48:41 -0500

gvdhoorn gravatar image

updated 2015-03-04 12:50:11 -0500

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


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



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

edit flag offensive delete link more



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.

William gravatar image William  ( 2015-03-04 13:41:29 -0500 )edit

Question Tools



Asked: 2015-03-03 20:15:42 -0500

Seen: 284 times

Last updated: Mar 04 '15