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

coenig's profile - activity

2019-07-26 07:03:50 -0500 received badge  Famous Question (source)
2019-04-26 20:23:09 -0500 received badge  Self-Learner (source)
2019-04-26 20:23:09 -0500 received badge  Teacher (source)
2019-04-26 20:14:48 -0500 marked best answer How to include generated message .h file into C++ (ROS 2)?

I am new to ROS 2, coming from ROS, currently using crystal to try and learn the basics.

I want to just simply create a custom message and use it in the minimal publisher/subscriber example from here, instead of the default string message used there. So far, I have put a message file LNumM.msg with the content:

int64 num

into the msg folder of the publisher package. Using the below CMakeLists.txt and package.xml, the package compiles with colcon build.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(examples_rclcpp_minimal_publisher)

# 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(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)

set(msg_files
  "msg/LNumM.msg"
)

rosidl_generate_interfaces(${PROJECT_NAME}
  ${msg_files}
  DEPENDENCIES std_msgs
)

add_executable(publisher_lambda lambda.cpp)
ament_target_dependencies(publisher_lambda rclcpp std_msgs)

add_executable(publisher_member_function member_function.cpp)
ament_target_dependencies(publisher_member_function rclcpp std_msgs)

add_executable(publisher_not_composable not_composable.cpp)
ament_target_dependencies(publisher_not_composable rclcpp std_msgs)

