栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Ubuntu 18.04安装ROS Melodic详解

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Ubuntu 18.04安装ROS Melodic详解

目录

文章目录

前言

1.设置软件源

2.设置密钥

 3.安装

4.配置环境变量

5.配置编译依赖

5.1初始化rosdep

总结



前言

        最近几次在Ubuntu上安装ROS,每次都会遇到不少坑要到网上找各位大神的文章。因此,特此将安装经验整理汇总了一下,以备后面需要的时候查阅。



1.设置软件源

国外的源更新软件时会比较慢,因此这里选择使用清华的软件源。

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


2.设置密钥

如果未安装curl,需要先安装此工具。

sudo apt install curl

设置密钥

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

此处常会遇到raw.githubusercontent.com无法访问的问题,解决方案如下:

首先,访问raw.githubusercontent.com网络查询raw.Githubusercontent.com的DNS。

其次,编辑/etc/hosts文件,将查找到的DNS及对应的URL地址添加到文件中,如图所示:

 3.安装

首先,更新软件源为最新版本。

sudo apt update

其次,安装推荐的Desktop-Full Install版本。

sudo apt install ros-melodic-desktop-full

4.配置环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

5.配置编译依赖
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

5.1初始化rosdep

首先,安装rosdep。

sudo apt install python-rosdep

其次,初始化并更新rosdep。

sudo rosdep init
rosdep update

如果rosdep初始化或更新超时,需要修改如下文件内容。

修改/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py:

变量DEFAULT_SOURCES_LIST_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list';

函数download_rosdep_data中的url_request = request.Request("https://ghproxy.com/" + url, headers={'User-Agent': 'rosdep/{version}'.format(version=__version__)})

修改/usr/lib/python2.7/dist-packages/rosdistro/__init__.py: 

变量DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'



总结

        以上简单的记录了在Ubuntu 18.04环境下安装ROS Melodic的安装步骤和安装过程中会遇到的一些常见的问题及其解决方案,希望能有所帮助。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/422887.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号