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

.h files for services not created

asked 2018-06-06 11:03:40 -0500

fabriceN gravatar image

Dear All,

I am developing services for an application and catkin build gave me the following error:

Errors << waypoint_node:make /home/fabrice/catkin_demo_ws/logs/waypoint_node/build.make.000.log                                      
In file included from /home/fabrice/catkin_demo_ws/src/waypoint_node/src/waypoint_node.cpp:12:0:
/home/fabrice/catkin_demo_ws/src/waypoint_node/include/waypoint_navigator/waypoint_node.h:49:43: fatal error: waypoint_navigator/GoToHeight.h: no file

Looks like the .h for the xxx.srv files have not been created and indeed there did not appear in catkin_ws/devel/include

I am running Ros kinetic on ubuntu 16.04

Here is the content of package.xml

<package>
  <name>waypoint_node</name>
  <version>2.0.0</version>
  <description>Waypoint waypoint_node</description>
  <maintainer email="toto@gmail.com"> toto</maintainer>
  <author>toto</author>
  <license>ASL 2.0</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>mavros</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <build_depend>sensor_msgs</build_depend>

  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>waypoint_msgs</build_depend>
  <build_depend>message_generation</build_depend>

  <run_depend>mavros</run_depend>
  <run_depend>geometry_msgs</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>sensor_msgs</run_depend>
  <run_depend>tf</run_depend>
  <run_depend>message_runtime</run_depend>   
</package>

Cmake content:

cmake_minimum_required(VERSION 2.8.3)
project(waypoint_node)
find_package(catkin REQUIRED COMPONENTS
    roscpp
    mavros
    sensor_msgs
    geometry_msgs
    message_generation
)

# generate services in the 'srv' folder
add_service_files(
  FILES
  GoToHeight.srv
  GoToWaypoint.srv
  GoToWaypoints.srv
)

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  geometry_msgs std_msgs
)

catkin_package(
    LIBRARIES 
    CATKIN_DEPENDS  roscpp mavros std_msgs geometry_msgs sensor_msgs message_runtime
)

include_directories(
    ${catkin_INCLUDE_DIRS}                                                           
)

include_directories(include ${catkin_INCLUDE_DIRS})    
add_executable(waypoint_node src/waypoint_node.cpp)    
add_dependencies(waypoint_node ${catkin_EXPORTED_TARGETS})
target_link_libraries(waypoint_node ${catkin_LIBRARIES})
add_dependencies(waypoint_node ${PROJECT_NAME}_generate_messages_cpp)
install(TARGETS waypoint_node
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY launch
  DESTINATION  ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

I join as well the content of the directory

waypoint_node
├── CMakeLists.txt
├── include
│   └── waypoint_navigator
│       ├── waypoint_navigator_node.h
│       └── waypoint_node.h
├── launch
│   ├── mav_sim.launch
│   └── waypoint_navigator.launch
├── LICENSE
├── package.xml
├── README.md
├── src
│   ├── waypoint_navigator_node.cpp
│   ├── waypoint_nav_node.cpp
│   └── waypoint_node.cpp
├── srv
│   ├── ExecutePathFromFile.srv
│   ├── GoToHeight.srv
│   ├── GoToWaypoint.srv
│   └── GoToWaypoints.srv
└── viz
└── waypoint_navigator_sim.viz.rviz

Does anybody faces the same issue and thus where is my mistake?

Thank you for your help

Fabrice

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-12-07 17:10:33 -0500

SalahSoliman gravatar image

Since you used FILES to generate the header files, you should find the .h files generated in the following directory: ~/catkin_demo_ws/devel/include/waypoint_node/

Generally: ~/ws/devel/include/project_name_as_listed_in_the_CMakeLists_file

and since you used:

include_directories(
        ${catkin_INCLUDE_DIRS}                                                           
    )

you can directly include files in the ~/ws/devel/include/ directory, as follows:

#include "waypoint_node/GoToHeight.h"

The problem simply for your case is that you're using a wrong project name "waypoint_navigator"

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-06-06 11:03:40 -0500

Seen: 460 times

Last updated: Jun 06 '18