install(TARGETS
  publisher_lambda
  publisher_member_function
  publisher_not_composable
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()

package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>examples_rclcpp_minimal_subscriber</name>
  <version>0.6.1</version>
  <description>Examples of minimal subscribers</description>
  <maintainer email="jacob@openrobotics.org">Jacob Perron</maintainer>
  <license>Apache License 2.0</license>
  <author>Mikael Arguedas</author>
  <author>Morgan Quigley</author>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <buildtool_depend>rosidl_default_generators</buildtool_depend>

  <build_depend>rclcpp</build_depend>
  <build_depend>std_msgs</build_depend>

  <member_of_group>rosidl_interface_packages</member_of_group>

  <exec_depend>rosidl_default_runtime</exec_depend>
  <exec_depend>rclcpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

However, I don't know how to now include the message into the C++ code of the publisher (or subscriber) to actually publish and receive messages of this type. In ROS, the generated C++ header is placed in the devel folder, and I can simply include it via (adapting a similar ROS 1 example):

#include "beginner_tutorials/LNumM.h"

In the install folder of my colcon workspace, I couldn't find any file called LNumM.h, although there are many files with similar names such as LNumM_.h. I know that ROS 2 uses the IDL to encode messages, and there are also several generated idl files in the install folder. But I would expect to get a generated C++ header file as well by using rosidl_generate_interfaces. I have tried some random things like:

#include "examples_rclcpp_minimal_subscriber/msg/dds_opensplice/LNumM_.h"

But they did not work (and I didn't actually expect them to). Maybe someone can push me in the right direction?

2019-04-09 05:11:58 -0500 received badge  Notable Question (source)
2019-02-20 04:49:38 -0500 commented question ROS2 - Remote Node Setup

Thanks anyway! If I find a feasible solution I will write an answer here (but I won't dive too deep as I assume that the

2019-02-19 07:25:47 -0500 commented question ROS2 - Remote Node Setup

@cbquick Have you been able to accomplish this in the meanwhile? If so, can you share some insights? Would be greatly ap

2019-02-15 14:27:17 -0500 received badge  Famous Question (source)
2019-02-15 05:12:14 -0500 received badge  Popular Question (source)
2019-02-15 02:56:11 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal? In ROS1, when publishing a message in a terminal (such as in this que

2019-02-15 02:55:02 -0500 answered a question How to publish a nested ROS2 message in a Linux Terminal?

Apparently it's not yet possible to publish nested messages via command line: https://answers.ros.org/question/304295/ro

2019-02-15 02:31:06 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal? In ROS1, when publishing a message in a terminal (such as in this que

2019-02-15 02:30:29 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal? In ROS1, when publishing a message in a terminal (such as in this que

2019-02-15 02:27:45 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal? In ROS1, when publishing a message in a terminal (such as in this que

2019-02-15 02:27:16 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal? In ROS1, when publishing a message in a terminal (such as in this que

2019-02-15 02:19:57 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal In ROS1, when publishing a message in a terminal (such as in this ques

2019-02-14 12:35:39 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal In ROS1, when publishing a message in a terminal (such as in this ques

2019-02-14 12:33:51 -0500 edited question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal In ROS1, when publishing a message in a terminal (such as in this ques

2019-02-14 12:33:51 -0500 received badge  Associate Editor (source)
2019-02-14 12:28:44 -0500 asked a question How to publish a nested ROS2 message in a Linux Terminal?

How to publish a ROS2 message in a Linux Terminal In ROS1, when publishing a message in a terminal, such as in this ques

2019-02-07 04:10:49 -0500 commented answer Porting rviz plugin to rviz2 (cmake trouble)

Ah! And how do I do that? Why hasn't my cmake been able to detect that?

2019-02-05 06:43:35 -0500 answered a question Porting rviz plugin to rviz2 (cmake trouble)

Turns out it was just a missing library. sudo apt-get install libxaw7-dev did the trick. After that the compilation w

2019-02-04 11:07:21 -0500 received badge  Good Question (source)
2019-02-04 11:07:18 -0500 received badge  Notable Question (source)
2019-02-04 10:28:41 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Porting rviz plugin to rviz2 I am trying to port a working rviz1 display plugin (ROS Kinetik) to rviz2 (ROS2 Crystal). I

2019-02-04 08:51:06 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Porting rviz plugin display to rviz2 I am trying to port a working rviz1 display plugin (ROS Kinetik) to rviz2 (ROS2 Cry

2019-02-04 08:50:36 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Issue with CMAKE when building rviz2 plugin (ROS2) I am trying to port a working rviz1 display plugin (ROS Kinetik) to r

2019-02-04 07:28:43 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS2 issue with CMAKE when building rviz2 plugin I am trying to port a working rviz1 display plugin (ROS Kinetik) to rvi

2019-02-04 07:25:03 -0500 received badge  Nice Question (source)
2019-02-04 07:13:14 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS2 issue with CMAKE when building rviz2 plugin I am trying to port a working rviz1 display plugin (ROS Kinetik) to rvi

2019-02-04 06:28:38 -0500 received badge  Student (source)
2019-02-04 05:29:46 -0500 received badge  Popular Question (source)
2019-02-04 04:55:02 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS2 issue with cmake when building rviz2 plugin I am trying to port a working rviz1 display plugin (ROS Kinetik) to rvi

2019-02-04 01:58:02 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building rviz2 plugin I am trying to port a working rviz1 display plugin (ROS Kinetik) to rv

2019-02-03 14:28:34 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying to port a working rviz1 display plugin (ROS Ki

2019-02-03 14:28:13 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying to port a working rviz1 display plugin (ROS Ki

2019-02-03 10:02:40 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying for a while now to port a working rviz1 displa

2019-02-03 10:01:47 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying for a while now to port a working rviz1 displa

2019-02-03 09:04:20 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying for a while now to port a working rviz1 displa

2019-02-03 09:03:04 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying for a while now to port a working rviz1 displa

2019-02-03 09:02:01 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

ROS 2 issue with cmake when building display plugin for rviz2 I am trying for a while now to port a working rviz1 displa

2019-02-03 08:39:57 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Issue with cmake when building display plugin for RVIZ2 I am trying for a while now to port a working rviz1 display plug

2019-02-03 08:38:10 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Issue with cmake when building display plugin for RVIZ2 I am trying for a while now to port a working rviz1 display plug

2019-02-03 08:37:24 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Issue with cmake when building display plugin for RVIZ2 I am trying for a while now to port a working rviz1 display plug

2019-02-03 08:35:45 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

Issue with cmake when building display plugin for RVIZ2 I am trying for a while now to port a working rviz1 display plug

2019-02-03 08:30:28 -0500 edited question Porting rviz plugin to rviz2 (cmake trouble)

How to create shared plugin library for RVIZ2? I am trying for a while now to port a working rviz1 display plugin (ROS K

2019-02-03 08:30:28 -0500 received badge  Editor (source)
2019-02-03 06:56:33 -0500 asked a question Porting rviz plugin to rviz2 (cmake trouble)

How to create shared plugin library for RVIZ2? I am trying for a while now to port a working rviz1 display plugin (ROS K

2019-02-01 05:22:25 -0500 edited question How to add rviz2 to include directories in CMake?

How to add rviz2 to include directories? I am trying to port a ROS rviz plugin to ROS2 / rviz2. At one point I include i

2019-02-01 03:24:21 -0500 received badge  Organizer (source)