ros_install - yuhannah/skills_map GitHub Wiki
ROS 安装
重要!!在 ROS 官网查找 Ubuntu 系统对应的 ROS 版本再进行安装。
版本检测
本文在 ubuntu 16.04 系统下安装 ROS Kinetic Kame。
在 ROS wiki/Distributions页面查看当前可用的 ROS 发行版本(绿色的为 supported release)。
在 ROS Target Platforms页面查看当前系统支持的 ROS 版本。经过查找,ubuntu 16.04 系统支持 Kinetic Kame 版本。其他依赖如下所示:
Kinetic Kame (May 2016 - May 2021)
Required Support for:
- Ubuntu Wily (15.10)
- Ubuntu Xenial (16.04)
Recommended Support for:
- Debian Jessie
- Fedora 23
- Fedora 24
Minimum Requirements:
- C++11
- GCC 4.9 on Linux, as it's the version that Debian Jessie ships with
- Python 2.7
- Python 3.4 not required, but testing against it is recommended
- Lisp SBCL 1.2.4
- CMake 3.0.2
- Debian Jessie ships with CMake 3.0.2
- Boost 1.55
- Debian Jessie ships with Boost 1.55
Exact or Series Requirements:
- Ogre3D 1.9.x
- Gazebo 7
- PCL 1.7.x
- OpenCV 3.x
- Qt 5.3.x
- PyQt5
Build System Support:
- Same as Indigo
在安装 ROS 前,需要在 ubuntu 系统中完成上述依赖的安装。
当前系统中自行安装的依赖版本如下:
-
GCC:5.4.0
-
Python:2.7.12
-
CMake:3.5.0
-
Git:2.7.4
安装依赖
安装及升级 Git
安装 CMake
安装 OpenCV
安装 ROS
PS:如果使用清华镜像,需要将 ubuntu 系统的软件源也切换成清华源。
初始化 rosdep 出现的问题及解决方案
运行sudo rosdep init
出现以下问题:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
解决方案:
#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133 raw.githubusercontent.com
#保存后退出再尝试
sudo rosdep init
测试ROS
启动ROS环境:
roscore
检查环境变量配置
export | grep ROS
安装 MRPT-ROS-PKG
MRPT 官网给出了所有用于 MRPT 的 ROS 程序包 。包括:
- mrpt_slam:SLAM 算法
- mrpt_navigation:定位及导航算法
- mrpt_bridge:转换 ROS 和 MRPT 的类和 messages 的 C++ 库
- pose_cov_ops:空间转换
- mrpt_sensors:传感器
- mrpt_msgs:用于 MRPT 的 ROS messages
- kinect_2d_scanner:用 MRPT 的 kinect
其中,常用的安装包有mrpt_navigation
,mrpt_bridge
,pose_cov_ops
,mrpt_msgs
。
从源码安装
在 ROS 的某个 catkin_ws/src
下,依次拉取上述安装包的 git 源码(请根据 README.md 的说明选择合适的版本):
# 回到工作空间
cd /home/user/sources/catkin_ws
# 构建
catkin_make
构建的过程提示缺少什么安装包,就去 ROS 官网搜索该安装包的 git 仓库,拉取对应版本的安装包到相同的工作空间的 src 目录下,再次构建,直到构建成功。
例如,找不到pose_cov_ops
安装包:
-- Could NOT find pose_cov_ops (missing: pose_cov_ops_DIR)
-- Could not find the required component 'pose_cov_ops'. 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 "pose_cov_ops" with
any of the following names:
pose_cov_opsConfig.cmake
pose_cov_ops-config.cmake
Add the installation prefix of "pose_cov_ops" to CMAKE_PREFIX_PATH or set
"pose_cov_ops_DIR" to a directory containing one of the above files. If
"pose_cov_ops" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
mrpt_navigation/mrpt_localization/CMakeLists.txt:7 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/hannah/sources/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/hannah/sources/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
拉取pose_cov_ops
安装包到catkin_ws/src
目录下:
hannah@ubuntu:~/sources/catkin_ws$ cd src/
hannah@ubuntu:~/sources/catkin_ws/src$ git clone https://github.com/mrpt-ros-pkg/pose_cov_ops.git
Cloning into 'pose_cov_ops'...
remote: Enumerating objects: 121, done.
remote: Total 121 (delta 0), reused 0 (delta 0), pack-reused 121
Receiving objects: 100% (121/121), 31.04 KiB | 53.00 KiB/s, done.
Resolving deltas: 100% (66/66), done.
回到catkin_ws
目录重新构建:
hannah@ubuntu:~/sources/catkin_ws/src$ cd ..
hannah@ubuntu:~/sources/catkin_ws$ catkin_make
Base path: /home/hannah/sources/catkin_ws
Source space: /home/hannah/sources/catkin_ws/src
Build space: /home/hannah/sources/catkin_ws/build
Devel space: /home/hannah/sources/catkin_ws/devel
Install space: /home/hannah/sources/catkin_ws/install
...
用命令安装(未尝试)
ubantu14.04 用 apt-get 安装 MRPT 如下:
sudo add-apt-repository ppa:joseluisblancoc/mrpt-1.5
sudo apt-get update
sudo apt-get install libmrpt-dev mrpt-apps123
安装 mrpt-bridge :
sudo apt-get install ros-indigo-mrpt-bridge1
安装 pose-cov-ops(转换数据结构):
sudo apt-get install ros-indigo-pose-cov-ops
安装 mrpt-navigation:
# This will install all packages in the mrpt_navigation metapackage
# Alternatively, install individual packages only as you need them
sudo apt-get install ros-kinetic-mrpt-navigation
补充:ubuntu自带opencv2.4.9,ros自带opencv3.3.1。编译链接想用3.3.1,做了如下操作。 1.~/.bashrc 添加export PKG_CONFIG_PATH=/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig export LD_LIBRARY_PATH=/opt/ros/kinetic/lib/x86_64-linux-gnu