ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
This is basically a problem with your CMakeLists.txt
.
find_package(catkin REQUIRED COMPONENTS geometry_msgs roscpp tf )
These lines are correct.
catkin_package( #INCLUDE_DIRS include #LIBRARIES robot_setup_tf #CATKIN_DEPENDS geometry_msgs roscpp tf #DEPENDS system_lib ) # include ${catkin_INCLUDE_DIRS} )
These lines are clearly not correct and I don't understand how you could not have gotten complaints from CMake about this. As is, this will not setup the include path correctly, so ros/ros.h
is not on the include path, leading to the compiler error you show.
The correct statement would be:
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
Some other observations:
link_directories(${catkin_LIBRARY_DIRS})
This is not needed and should be removed.
${catkin_EXPORTED_TARGETS}) ${catkin_EXPORTED_TARGETS})
These statements do nothing and should be removed or fixed.
The tutorial you mention does not instruct you to change the CMakeLists.txt
other than adding a few lines to get the binaries to build. Did you edit the CMakeLists.txt
yourself?
Finally: if you haven't, I would recommend you follow the TF2 version of this tutorial (ie: this one), instead of using TF. TF has been deprecated for a few years now and TF2 should be used instead.