假设自定义消息包my_message_package
https://answers.ros.org/question/206257/catkin-use-ros-message-from-another-package/
首先find_package(my_message_package)
之后
add_dependencies(your_executable ${catkin_EXPORTED_TARGETS})
然后添加
package.xml
详细看下面官方教程
http://docs.ros.org/indigo/api/catkin/html/howto/format2/cpp_msg_dependencies.html
在package.xml里要改成
build_depend 和 run_depend