ROS安装

ROS安装--记录自己的ROS安装过程

  • Ubuntu20虚拟机安装ROS
    • VM安装
    • Ubuntu20安装
    • Ubuntu镜像源替换
    • ROS安装
    • 遇到的问题

Ubuntu20虚拟机安装ROS

ROS的安装官网的教程已经很详细了,而且网上也有很多问题解决方案,很容易就搜到各种问题的解决方案。对于一个萌新,这里不会有什么高深的问题解决方案,纯粹记录自己安装过程,留下一个记录,方便以后回顾。

VM安装

这个就不用多说了,老熟练了。

Ubuntu20安装

这个也不用多说什么,去官网找到下载链接下载想要的版本就可以了。
不过这里吐槽一下:

  1. 网上找到两个Ubuntu的网址链接一个是https://www.ubuntu.org.cn,另一个是https://ubuntu.com。两个很像,但是前一个目前只有16的,不知什么情况
  2. 官网上半天没找到旧的版本下载入口,找了好长时间才发现,在导航栏点击“下载”旁边的“下拉按钮”会弹出一个菜单页,这里的最下面一栏能找到“find older releases”的链接!想想还是记一下,不要后面又忘了,找半天(哭)

Ubuntu镜像源替换

用的清华的镜像源。可以直接搜索“清华源”,在镜像列表里,点击任意条目后面的“?”就可以显示镜像的使用帮助,这里有如何替换镜像的说明。

ROS安装

官方网站的安装教程:http://wiki.ros.org/noetic/Installation/Ubuntu
需要说明的是:官方添加密钥的指令中并没有具体的密钥,需要自己填写,这个太坑了,不过有这篇大额解决方案:https://blog.csdn.net/Netceor/article/details/118655603
我采用了第一中方案:

  1. 找到key文件内容:网址:http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  2. 将打开网页的整个内容复制进txt文件【别忘了comment和version行】,保存文件名为 “ ros.asc ” ,传入虚拟机。
  3. 在文件所在文件夹下打开终端,输入sudo apt-key add ros.asc

遇到的问题

  1. 使用 sudo rosdep init指令时,报错:

sudo: rosdep: command not found

搜索这个博客遇到过同样的问题:https://blog.csdn.net/TinyBenji/article/details/124084536
按照

#ROS Noetic
sudo apt-get install python3-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.

最终按照知乎大神的帖子(https://zhuanlan.zhihu.com/p/515361781)完成了安装。膜拜一下!

解决步骤:

  1. 下载rosdistro的源码

在https://github.com/ros/rosdistro下载源码,复制到虚拟机后,解压到自己指定的本地文件夹/opt/ros/noetic/文件夹下,并把解压的文件夹名称改为:rosdistro

  1. 修改文件1:20-default.list

文件路径:/opt/ros/noetic/rosdistro/rosdep/sources.list.d/20-default.list
将文件中http***/master/的内容替换为本地rosdistro的路径file:///opt/ros/noetic/rosdistro/

sudo gedit /opt/ros/noetic/rosdistro/rosdep/sources.list.d/20-default.list
#修改为如下内容
#os-specific listings first
yaml file:///opt/ros/noetic/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///opt/ros/noetic/rosdistro/rosdep/base.yaml
yaml file:///opt/ros/noetic/rosdistro/rosdep/python.yaml
yaml file:///opt/ros/noetic/rosdistro/rosdep/ruby.yaml
gbpdistro file:///opt/ros/noetic/rosdistro/releases/fuerte.yaml fuerte
#newer distributions (Groovy, Hydro, …) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

  1. 修改文件2:gbpdistro_support.py
    文件路径:/usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py
    将文件中http***/master/的内容替换为本地rosdistro的路径file:///opt/ros/noetic/rosdistro/

sudo gedit /usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py
#修改为如下内容
FUERTE_GBPDISTRO_URL = ‘file:///opt/ros/noetic/rosdistro/’
‘releases/fuerte.yaml’

  1. 修改文件3:rep3.py
    文件路径:/usr/lib/python3/dist-packages/rosdep2/rep3.py
    将文件中http***/master/的内容替换为本地rosdistro的路径file:///opt/ros/noetic/rosdistro/

sudo gedit /usr/lib/python3/dist-packages/rosdep2/rep3.py
#修改为如下内容
REP3_TARGETS_URL = ‘file:///opt/ros/noetic/rosdistro/releases/targets.yaml’

  1. 修改文件4:init.py
    文件路径:/usr/lib/python3/dist-packages/rosdistro/init.py
    将文件中http***/master/的内容替换为本地rosdistro的路径file:///opt/ros/noetic/rosdistro/

sudo gedit /usr/lib/python3/dist-packages/rosdistro/init.py
#修改为如下内容
DEFAULT_INDEX_URL = ‘file:///opt/ros/noetic/rosdistro/index-v4.yaml’

  1. 安装python-rosdep

在终端入如下指令安装python-rosdep,如果不安装,在运行sudo rosdep init时可能会出现"sudo: rosdep:找不到命令"的错误。

#Noetic版本ROS为python3-rosdep
sudo apt-get install python3-rosdep

你可能感兴趣的:(机器人,ubuntu)