当前位置:网站首页>ROS learning (IX): referencing custom message types in header files

ROS learning (IX): referencing custom message types in header files

2022-07-06 07:44:00 biter0088

        The following describes a method of referencing custom message types in header files

1、 Custom message type

         The custom message package name is :sensor_driver_msgs

         The custom message type is named :GpswithHeading.msg

         The file organization is :

2、 Reference in the header file

         When referenced in files of other packages , It can be referenced in the header file , The format is as follows , Quoted here with “.h” ending :

#include <sensor_driver_msgs/GpswithHeading.h> // Reference the customized message type in the header file 

        Be careful : At this time, it is already in other packages CMakeLists.txt It contains sensor_driver_msgs package

find_package(catkin REQUIRED COMPONENTS
  xxx
  sensor_driver_msgs
  xxx
)

...

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES xxx
  CATKIN_DEPENDS xxx sensor_driver_msgs 
#  DEPENDS system_lib
)

...

add_dependencies(xxx_node sensor_driver_msgs_generate_messages_cpp)

原网站

版权声明
本文为[biter0088]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131902075489.html