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

Catkin_make doesn't generate .h files from the srv tutorial.

asked 2014-12-23 09:12:36 -0500

kokirits gravatar image

updated 2015-01-09 03:39:15 -0500

Followed the srv tutorial step by step, catkin_make finishes successfully but the <package_name>/include folder is empty. Any ideas why that might be happening?

Edit: link to the tutorial http://wiki.ros.org/ROS/Tutorials/Cre...

Edit2: What I did basically was to follow the flow of the ROS tutorials. The package containing the service is "beginner_tutorials". After being unsuccessful I decided to create a new empty package "servoservice" to hold the service. Below can be found the xml and the CMakeLists.txt that I used to create the service in "servoservice":

Edit3: Sorry for the formatting, my markdown skills are poor to say the least.

Edit4: The file exists in ROOT_OF_WORKSPACE/devel/include/PKG_NAME but it's empty. Meaning it's an empty .h file.

Edit5: I tried the same sequence on a ubuntu 13.04 machine and the .h file was generated successfully. Could it be the python interpreter? My machine has anaconda python installed.

<?xml version="1.0"?>
<package>
  <name>servoservice</name>
  <version>0.0.0</version>
  <description>The servoservice package</description>

  <maintainer email="ntinos@todo.todo">ntinos</maintainer>

  <license>TODO</license>

  <build_depend>message_generation</build_depend>

  <run_depend>message_runtime</run_depend>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>std_msgs</run_depend>

  <export>
  </export>
</package>

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(servoservice)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  gencpp
  message_generation
)

## Generate services in the 'srv' folder
add_service_files(
   FILES
   AddTwoInts.srv
)

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

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES servoservice
#  CATKIN_DEPENDS roscpp rospy std_msgs
#  DEPENDS system_lib
)

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
  ${catkin_INCLUDE_DIRS}
)

## Declare a cpp library
# add_library(servoservice
#   src/${PROJECT_NAME}/servoservice.cpp
# )

## Declare a cpp executable
# add_executable(servoservice_node src/servoservice_node.cpp)

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(servoservice_node servoservice_generate_messages_cpp)

## Specify libraries to link a library or executable target against
# target_link_libraries(servoservice_node
#   ${catkin_LIBRARIES}
# )

and the output of the console from the build process:

[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_cpp
[  6%] Built target servo
[  6%] Built target std_msgs_generate_messages_lisp
[ 33%] Built target beginner_tutorials_generate_messages_py
[ 46%] Built target servoservice_generate_messages_py
[ 66%] [ 66%] Built target beginner_tutorials_generate_messages_cpp
Built target servoservice_generate_messages_cpp
[ 73%] Built target servoservice_generate_messages_lisp
[ 86%] Built target beginner_tutorials_generate_messages_lisp
Scanning dependencies of target listener
Scanning dependencies of target talker
Scanning dependencies of target servoservice_generate_messages
Scanning dependencies of target beginner_tutorials_generate_messages
[ 86%] Built target servoservice_generate_messages
[ 86%] Built target beginner_tutorials_generate_messages
[100%] [100%] Building CXX object beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o
Building CXX object beginner_tutorials/CMakeFiles/talker.dir/src/talker.cpp.o
Linking CXX executable /home/ntinos/hydro_ws/devel/lib/beginner_tutorials/talker
Linking CXX executable /home/ntinos/hydro_ws/devel/lib/beginner_tutorials/listener
[100%] Built target talker
[100%] Built target listener

error while building (the second time I run catkin_make it completes successfully):

Traceback (most recent call last):
  File "/opt/ros/hydro/share/gencpp/cmake/../../../lib/gencpp/gen_cpp.py", line ...
(more)
edit retag flag offensive close merge delete

Comments

Please add some more info to your OP, such as output on the console of your build process, layout of your package(s) etc. Without that, we'd all be only guessing ..

gvdhoorn gravatar image gvdhoorn  ( 2014-12-23 09:44:23 -0500 )edit

I've fixed the formatting a bit. You'll want to put 4 spaces in front of anything like code or console output (can be easily done using the '101010' button on the formatting bar). Also: no need to include all the boilerplate comments in any of those files.

gvdhoorn gravatar image gvdhoorn  ( 2014-12-23 11:50:09 -0500 )edit

No files should ever be generated in the source folder of your package. Have you looked in the folder ROOT_OF_YOUR_WORKSPACE/devel/include/PKGNAME?

Dirk Thomas gravatar image Dirk Thomas  ( 2014-12-23 12:11:52 -0500 )edit
1

@Dirk Thomas: The .h file is generated in workspace/devel/include/pkgname but it's empty.

kokirits gravatar image kokirits  ( 2014-12-24 01:19:54 -0500 )edit

Try catkin_make --force-cmake

emreay gravatar image emreay  ( 2014-12-24 09:04:09 -0500 )edit

Try to remove the "build" and "deve' folder and invoke "catkin_make" again. If that doesn't help please consider to share you "src" folder using e.g. a GitHub repo.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-12-25 16:48:17 -0500 )edit

I think the problem is fixed now. To my knowledge, the anaconda python interpreter messed with the whole thing. I removed anaconda and ros, and then apt-get ros again. Thanks everyone for the intuition. @Dirk Thomas: I did this multiple times but with no result. @emreay: Tried it made no difference

kokirits gravatar image kokirits  ( 2014-12-26 03:59:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-11 08:26:16 -0500

lucasw gravatar image

I had this problem and then realized I was missing the generate_messages().

I'll make a standalone github repo with the tutorial example in it and post a link here later.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-12-23 09:12:36 -0500

Seen: 3,174 times

Last updated: Sep 11 '16