史上最全源码安装ROS-BUG解决集合:在树莓派4B上安装Raspbian Bluster + ROS-kinetic + 配置navigation

Raspberry Pi 源码安装ROS-Kinetic

这里的测试中rosdep 无法使用, 通过其他方式下载了kinetic-desktop-wet.rosinstall文件,并注销opencv的编译+安装。
如果有些文件/包下载不下来, 请跟我留言把.

1. 前言背景

sudo rosdep init && rosdep update 无法成功,凡是涉及到rosdep的都无法成功;

提醒: 如果你可以设置系统全局VPN那就不用这么麻烦,只需要按照官网源码ROS安装方式继续安装就行了。

如果你没有VPN又要用ROS,那么以下的方法适合你。

2. 源码安装ROS, 逐步安装依赖, 实现ROS源码编译

## 常规ROS官网的步骤

1.安装引导依赖关系
	sudo apt-get install python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential
2."我用不了"--初始化rosdep
	sudo rosdep init
	rosdep update
3.创建catkin工作空间
	mkdir ~/ros_catkin_ws
	cd ~/ros_catkin_ws
4."我用不了"--ROS-desktop包安装
	rosinstall_generator desktop --rosdistro kinetic --deps --wet-only --tar > kinetic-desktop-wet.rosinstall
	wstool init -j4 src kinetic-desktop-wet.rosinstall
5."我用不了"--解析依赖
	rosdep install --from-paths src --ignore-src --rosdistro kinetic -y  
