Ubuntu18.04安装ROS

1.设置安装源

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/$DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

 

2设置密钥

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

在更新之前,需要安装公钥,否则无法验证签名,命令如下:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

 

3.更新软件列表

sudo apt update

 

//安装ROS时遇到E: 文件 list 第 1 行的记录格式有误 /etc/apt/sources.list.d/ros-latest.list (Component)解决办法

此时执行:

sudo rm /etc/apt/sources.list.d/ros-latest.list

即可解决。

 

4.安装ROS

sudo apt-get install ros-melodic-desktop-full

 

5.安装完成之后初始化rosdep

sudo apt install python-rosdep

 

6.初始化rosdep

sudo rosdep init

rosdep update

 

大多数情况下,做到这一步都会报错,可能会出现如下情况:

…-Website may be down或者…ERROR: unable to process source

错误原因是由于raw.githubusercontent.com被墙,程序无法下载相应的文件导致的,正常情况下我们也无法访问该网站。

 

问题解决:

A.下载rosdistro-master的压缩包,然后解压到主目录

cd ~

unzip rosdistro-master.zip

mv rosdistro-master rosdistro

链接: https://pan.baidu.com/s/1z25LvAV1Z7dCTuzELqhOsA

提取码:75r1

 

B.修改20-default.list文件

sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list

内容修改如下:

# os-specific listings first

yaml file:///home/xxx可以参考这个视频哦/rosdistro/rosdep/osx-homebrew.yaml osx

# generic

yaml file:///home/xxx/rosdistro/rosdep/base.yaml

yaml file:///home/xxx/rosdistro/rosdep/python.yaml

yaml file:///home/xxx/rosdistro/rosdep/ruby.yaml

gbpdistro file:///home/xxx/rosdistro/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ..) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

注意:上述xxx需替换为自己的用户名

 

C.修改sources_list.py文件

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

注释原DEFAULT_SOURCES_LIST_URL一行,然后在其后添加如下一行,注意: xxx替换

DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdistro/rosdep/sources.list.d/20-default.list'

 

D.修改rep3.py 文件

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

注释原REP3_TARGETS_URL一行,然后在其后添加如下一行,注意:xxx替换

REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'

 

你可能感兴趣的:(ubuntu)