Resource not found: gazebo_ros
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/home/cst/catkin_ws2/src
ROS path [2]=/home/cst/catkin_ws1/src
ROS path [3]=/home/cst/catkin_ws/src
ROS path [4]=/opt/ros/noetic/share
The traceback for the exception was written to the log file
这个错误表明我的系统无法找到名为"gazebo_ros"的资源。这可能是因为我在启动 wpb_gmapping.launch
文件时,缺少了一些必要的包或者环境设置。
一、我先确认是否已经正确安装了gazebo_ros软件包:
打开终端。
运行以下命令来检查
gazebo_ros
软件包是否已安装:dpkg -l | grep gazebo_ros
如果
gazebo_ros
软件包已经安装,你将会看到相关的软件包信息。如果未看到任何输出,那么
gazebo_ros
可能尚未安装。你可以通过以下命令安装它:sudo apt install ros-noetic-gazebo-ros
二、接下来进行编译后可能会继续出现一系列错误,我一一说明:
1、
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package): Could not find a package configuration file provided by "rviz" with any of the following names:
rvizConfig.cmake
rviz-config.cmake
我们还是跟上面一样先确认是否安装了Rviz包:
检查 RViz 是否已安装: 在终端中运行以下命令,检查是否已经安装了 RViz:
dpkg -l | grep rviz
如果 RViz 已经安装,你会在输出中看到相关的条目。
重新安装 RViz: 如果 RViz 没有安装或者你认为安装可能出了问题,你可以尝试重新安装 RViz。在终端中运行以下命令来重新安装 RViz:
sudo apt-get install ros-noetic-rviz
这将安装 ROS Noetic 版本的 RViz。
确认安装路径: 检查 RViz 的安装路径是否正确。通常情况下,ROS 包安装在
/opt/ros/noetic/
目录下。你可以使用以下命令检查 RViz 的安装路径:rospack find rviz
2、
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package): Could not find a package configuration file provided by "pcl_ros" with any of the following names:
pcl_rosConfig.cmake
pcl_ros-config.cmake
然后我们看出和上面的错误大差不差:
CMake 错误表明我的的系统中缺少名为
pcl_ros
的软件包。而这个包是用于处理点云的,是 ROS 中处理3D图像和点云数据的一部分。要解决这个问题,我们需要安装pcl_ros
包。以下是在基于Ubuntu的系统上安装pcl_ros
包的步骤:
打开终端:您可以使用快捷键
Ctrl+Alt+T
打开一个新的终端窗口。更新软件源:
sudo apt-get update
安装
pcl_ros
:sudo apt-get install ros-noetic-pcl-ros
这条命令将会安装 ROS Noetic 版本的
pcl_ros
包。验证安装: 安装完成后,您可以通过运行以下命令来检查
pcl_ros
包是否正确安装:rospack find pcl_ros
如果安装成功,这个命令将输出
pcl_ros
包的安装路径。
3、写下来还会出现一系列类似的问题,解决办法类似
在我的ros里面继续运行了:
sudo apt-get install ros-noetic-base-local-planner
sudo apt-get install ros-noetic-joint-state-controller
sudo apt-get install ros-noetic-robot-state-publisher
三、接下来可能就到了%号的编译界面,可能也会出现下面的错误
[ 68%] Linking CXX executable /home/cst/catkin_ws1/devel/lib/wpb_home_tutorials/wpb_home_joystick_demo
/home/cst/catkin_ws1/src/wpb_home/wpbh_local_planner/src/wpbh_local_planner.cpp:40:10: fatal error: tf_conversions/tf_eigen.h: 没有那个文件或目录
40 | #include <tf_conversions/tf_eigen.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [wpb_home/wpbh_local_planner/CMakeFiles/wpbh_local_planner.dir/build.make:63:wpb_home/wpbh_local_planner/CMakeFiles/wpbh_local_planner.dir/src/wpbh_local_planner.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:12770:wpb_home/wpbh_local_planner/CMakeFiles/wpbh_local_planner.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
[ 68%] Built target wpb_home_face_detect_3d
[ 68%] Built target wpb_home_behavior_node
[ 68%] Built target wpb_home_grab_object
[ 69%] Built target wpb_home_simple_goal
[ 69%] Built target wpb_home_cruise
[ 69%] Built target wpb_home_imu_turn
/home/cst/catkin_ws1/src/wpb_home/wpb_home_tutorials/src/wpb_home_speak.cpp:39:10: fatal error: sound_play/SoundRequest.h: 没有那个文件或目录
39 | #include <sound_play/SoundRequest.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [wpb_home/wpb_home_tutorials/CMakeFiles/wpb_home_speak.dir/build.make:63:wpb_home/wpb_home_tutorials/CMakeFiles/wpb_home_speak.dir/src/wpb_home_speak.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:11046:wpb_home/wpb_home_tutorials/CMakeFiles/wpb_home_speak.dir/all] 错误 2
[ 69%] Built target wpb_home_sr_xfyun
[ 69%] Built target wpb_home_joystick_demo
[ 70%] Built target wpb_home_face_detect
/home/cst/catkin_ws1/src/wpb_home/wpb_home_behaviors/src/wpb_home_grab_server.cpp:65:10: fatal error: sound_play/SoundRequest.h: 没有那个文件或目录
65 | #include <sound_play/SoundRequest.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [wpb_home/wpb_home_behaviors/CMakeFiles/wpb_home_grab_server.dir/build.make:63:wpb_home/wpb_home_behaviors/CMakeFiles/wpb_home_grab_server.dir/src/wpb_home_grab_server.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:8206:wpb_home/wpb_home_behaviors/CMakeFiles/wpb_home_grab_server.dir/all] 错误 2
[ 71%] Built target wpb_home_pointcloud_cluster
[ 71%] Built target wpb_home_plane_detect
[ 72%] Built target wpb_home_objects_3d
[ 72%] Built target wpb_home_obj_detect
make: *** [Makefile:141:all] 错误 2
Invoking "make -j16 -l16" failed
上面错误表明编译过程中缺少一些依赖项。主要的问题是找不到 tf_conversions/tf_eigen.h
和 sound_play/SoundRequest.h
这两个头文件。需要确保系统中安装了相应的软件包。以下是解决这些问题的步骤:
查找缺少的头文件: 首先,确定缺少的头文件所属的软件包。在ROS中,
tf_conversions/tf_eigen.h
来自于tf_conversions
包,而sound_play/SoundRequest.h
来自于sound_play
包。安装缺少的软件包: 通过以下命令安装缺少的软件包:
sudo apt-get install ros-noetic-tf-conversions sudo apt-get install ros-noetic-sound-play
重新编译: 安装完缺少的软件包后,重新执行
catkin_make
来编译您的 ROS 工作空间。
问题完结✿✿ヽ(°▽°)ノ✿!