6.编译catkin工作空间
	./src/catkin/bin/catkin_make_isolated --install `-DCMAKE_BUILD_TYPE=Release

"2-4-5步用不了,导致很多依赖无法自动安装,所以需要你自己手动逐个安装......orz..."

## 非常规ROS官网的步骤
"下面出现的软件包依赖都是我一个一个遇到的坑,然后手动填坑的过程, 如果你遇到了相关问题无法解决,请跟我留言把!"
1. 我在其他PC(全局VPN)上下载下来了kinetic-desktop-wet.rosinstall文件,可以拿来使用...

2. 创建工作空间, 初始化 && 爬取所有ROS包
	mkdir ~/ros_catkin_ws
	cd ~/ros_catkin_ws
	wstool init -j4 src kinetic-desktop-wet.rosinstall

3. 编译工作空间
	sudo ./src/catkin/bin/catkin_make_isolated --install -DBOOST_ROOT=/usr/local/boost1580 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j4

"建议: 安装ROS, 请安装R0S-Melodic版本,这样底层库boost应该是满足条件,而不会引起冲突, 归根究底是因为RasBian Bluster是最新版,里面一些底层库都是比较新的版本(如boost-1.67.0, qt-5.11等)" 
  • 问题1: 缺少empy
解决:  sudo apt install python-empy.
  • 问题2: 缺少console_bridge
Could not find a package configuration file provided by "console_bridge"
with any of the following names:

    console_bridgeConfig.cmake
    console_bridge-config.cmake

解决: sudo apt install librosconsole-bridge-dev
  • 问题3: 缺少Poco
CMake Error at /opt/ros/kinetic/share/cmake_modules/cmake/Modules/FindPoco.cmake:189 (MESSAGE):
  Poco was not found.  Set the Poco_INCLUDE_DIR cmake cache entry to the
  top-level directory containing the poco include directories.  E.g
  /usr/local/include/ or c:\poco\include\poco-1.3.2

解决: sudo apt-get install libpoco-doc libpoco-dev
  • 问题4: 缺少SIP
File "/home/pi/ros_catkin_ws/src/orocos_kinematics_dynamics/python_orocos_kdl/cmake/FindSIP.py", line 8, in <module>
    import sipconfig
ImportError: No module named sipconfig
CMake Error at cmake/FindSIP.cmake:63 (MESSAGE):
  Could not find SIP

解决: sudo apt install python-sip python-sip-dev python-sip-doc python-sip-dbg
  • 问题5: 缺少TinyXML
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find TinyXML (missing: TinyXML_LIBRARY TinyXML_INCLUDE_DIR)

解决: sudo apt install libtinyxml-dev libtinyxml-doc
  • 问题6: boost底层库版本不对
fatal error: boost/tr1/unordered_set.hpp: No such file or directory

解决: ros-kinetic要求boost为1.58版本,而系统为1.67,需要手动安装boost_1_58_0.

wget -O boost_1_58_0.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2
tar --bzip2 -xvf boost_1_58_0.tar.bz2

安装boost有些依赖需要安装: sudo apt-get install libboost-all-dev libbz2-dev

cd boost_1_58_0
./bootstrap.sh --with-libraries=all --with-toolset=gcc
sudo ./b2 install --prefix=/usr/local/boost1580

安装成功之后,重新编译ros包如下:
sudo ./src/catkin/bin/catkin_make_isolated --install --DBOOST_ROOT=/usr/local/boost1580 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic -j4

"CMakeLists.txt中指定Boost库的搜索路径: set(BOOST_ROOT /usr/local/boost)"
  • 问题7: tinyxml2缺失
CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find TinyXML2 (missing: TinyXML2_LIBRARY TinyXML2_INCLUDE_DIR)
Call Stack (most recent call first):

sudo apt install libtinyxml2-dev
  • 问题8: PyQt5有问题
ImportError: No module named PyQt5

解决: 
> sudo apt install python-pyqt5*(pyqt-5.11.0), 不能这么安装,会导致与pyqt5.sip找不到,不知道是不是版本问题;

源码安装:  下载链接: https://riverbankcomputing.com/software/pyqt/download5

tar -xvf PyQt5_gpl-5.10.tar.gz
python configure.py

make -j4
> 这里会遇到错误: error: ‘waitForEvents’ is not a member of ‘QTest’, 这个函数自从5.10 / 5.11版本之后,去掉了。所以这里找不到,简单的办法就是按照提示找到调用该函数的地方,将其注释掉。
> 这个函数不重要,只有一个地方调用了,所以直接注释掉就OK了。
sudo make install
  • 问题9: 缺少gtest
解决: sudo apt-get install libgtest-dev
  • 问题10: 缺少lz4
CMake Error at CMakeLists.txt:13 (message):
  lz4 includes not found

解决: sudo apt install liblz4-dev
  • 问题11: ‘logError’ was not declared in this scope" (cpp_common)
解决: 在logError前面添加CONSOLE_BRIDGE_, 即为CONSOLE_BRIDGE_logError, 后面类似的错误都可以用这种方法解决。
  • 问题12: “urdfdom_headers”, but CMake did not find one.
sudo apt install liburdffdom-headers-dev
sudo apt install liburdfdom-dev

  • 问题13: No package ‘assimp’ found
sudo apt install python-pyassimp libassimp-dev
  • 问题14: 缺少collada_dom
CMake Error at CMakeLists.txt:15 (find_package):
  By not providing "FindCOLLADA_DOM.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "COLLADA_DOM"
解决:  sudo apt install libcollada-dom2.4-dp-dev

  • 问题15: No package ‘OGRE’, ‘OGRE-Overlay’ found:
解决: sudo apt-get install libogre-1.8-dev 

sudo apt install libyaml-cpp0.3-dev
sudo apt install python-netifaces python-defusedxml ---> "roscore缺少模块组件"
  • 问题16: 在树莓派4B上配置navigation包
1. sudo apt-get install libbullet-dev   ---> "Bullet"
2. sudo apt install libsdl-image1.2-dev libsdl2-dev  ---> "SDL"
3. 缺少diagnostic_updater: 按照源码编译ROS的方式,将其编译至系统库中;
	下载链接: git clone https://github.com/ros/diagnostics.git

4. 缺少tf2_geometry_msgs: 同上
	下载链接: git clone https://github.com/ros/geometry2.git

5. sudo apt install liborocos-bfl-dev --> "orocos-bfl"

6. 安装pcl, 下载pcl-pcl-1.7.2;(pcl1.7版本依赖libvtk5版本的一个函数接口,而在vtk6/vtk7中已经取消了, 因此,这里选择pcl1.8.0+vtk7进行安装,但要选择boost1.58.0版本)
	
    安装依赖: sudo apt install libflann1.9 libflann-dev(1.9的版本太高,对与pcl-1.8需要安装flann-1.8)
    "apt-get安装方式: "  sudo apt install libpcl-dev(但这样安装得到的好像是最新版pcl1.9??)
	"建议: 安装ROS, 请安装R0S-Melodic版本,这样底层库boost应该是满足条件,而不会引起冲突, 归根究底是因为RasBian Bluster是最新版,里面一些底层库都是比较新的版本(如boost-1.67.0, qt-5.11等)" 
	"源码编译选项(内存有限,去掉例子): cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_apps=OFF -DBUILD_examples=OFF .."
 
7. 安装move_base_msg, pcl_msg --> For navigation.
 
	git clone https://github.com/ros-planning/navigation_msgs.git
	git clone https://github.com/ros-perception/pcl_msgs.git

你可能感兴趣的:(ROS编程与项目实践)