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

Creating msg messages

asked 2019-01-29 01:22:06 -0500

D0l0RES gravatar image

Can you please instructions with creating your package from scratch, or rather the description of what you need to specify in CMakeList.txt and package.xml. I understood how to create my overlay and build a package (I collect it using ament_cmake) but I do not understand what needs to be specified in the above files, when adding my own nodes and msg files. I create packages using ros2 pkg create. And can you please describe this in more detail as I did not find this information in the official manual.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2019-01-29 12:52:17 -0500

lucasw gravatar image

Take a look at https://github.com/ros2/demos/tree/ma... for a minimal example

cmake_minimum_required(VERSION 3.5)

project(pendulum_msgs)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(pendulum_msgs
  "msg/JointState.msg"
  "msg/JointCommand.msg"
  "msg/RttestResults.msg"
  DEPENDENCIES builtin_interfaces
)

ament_package()

and

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>pendulum_msgs</name>
  <version>0.6.2</version>
  <description>Custom messages for real-time pendulum control.</description>

  <maintainer email="michael@openrobotics.org">Michael Carroll</maintainer>

  <license>Apache License 2.0</license>

  <author>Jackie Kay</author>
  <author>Mikael Arguedas</author>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <build_depend>builtin_interfaces</build_depend>
  <build_depend>rosidl_default_generators</build_depend>
  <exec_depend>builtin_interfaces</exec_depend>
  <exec_depend>rosidl_default_runtime</exec_depend>

  <member_of_group>rosidl_interface_packages</member_of_group>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-01-29 01:22:06 -0500

Seen: 414 times

Last updated: Jan 29 '19