一、ubutnu16.04安装ros
- 打开"软件和更新“,确保下图中的”Ubuntu软件“一栏中的前四行被打上勾
- 添加ros软件源
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- 添加秘钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
- 安装ROS,这里是ubuntu16.04,推荐安装kinetic。这里如果报错,是网络服务商的原因,可以用手机开热点给电脑,然后安装即可,下面过程报错同样可以这样来解决。
sudo apt update
sudo apt install ros-kinetic-desktop-full
- 初始化rosdep,记住rosdep update一定不要加sudo
sudo rosdep init
rosdep update
- 在rosdep init时会报错如下:
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
rosdep update
成功了!!!
下面这一段解决方案就没用了,可以不看。
我们复制网址到浏览器,发现是可以进入的,网址内容如下:
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
既然不能下载,那我们手动在本地创建,在/etc目录下,我们发现并没有ros文件夹,于是我们手动逐级创建:
sudo mkdir -p /etc/ros/rosdep/sources.list.d/
sudo touch /etc/ros/rosdep/sources.list.d/20-default.list
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
然后将网址内容复制进去,注意将网址内容中的所有githubusercontent改成github,修改后的文件内容如下:
# os-specific listings first
yaml https://raw.github.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.github.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.github.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.github.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.github.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer d