How to include header file generated by catkin srv?
The error is:
/home/ira/code/ros_groovy/src/sam_semantic_map_builder_dir/src/sam_semantic_map_builder_src.cpp:2:55: fatal error: sam_semantic_map_builder_dir/srv_add_file.h: No such file or directory
compilation terminated.
I run:
catkin_create_pkg sam_semantic_map_builder_dir pcl pcl_ros roscpp sensor_msgs
roscd sam_semantic_map_builder_dir
mkdir -p srv
vim srv/srv_add_file.srv
string msg_object_name
---
float32 msg_x
float32 msg_y
float32 msg_z
float32 msg_roll
float32 msg_pitch
float32 msg_yaw
vim src/sam_semantic_map_builder_src.cpp
#include <ros/ros.h>
#include <sam_semantic_map_builder_dir/srv_add_file.h>
...
vim CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
project(sam_semantic_map_builder_dir)
find_package(catkin REQUIRED COMPONENTS
pcl
pcl_ros
roscpp
sensor_msgs
std_msgs
message_generation
)
## Generate services in the 'srv' folder
add_service_files(
FILES
srv_add_file.srv
)
catkin_package(
INCLUDE_DIRS include
# LIBRARIES sam_semantic_map_builder_dir
CATKIN_DEPENDS pcl pcl_ros roscpp sensor_msgs
# DEPENDS system_lib
)
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
add_executable(sam_semantic_map_builder_bin src/sam_semantic_map_builder_src.cpp)
target_link_libraries(sam_semantic_map_builder_bin ${catkin_LIBRARIES})
vim package.xml
<?xml version="1.0"?>
<package>
<name>sam_semantic_map_builder_dir</name>
<version>0.0.0</version>
<description>The sam_semantic_map_builder_dir package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="ira@todo.todo">ira</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>pcl</build_depend>
<build_depend>pcl_ros</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>pcl</run_depend>
<run_depend>pcl_ros</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>message_runtime</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- You can specify that this package is a metapackage here: -->
<!-- <metapackage/> -->
<!-- Other tools can request additional information be placed here -->
</export>
</package>
What am I missing?
How to fix it?
Thank you~