在包文件中新建文件夾srv和msg,在這兩個文件夾中新建test.msg,test.srvui
添加如下內容code
<build_depend>:message_generation <run_depend>/<exec_depend>:message_runtime
find_package(catkin REQUIRED COMPONENTS ...message_generation ...)
add_message_files( DIRECTORY msg FILES test.msg )
generate_messages(DEPENDENCIES std_msgs)
catkin_package( ... CATKIN_DEPENDS ... message_runtime ... ...)