Ask Your Question

Revision history [back]

Here I leave the required files, also consider changing to catkin build instead of catkin_make, is a better build system. You can install by doing sudo apt install python-catkin-tools python3-catkin-tools

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

find_package(catkin REQUIRED COMPONENTS
    roscpp
    std_msgs
    message_generation
)

## Generate messages in the 'msg' folder
add_message_files(
    FILES
    Num.msg
)

## 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
    LIBRARIES beginner_tutorials
    CATKIN_DEPENDS roscpp std_msgs message_runtime
    DEPENDS
)

package.xml

<?xml version="1.0"?>
<package>
<name>beginner_tutorials</name>
<version>0.0.1</version>
<description>tutorial</description>
<maintainer email="foo@bar.com">Foo Author</maintainer>
<license>BSD</license>
<url type="website">https://foo.com</url>

<buildtool_depend>catkin</buildtool_depend>

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

<run_depend>roscpp</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>message_runtime</run_depend>

</package>

msg/Num.msg

int64 num

srv/AddTwoInts.srv

int64 a
int64 b
---
int64 sum