创建ros消息可参考创建ROS消息和ROS服务。
按照这个教程进行创建的过程中出现了如下错误:
Unable to load msg [msgs/locate]: Cannot locate message [locate]: unknown package [msgs] on search path [{'rosconsole': ['/opt/ros/kinetic/share/rosconsole/msg'], 'catkin': ['/opt/ros/kinetic/share/catkin/msg'], 'qt_dotgraph': ['/opt/ros/kinetic/share/qt_dotgraph/msg'], 'image_view': ['/opt/ros/kinetic/share/image_view/msg'], 'urdf': ['/opt/ros/kinetic/share/urdf/msg'], 'rosgraph': ['/opt/ros/kinetic/share/rosgraph/msg'], 'rqt_py_console': ['/opt/ros/kinetic/share/rqt_py_console/msg'], 'nodelet_topic_tools': ['/opt/ros/kinetic/share/nodelet_topic_tools/msg'], 'rqt_graph': ['/opt/ros/kinetic/share/rqt_graph/msg'], 'nodelet_tutorial_math': ['/opt/ros/kinetic/share/nodelet_tutorial_math/msg'], 'qt_gui': ['/opt/ros/kinetic/share/qt_gui/msg'], 'filters': ['/opt/ros/kinetic/share/filters/msg'], 'smclib': ['/opt/ros/kinetic/share/smclib/msg'], 'roslib': ['/opt/ros/kinetic/share/roslib/msg'], 'geneus': ['/opt/ros/kinetic/share/geneus/msg'], 'roscpp_serialization': ['/opt/ros/kinetic/share/roscpp_serialization/msg'], 'rqt_rviz': ['/opt/ros/kinetic/share/rqt_rviz/msg'], 'rosbuild': ['/opt/ros/kinetic/share/rosbuild/msg'], 'rosclean':
仔细看了看是说在以下路径中找Num,没有找到,所以首先想到的是路径有问题,所以重新添加路径。
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc
然后再测试就没问题了 。