按照http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv教程在进行如下操作时出现错误,
操作如下:
$ rosmsg show beginner_tutorials/Num
Unable to load msg [beginner_tutorials/Num]: Cannot locate message [Num]: unknown package [beginner_tutorials] 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'], 'resource_retriever': ['/opt/ros/kinetic/share/resource_retriever/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'], 'diagnostic_msgs': ['/opt/ros/kinetic/share/diagnostic_msgs/msg'], 'rosbuild': ['/opt/ros/kinetic/share/rosbuild/msg'], 'rosclean': ['/opt/ros/kinetic/share/rosclean/msg'], 'tf': ['/opt/ros/kinetic/share/tf/msg'], 'rqt_publisher': ['/opt/ros/kinetic/share/rqt_publisher/msg'], 'roslang': ['/opt/ros/kinetic/share/roslang/msg'], 'geometric_shapes': ['/opt/ros/kinetic/share/geometric_shapes/msg'], 'smach_ros': ['/opt/ros/kinetic/share/smach_ros/msg'], 'genlisp': ['/opt/ros/kinetic/share/genlisp/msg'], 'shape_msgs': ['/opt/ros/kinetic/share/shape_msgs/msg'], 'trajectory_msgs': ['/opt/ros/kinetic/share/trajectory_msgs/msg'], 'diagnostic_aggregator': ['/opt/ros/kinetic/share/diagnostic_aggregator/msg'], 'robot_state_publisher': ['/opt/ros/kinetic/share/robot_state_publisher/msg'], 'visualization_msgs': ['/opt/ros/kinetic/share/visualization_msgs/msg'], 'rqt_py_console': ['/opt/ros/kinetic/share/rqt_py_console/msg'], 'rqt_topic': ['/opt/ros/kinetic/share/rqt_topic/msg'], 'opencv3': ['/opt/ros/kinetic/share/opencv3/msg'], 'rqt_action': ['/opt/ros/kinetic/share/rqt_action/msg'], 'rqt_top': ['/opt/ros/kinetic/share/rqt_top/msg'], 'rqt_rviz': ['/opt/ros/kinetic/share/rqt_rviz/msg'], 'rosgraph_msgs': ['/opt/ros/kinetic/share/rosgraph_msgs/msg'], 'rosboost_cfg': ['/opt/ros/kinetic/share/rosboost_cfg/msg'], 'genmsg': ['/opt/ros/kinetic/share/genmsg/msg'], 'xacro': ['/opt/ros/kinetic/share/xacro/msg'], 'turtle_tf2': ['/opt/ros/kinetic/share/turtle_tf2/msg'], 'rqt_robot_dashboard': ['/opt/ros/kinetic/share/rqt_robot_dashboard/msg'], 'rqt_service_caller': ['/opt/ros/kinetic/share/rqt_service_caller/msg'], 'xmlrpcpp': ['/opt/ros/kinetic/share/xmlrpcpp/msg'], 'gl_dependency': ['/opt/ros/kinetic/share/gl_dependency/msg'], 'pluginlib': ['/opt/ros/kinetic/share/pluginlib/msg'], 'rqt_msg': ['/opt/ros/kinetic/share/rqt_msg/msg'], 'rosmaster': ['/opt/ros/kinetic/share/rosmaster/msg'], 'rosnode': ['/opt/ros/kinetic/share/rosnode/msg'], 'rqt_pose_view': ['/opt/ros/kinetic/share/rqt_pose_view/msg'], 'bond': ['/opt/ros/kinetic/share/bond/msg'], 'self_test': ['/opt/ros/kinetic/share/self_test/msg'], 'pr2_description': ['/opt/ros/kinetic/share/pr2_description/msg'], 'rospack': ['/opt/ros/kinetic/share/rospack/msg'], 'actionlib_msgs': ['/opt/ros/kinetic/share/actionlib_msgs/msg'], 'image_rotate': ['/opt/ros/kinetic/share/image_rotate/msg'], 'rqt_image_view': ['/opt/ros/kinetic/share/rqt_image_view/msg'], 'roslisp': ['/opt/ros/kinetic/share/roslisp/msg'], 'rqt_console': ['/opt/ros/kinetic/share/rqt_console/msg'], 'joint_state_publisher': ['/opt/ros/kinetic/share/joint_state_publisher/msg'], 'rviz_plugin_tutorials': ['/opt/ros/kinetic/share/rviz_plugin_tutorials/msg'], 'tf2_msgs': ['/opt/ros/kinetic/share/tf2_msgs/msg'], 'python_qt_binding': ['/opt/ros/kinetic/share/python_qt_binding/msg'], 'laser_geometry': ['/opt/ros/kinetic/share/laser_geometry/msg'], 'rviz': ['/opt/ros/kinetic/share/rviz/msg'], 'gencpp': ['/opt/ros/kinetic/share/gencpp/msg'], 'rqt_gui_cpp': ['/opt/ros/kinetic/share/rqt_gui_cpp/msg'], 'rqt_bag': ['/opt/ros/kinetic/share/rqt_bag/msg'], 'rqt_gui': ['/opt/ros/kinetic/share/rqt_gui/msg'], 'qt_gui_py_common': ['/opt/ros/kinetic/share/qt_gui_py_common/msg'], 'eigen_conversions': ['/opt/ros/kinetic/share/eigen_conversions/msg'], 'roscpp_traits': ['/opt/ros/kinetic/share/roscpp_traits/msg'], 'rosout': ['/opt/ros/kinetic/share/rosout/msg'], 'diagnostic_common_diagnostics': ['/opt/ros/kinetic/share/diagnostic_common_diagnostics/msg'], 'rostopic': ['/opt/ros/kinetic/share/rostopic/msg'], 'smach_msgs': ['/opt/ros/kinetic/share/smach_msgs/msg'], 'message_generation': ['/opt/ros/kinetic/share/message_generation/msg'], 'camera_calibration': ['/opt/ros/kinetic/share/camera_calibration/msg'], 'qwt_dependency': ['/opt/ros/kinetic/share/qwt_dependency/msg'], 'polled_camera': ['/opt/ros/kinetic/share/polled_camera/msg'], 'gazebo_msgs': ['/opt/ros/kinetic/share/gazebo_msgs/msg'], 'rostime': ['/opt/ros/kinetic/share/rostime/msg'], 'rqt_nav_view': ['/opt/ros/kinetic/share/rqt_nav_view/msg'], 'kdl_conversions': ['/opt/ros/kinetic/share/kdl_conversions/msg'], 'urdf_tutorial': ['/opt/ros/kinetic/share/urdf_tutorial/msg'], 'roslint': ['/opt/ros/kinetic/share/roslint/msg'], 'rosservice': ['/opt/ros/kinetic/share/rosservice/msg'], 'actionlib_tutorials': ['/opt/ros/kinetic/share/actionlib_tutorials/msg'], 'rosunit': ['/opt/ros/kinetic/share/rosunit/msg'], 'turtle_tf': ['/opt/ros/kinetic/share/turtle_tf/msg'], 'roscpp_tutorials': ['/opt/ros/kinetic/share/roscpp_tutorials/msg'], 'turtle_actionlib': ['/opt/ros/kinetic/share/turtle_actionlib/msg'], 'python_orocos_kdl': ['/opt/ros/kinetic/share/python_orocos_kdl/msg'], 'stage': ['/opt/ros/kinetic/share/stage/msg'], 'tf2_geometry_msgs': ['/opt/ros/kinetic/share/tf2_geometry_msgs/msg'], 'visualization_marker_tutorials': ['/opt/ros/kinetic/share/visualization_marker_tutorials/msg'], 'bondcpp': ['/opt/ros/kinetic/share/bondcpp/msg'], 'rosconsole_bridge': ['/opt/ros/kinetic/share/rosconsole_bridge/msg'], 'pluginlib_tutorials': ['/opt/ros/kinetic/share/pluginlib_tutorials/msg'], 'camera_info_manager': ['/opt/ros/kinetic/share/camera_info_manager/msg'], 'camera_calibration_parsers': ['/opt/ros/kinetic/share/camera_calibration_parsers/msg'], 'roslz4': ['/opt/ros/kinetic/share/roslz4/msg'], 'rqt_bag_plugins': ['/opt/ros/kinetic/share/rqt_bag_plugins/msg'], 'rosmsg': ['/opt/ros/kinetic/share/rosmsg/msg'], 'rospy': ['/opt/ros/kinetic/share/rospy/msg'], 'turtlesim': ['/opt/ros/kinetic/share/turtlesim/msg'], 'rqt_robot_monitor': ['/opt/ros/kinetic/share/rqt_robot_monitor/msg'], 'rosparam': ['/opt/ros/kinetic/share/rosparam/msg'], 'diagnostic_analysis': ['/opt/ros/kinetic/share/diagnostic_analysis/msg'], 'stereo_msgs': ['/opt/ros/kinetic/share/stereo_msgs/msg'], 'pcl_msgs': ['/opt/ros/kinetic/share/pcl_msgs/msg'], 'interactive_markers': ['/opt/ros/kinetic/share/interactive_markers/msg'], 'diagnostic_updater': ['/opt/ros/kinetic/share/diagnostic_updater/msg'], 'laser_assembler': ['/opt/ros/kinetic/share/laser_assembler/msg'], 'pcl_conversions': ['/opt/ros/kinetic/share/pcl_conversions/msg'], 'rviz_python_tutorial': ['/opt/ros/kinetic/share/rviz_python_tutorial/msg'], 'tf2': ['/opt/ros/kinetic/share/tf2/msg'], 'rqt_runtime_monitor': ['/opt/ros/kinetic/share/rqt_runtime_monitor/msg'], 'rosbash': ['/opt/ros/kinetic/share/rosbash/msg'], 'rqt_reconfigure': ['/opt/ros/kinetic/share/rqt_reconfigure/msg'], 'rqt_dep': ['/opt/ros/kinetic/share/rqt_dep/msg'], 'rqt_plot': ['/opt/ros/kinetic/share/rqt_plot/msg'], 'topic_tools': ['/opt/ros/kinetic/share/topic_tools/msg'], 'rostest': ['/opt/ros/kinetic/share/rostest/msg'], 'control_msgs': ['/opt/ros/kinetic/share/control_msgs/msg'], 'tf_conversions': ['/opt/ros/kinetic/share/tf_conversions/msg'], 'interactive_marker_tutorials': ['/opt/ros/kinetic/share/interactive_marker_tutorials/msg'], 'cpp_common': ['/opt/ros/kinetic/share/cpp_common/msg'], 'nodelet': ['/opt/ros/kinetic/share/nodelet/msg'], 'stage_ros': ['/opt/ros/kinetic/share/stage_ros/msg'], 'rqt_robot_steering': ['/opt/ros/kinetic/share/rqt_robot_steering/msg'], 'dynamic_reconfigure': ['/opt/ros/kinetic/share/dynamic_reconfigure/msg'], 'genpy': ['/opt/ros/kinetic/share/genpy/msg'], 'compressed_image_transport': ['/opt/ros/kinetic/share/compressed_image_transport/msg'], 'rqt_shell': ['/opt/ros/kinetic/share/rqt_shell/msg'], 'std_msgs': ['/opt/ros/kinetic/share/std_msgs/msg'], 'roscreate': ['/opt/ros/kinetic/share/roscreate/msg'], 'image_transport': ['/opt/ros/kinetic/share/image_transport/msg'], 'rqt_launch': ['/opt/ros/kinetic/share/rqt_launch/msg'], 'angles': ['/opt/ros/kinetic/share/angles/msg'], 'cv_bridge': ['/opt/ros/kinetic/share/cv_bridge/msg'], 'gazebo_ros': ['/opt/ros/kinetic/share/gazebo_ros/msg'], 'rosbag_storage': ['/opt/ros/kinetic/share/rosbag_storage/msg'], 'roswtf': ['/opt/ros/kinetic/share/roswtf/msg'], 'std_srvs': ['/opt/ros/kinetic/share/std_srvs/msg'], 'rqt_logger_level': ['/opt/ros/kinetic/share/rqt_logger_level/msg'], 'cmake_modules': ['/opt/ros/kinetic/share/cmake_modules/msg'], 'mk': ['/opt/ros/kinetic/share/mk/msg'], 'octomap': ['/opt/ros/kinetic/share/octomap/msg'], 'stereo_image_proc': ['/opt/ros/kinetic/share/stereo_image_proc/msg'], 'bondpy': ['/opt/ros/kinetic/share/bondpy/msg'], 'tf2_kdl': ['/opt/ros/kinetic/share/tf2_kdl/msg'], 'rqt_web': ['/opt/ros/kinetic/share/rqt_web/msg'], 'class_loader': ['/opt/ros/kinetic/share/class_loader/msg'], 'tf2_py': ['/opt/ros/kinetic/share/tf2_py/msg'], 'collada_urdf': ['/opt/ros/kinetic/share/collada_urdf/msg'], 'pcl_ros': ['/opt/ros/kinetic/share/pcl_ros/msg'], 'nav_msgs': ['/opt/ros/kinetic/share/nav_msgs/msg'], 'rosmake': ['/opt/ros/kinetic/share/rosmake/msg'], 'image_proc': ['/opt/ros/kinetic/share/image_proc/msg'], 'roscpp': ['/opt/ros/kinetic/share/roscpp/msg'], 'rqt_moveit': ['/opt/ros/kinetic/share/rqt_moveit/msg'], 'theora_image_transport': ['/opt/ros/kinetic/share/theora_image_transport/msg'], 'rqt_py_common': ['/opt/ros/kinetic/share/rqt_py_common/msg'], 'depth_image_proc': ['/opt/ros/kinetic/share/depth_image_proc/msg'], 'actionlib': ['/opt/ros/kinetic/share/actionlib/msg'], 'laser_filters': ['/opt/ros/kinetic/share/laser_filters/msg'], 'qt_gui_cpp': ['/opt/ros/kinetic/share/qt_gui_cpp/msg'], 'eigen_stl_containers': ['/opt/ros/kinetic/share/eigen_stl_containers/msg'], 'tf2_ros': ['/opt/ros/kinetic/share/tf2_ros/msg'], 'librviz_tutorial': ['/opt/ros/kinetic/share/librviz_tutorial/msg'], 'image_geometry': ['/opt/ros/kinetic/share/image_geometry/msg'], 'message_runtime': ['/opt/ros/kinetic/share/message_runtime/msg'], 'message_filters': ['/opt/ros/kinetic/share/message_filters/msg'], 'sensor_msgs': ['/opt/ros/kinetic/share/sensor_msgs/msg'], 'rospy_tutorials': ['/opt/ros/kinetic/share/rospy_tutorials/msg'], 'random_numbers': ['/opt/ros/kinetic/share/random_numbers/msg'], 'gazebo_plugins': ['/opt/ros/kinetic/share/gazebo_plugins/msg'], 'rqt_srv': ['/opt/ros/kinetic/share/rqt_srv/msg'], 'rqt_gui_py': ['/opt/ros/kinetic/share/rqt_gui_py/msg'], 'map_msgs': ['/opt/ros/kinetic/share/map_msgs/msg'], 'roslaunch': ['/opt/ros/kinetic/share/roslaunch/msg'], 'compressed_depth_image_transport': ['/opt/ros/kinetic/share/compressed_depth_image_transport/msg'], 'rqt_tf_tree': ['/opt/ros/kinetic/share/rqt_tf_tree/msg'], 'collada_parser': ['/opt/ros/kinetic/share/collada_parser/msg'], 'smach': ['/opt/ros/kinetic/share/smach/msg'], 'tf2_eigen': ['/opt/ros/kinetic/share/tf2_eigen/msg'], 'kdl_parser': ['/opt/ros/kinetic/share/kdl_parser/msg'], 'gennodejs': ['/opt/ros/kinetic/share/gennodejs/msg'], 'media_export': ['/opt/ros/kinetic/share/media_export/msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/msg'], 'urdf_parser_plugin': ['/opt/ros/kinetic/share/urdf_parser_plugin/msg'], 'orocos_kdl': ['/opt/ros/kinetic/share/orocos_kdl/msg'], 'rosbag': ['/opt/ros/kinetic/share/rosbag/msg'], 'rosbag_migration_rule': ['/opt/ros/kinetic/share/rosbag_migration_rule/msg']}]
第一步:
先source一下 ~/工作空间/devel/setup.bash,在我的电脑中的操作如下:
source /home/ding/catkin_ws/devel/setup.bash
source /devel/setup.bash
的作用有明白的小伙伴可以解释一下~
第二步:
rosmsg show beginner_tutorials/Num
int64 num