《ROS機器人開發(fā)實踐》源碼復現(xiàn)報錯
在ROS學習過程中凯肋,古月居老師的ROS系列教學仿佛是苦海明燈,很適合入門汽馋,我最近也在跟著這個教材學習。
話不多說圈盔,首先先附上胡春旭版教程的源碼獲取和使用方式:
在home目錄下先新建工作空間:
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
然后再將老師的源代碼clone到你的ros工作空間的src目錄下
$ git clone https://github.com/huchunxu/ros_exploring.git
下邊是我在跟著《ROS機器人開發(fā)實踐》一書豹芯,復現(xiàn)案例時候遇到的一些問題,也提供了一下解決方法驱敲。(代碼中還是有很多坑需要填的)
1铁蹈、源碼編譯catkin_make失敗
可參考大神文章(https://blog.csdn.net/YiKangJ/article/details/82024809)我只是在此基礎上匯總了一些
原文說到:如果將源碼下載到ROS的工作空間中,則需要將其中的ros2文件夾移出到工作空間之外(或者將其放置到ROS 2的工作空間中)众眨,否則會導致編譯失敗握牧。
但是就算如此還會有問題:
報錯1
Could not find the required component ‘ecto’. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by “ecto” with any of
the following names:
ectoConfig.cmake
ecto-config.cmake
Add the installation prefix of “ecto” to CMAKE_PREFIX_PATH or set
“ecto_DIR” to a directory containing one of the above files. If “ecto”
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
ros_exploring-master/robot_perception/ork_tutorials/CMakeLists.txt:4 (find_package)
– Configuring incomplete, errors occurred!
See also “/home/qinpeiwang/catkin_ws/build/CMakeFiles/CMakeOutput.log”.
See also “/home/qinpeiwang/catkin_ws/build/CMakeFiles/CMakeError.log”.
Invoking “cmake” failed
解決
缺少ecto這個包,直接安裝就行
$ sudo apt-get install ros-kinetic-ecto
報錯2
缺少 manipulation-msgs 包娩梨,直接安裝(注意不是“_”而是“-”沿腰,盡量直接復制)
解決
$ sudo apt install ros-kinetic-manipulation-msgs
報錯3
缺少gazebo_ros_control 包
解決
$ sudo apt install ros-kinetic-gazebo-ros-control
報錯3
缺少鏈接庫報錯:
/usr/bin/ld: cannot find -lmsc
collect2: error: ld returned 1 exit status
解決
參考書中207頁說明,將科大訊飛的SDK庫文件拷貝到系統(tǒng)目錄下:
注:先進入庫文件所在文件夾 ros_exploring/robot_perception/robot_voice/libs/x64(32位系統(tǒng)最后選擇x86文件夾) 再執(zhí)行如下命令
$ sudo cp libmsc.so /usr/lib/libmsc.so
報錯4
權限錯誤:
/home/jyk/catkin_ws/build/ros_exploring/ros_advanced/dynamic_tutorials/setup_custom_pythonpath.sh: 5:exec: /home/jyk/catkin_ws/src/ros_exploring/ros_advanced/dynamic_tutorials/cfg/Tutorials.cfg: Permission denied
ros_exploring/ros_advanced/dynamic_tutorials/CMakeFiles/dynamic_tutorials_gencfg.dir/build.make:63: recipe for target ‘/home/jyk/catkin_ws/devel/include/dynamic_tutorials/TutorialsConfig.h’ failed
或者是
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j2 -l2" failed
解決
進入 ros_exploring/ros_advanced/dynamic_tutorials/cfg
文件夾狈定,執(zhí)行如下命令:
chmod +x Tutorials.cfg
報錯5
pocketsphinx 語音包安裝報錯:
ImportError: No module named pygst
解決
錯誤原因為缺少 python-gst 依賴颂龙,執(zhí)行如下命令即可解決問題:
sudo apt install python-gst0.10
報錯6
Could not find the required component 'moveit_ros_perception'.
The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "moveit_ros_perception" with any of the following names:
解決
這個部分的話是運行到Moveit時候才有的問題,但是要復現(xiàn)代碼纽什,可以直接先安裝Moveit措嵌。因為必然要安裝。
sudo apt-get install ros-kinetic-moveit
到這一步一般就可以正常編譯了,但是進入終端后可以先source一下芦缰,再編譯
cd ~/catkin_ws
source devel/setup.bash
catkin_make
假如不想每次開終端都需要source的話企巢,你可以直接這樣設置:
終端輸入:
終端輸入:
gedit ~/.bashrc
文件打開后直接翻到最后面,在底部添加以下代碼,保存退出让蕾,每次開新的終端都可以直接source了浪规。
source ~/catkin_ws/devel/setup.bash
2、其他常見錯誤
報錯7
-- Configuring incomplete, errors occurred!
See also "/home/litao/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/litao/catkin_ws/build/CMakeFiles/CMakeError.log". Invoking "cmake" failed
不要直接去更改CMakeList.txt,只需要清理構建空間就可以
rm -r build devel
catkin_make
報錯8
ERROR: cannot launch node of type [arbotix_python/arbotix_driver]: arbotix_python
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/home/xcy/catkin_lml/src
ROS path [2]=/home/xcy/catkin_syl/src
ROS path [3]=/home/xcy/catkin_ws/src
ROS path [4]=/opt/ros/kinetic/share
解決
檢查是否安裝 arbotix_[python](https://so.csdn.net/so/search?from=pc_blog_highlight&q=python) package
roscd arbotix_python
安裝 arbotix_python
sudo apt-get install ros-kinetic-arbotix
報錯9
Invoking :make -j2" fail and undefined reference to 'libusb
這個問題涕俗,我花了很長時間罗丰,一直沒找到合適的解決方式,但有人用下邊的方式解決了:
cd ~/catkin_ws/src
git clone https://github.com/uos/sick_tim.git
cd ~/catkin_ws/
catkin_make
報錯10
[WARN] [1588564677.171522]: The ‘use_gui’ parameter was specified, which is deprecated. We’ll attempt to find and run the GUI, but if this fails you should install the ‘joint_state_publisher_gui’ package instead and run that. This backwards compatibility option will be removed in Noetic.
[ERROR] [1581780877.646970]: Could not find the GUI, install the ‘joint_state_publisher_gui’ package
解決
安裝好GUI的包就可以
sudo apt-get install ros-kinetic-joint-state-publisher-gui
后續(xù)問題持續(xù)更新