Ubuntu 18.04环境下的ROS系统安装

本文档详细记录了在Ubuntu18.04环境下安装ROS Melodic的过程,包括更换国内镜像源、设置sources.list、添加密钥、安装ROS及工具包、配置环境变量,并解决了安装过程中遇到的文件问题。
摘要由CSDN通过智能技术生成

环境:VMware

系统:Ubuntu18.04

电脑里原本装的是20.04,按教程折腾了好几个小时也没装上,所以在虚拟机里又下了Ubuntu 18.04的系统,很顺利就装起来了……

第一步:更改镜像源

Sotfware Updater -- Ubuntu Software

 前四项勾选 ,Download from 选择国内镜像源,此处选择了清华的镜像源。

第二步:设置sources.list

sources.list是Ubuntu系统保存软件源地址的文件,位于/etc/apt目录下,在这一步中我们需要将ROS的软件源地址添加到该文件中,确保后续安装可以正确找到ROS相关软件的下载地址。

可以直接添加ros源也可以添加国内的镜像源:

直接添加

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

 国内镜像(清华的,也可以添加别的http://wiki.ros.org/ROS/Installation/UbuntuMirrors):

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

可通过命令行查看当前的sources.list

sudo vi /etc/apt/sources.list

退出:

esc-> :wq

第三步:添加秘钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

第四步:安装

sudo apt-get update

我直接安装了桌面完整版

sudo apt install ros-melodic-desktop-full

工具包依赖

sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

初始化

sudo rosdep init
rosdep update

上述过程中出现了一点问题,/etc/ros/rosdep/sources.list.d/20-default.list的文件似乎有点问题,解决方法是将原文件删除,然后再新建一个同名文件,将正确内容复制进去

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

正确内容:

# 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
 
# new

然后在执行

rosdep update

第五步:配置全局环境变量

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

检验安装结果:

roscore

出现下面代码表示安装成功

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值