[ROS] [笔记(0)] 在 Ubuntu 14.04 系统上安装 ROS indigo
ROS 的发行版很多,最新的版本是 jade。但是通常情况下我们更多地使用其稳定版本 indigo。这篇文章就讲下 indigo 版本在 Ubuntu 下的安装。
0、安装环境:
Ubuntu 14.04.3 LTS
1、配置源:
使用 ROS 官方源:
1 | sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' |
使用国内镜像源:
1 | sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list' |
设置Key:
1 | sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116 |
更新安装包:
1 | sudo apt-get update |
升级安装包(通常情况下不需要这一步):
1 | sudo apt-get upgrade |
2、安装 ROS:
推荐新手安装 Desktop-Full 版本,其他版本都有一些东西不全。安装命令如下:
1 | sudo apt-get install ros-indigo-desktop-full |
或者直接点击:
点击这里
其他版本安装方式参见 [1]:
3、初始化 rosdep:
使用以下命令初始化 rosdep:
1 2 | sudo rosdep init rosdep update |
4、环境配置:
为了方便每次系统重启时可以自动配置好 ros 相关环境,在 ~/.bashrc 文件末尾增加如下代码:
1 | source /opt/ros/indigo/setup.bash |
或者直接运行以下命令:
1 | echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc |
运行如下命令使配置生效:
1 | source ~/.bashrc |
这样以后每次重启都可以自动配置好环境了。
5、安装 rosinstall:
很多常见包都使用 rosinstall 工具,使用如下命令安装:
1 | sudo apt-get install python-rosinstall |
到此安装结束,开始你的ROS之旅吧!
常见问题:
1、64位系统下:Some packages could not be installed. 错误
在很多64位机器上如果安装 ros-indigo-desktop-full 会出现如下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
ros-indigo-desktop-full : Depends: ros-indigo-desktop but it is not going to be installed
Depends: ros-indigo-simulators but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
解决这一问题的方法一个是只安装核心库 ros-indigo-desktop 或者可以尝试先卸载下面的组件:
1 | sudo apt-get remove gazebo-* sdformat-* |
2、错误:default sources list file already exists
在运行 sudo rosdep init 时可能出现如下错误:
ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
通常这是因为你之前曾经安装过 ROS 系统的某个版本,只需按照提示删除已经存在的初始化文件即可:
1 | sudo rm /etc/ros/rosdep/sources.list.d/20-default.list |
然后再重新运行 sudo rosdep init 就没有问题了。