ROS安装教程(详细)

总结一下这两天安装ROS的过程。

 

1 配置软件库

桌面左侧栏 点search your computer,输入updates,点 Software & Updates,将main,universe,multiuniverse,restricted全都勾上,将Download from换成中科大的  http://mirrors.ustc.edu,cn/ubuntu 

 

2 设置软件源

打开/etc/apt/sources.list,将以下内容加入。编辑之前可以先进行备份。

deb http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

deb http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe

deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe
 

如果是用sudo gedit /etc/apt/sources.list打开的,可能无法编辑(文本只读),我使用的是下面的命令

sudo nano /etc/apt/sources.list

保存之后,执行

sudo apt-get update

sudo apt-get upgrade

 

3 按照指导安装

接下来的步骤参考官网教程就好。

官网教程

 

4 遇到的问题及解决

 

4.1 配置软件库的错误

在关闭Software & Updates时候需要reload。如果reload结果是这样的

又或者是你在sudo apt-get update的时候报这种错:

W: Target Packages (universe/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64

W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64

W: Target Translations (universe/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64

W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:10 and /etc/apt/sources.list:64

说明你在sources.list里面有两个相同的软件源,它们的后缀可能不一样(比如有的是main,有的是restricted,有的可能是包含关系如restricted 和 main restricted 等)。将多余的删掉。我是将重复的删去一个,将包含与被包含的删除被包含的。之后再重新sudo apt-get update就可以了。

 

4.2 设置软件源的错误

我曾在sources.list里面将

http://packages.ros.org/ros/ubuntu $(lsb_release Release

改成了

http://packages.ros.org/ros/ubuntu trusty

之后就变成了下面的错误

W: The repository 'http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release' does not have a Release file.

N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.

N: See apt-secure(8) manpage for repository creation and user configuration details.

E: Failed to fetch http://ppa.launchpad.net/fcitx-team/nightly/ubuntu/dists/xenial/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

然后我在software&update->other software里面把

http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release

的勾选去掉了,就不会报does not have a Release file的错误了。

 

4.3 按照官网教程安装时出现的错误

执行到Set up your keys这一步的时候,出错

gpg: requesting key B01FA116 from hkp server ha.pool.sks-keyservers.net

gpgkeys: key 421C365BD9FF1F717815A3895523BAEEB01FA116 can't be retrieved

gpg: no valid OpenPGP data found.

gpg: Total number processed: 0

gpg: keyserver communications error: keyserver helper general error

gpg: keyserver communications error: unknown pubkey algorithm

gpg: keyserver receive failed: unknown pubkey algorithm

受[2]的启发,我将宿主机上的蓝灯关掉了,就没错了。

接着我执行

sudo apt-get update

报错

Err:15 http://10.0.0.167/files/51160000022738DE/packages.ros.org/ros/ubuntu xenial/main i386 Packages

  Hash Sum mismatch

Fetched 554 kB in 1s (315 kB/s)

Reading package lists... Done

E: Failed to fetch http://10.0.0.167/files/51160000022738DE/packages.ros.org/ros/ubuntu/dists/xenial/main/binary-i386/Packages.gz  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

网上说这个错误应该跟GFW有关,于是我又重新打开了蓝灯,再执行一次,没错了

接着执行

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

报错

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-kinetic-desktop-full : Depends: ros-kinetic-desktop but it is not going to be installed

                            Depends: ros-kinetic-perception but it is not going to be installed

                            Depends: ros-kinetic-simulators but it is not going to be installed

                            Depends: ros-kinetic-urdf-tutorial but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

按照[3]中的方法,我执行

sudo apt-get update && sudo apt-get upgrade

在结果中出现了

The following packages have been kept back:

  linux-generic-hwe-16.04 linux-headers-generic-hwe-16.04

  linux-image-generic-hwe-16.04

0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

于是我分别执行

sudo apt-get install linux-generic-hwe-16.04 linux-headers-generic-hwe-16.04

sudo apt-get install linux-image-generic-hwe-16.04

但是还是没能解决上面Depends的错误,于是我照[4]中的办法来做,同时又按照[5]中的办法手动安装缺失的依赖包。之后再重新执行sudo apt-get install ros-kinetic-desktop-ful,这会终于成功了!


参考资料

[1]https://blog.csdn.net/qq_37193603/article/details/72900797

[2]https://community.hortonworks.com/questions/147024/gpgkeys-key-b9733a7a07513cad-cant-be-retrieved-1.html

[3]https://answers.ros.org/question/243920/how-to-install-ros-kinetic-ubuntu-1604/

[4]https://blog.csdn.net/xiangxianghehe/article/details/78483799

[5]https://blog.csdn.net/l_h2010/article/details/46831245

  • 14
    点赞
  • 146
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
在Ubuntu 18.04上安装ROS教程如下: 1. 首先,配置Ubuntu 18.04软件仓库。这可以通过在终端中运行以下命令来完成: ``` sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' ``` 2. 接下来,添加ROS密钥。在终端中输入以下命令: ``` sudo apt install curl curl -sSL http://packages.ros.org/ros.key | sudo apt-key add - ``` 3. 然后,更新软件包索引并安装ROS。在终端中输入以下命令: ``` sudo apt update sudo apt install ros-melodic-desktop-full ``` 4. 安装完成后,需要初始化ROS环境。可以通过运行以下命令来完成: ``` echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 5. 最后,进行ROS的测试。在终端中输入以下命令: ``` roscore ``` 以上就是在Ubuntu 18.04上安装ROS的基本教程。更多详细信息和其他可能遇到的问题,请参考ROS官方网站提供的安装教程:http://wiki.ros.org/noetic/Installation/Ubuntu。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [ROS安装步骤教程](https://blog.csdn.net/dally2/article/details/118028380)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值