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

Revision history [back]

click to hide/show revision 1
initial version

You are missing 2 things:

1) In addition to add_service_files you need to call generate_messages (Typically just decomment this in the default generated CMakeLists.txt):

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  std_msgs  # and/or other packages containing depended messages
)

If you added this your code will compile 'most of the times'. However, the srv headers need to be compiled before your exec target and the order of command evaluation is not yet fixed. In order to fix the order you add:

2)

add_dependencies( sam_semantic_map_builder_bin ${PROJECT_NAME}_generate_messages_cpp )

after add_executable. This makes your exec depending on the <>generate_messages_cpp thereby only allowing the exec target to be compiled after the msg headers are generated............