ubuntu16.04安装ros填各类坑
step1:添加源(国内源)
ros源在ros官网上给出了国内的四个源地址,使用国内源下载会比较快,在使用中科大和清华源均无法下载的情况下,使用北外的源。
添加源:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.bfsu.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
step2:添加密钥
当前大多数博客上添加密钥都添加如下密钥:
密钥1:
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
若无法下载该密钥,可以使用下面的密钥:
密钥2:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
step3:更新软件列表
sudo apt-get update
注意:一般无需使用sudo apt-get upgrade这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,就会提示你更新。而sudo apt-get update这个命令,只是访问源列表里的每个网址读取软件列表,然后保存在本地电脑。
如果有某些包无法下载可以使用如下命令更新:
sudo apt-get update --fix-missing
step4:安装ros
sudo apt-get install ros-kinetic-desktop-full
step5:初始化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.
使用如下方法解决:
cd /etc
sudo gedit hosts
在文件末尾添加
151.101.84.133 raw.githubusercontent.com
重新运行
sudo rosdep init
运行
rosdep update
step6:配置环境变量
echo source /opt/ros/kinetic/setup.bash >> ~/.bashrc
source ~/.bashrc
这里需要注意的是,许多博客中这条命令都是这样的
echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc
这样将会导致source:找不到命令的错误
step7:安装rosinstall
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
step8:测试
roscore
显示
started core service [/rosout]
为安装成功