ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The example you are referring to already uses a message header (https://github.com/ros2/examples/blob/af08e6f7ac50f7808dbe6165f1adfd8e6cd3a79c/rclcpp/minimal_publisher/lambda.cpp#L17) which you can use as a template to find yours:
#include "std_msgs/msg/string.hpp"
That file is generated from std_msgs/msg/String.msg
.
In ROS 2 all C++ headers are ending in .hpp
(rather than .h
which is used for C). Also to conform with the Google style guide all filenames use lowercase/underscore.
So your file will be named examples_rclcpp_minimal_publisher/msg/l_num_m.hpp
.
2 | No.2 Revision |
The example you are referring to already uses a message header (https://github.com/ros2/examples/blob/af08e6f7ac50f7808dbe6165f1adfd8e6cd3a79c/rclcpp/minimal_publisher/lambda.cpp#L17) which you can use as a template to find yours:
#include "std_msgs/msg/string.hpp"
That file is generated from std_msgs/msg/String.msg
.
In ROS 2 all C++ headers are ending in .hpp
(rather than .h
which is used for C). Also to conform with the Google style guide all filenames use lowercase/underscore.
So your file will be named examples_rclcpp_minimal_publisher/msg/l_num_m.hpp
.
Update:
You will also need to update the CMake code to tell the executable targets where to find the headers:
rosidl_target_interfaces(publisher_lambda ${PROJECT_NAME} "rosidl_typesupport_cpp")