ROS学习——Ubuntu18.04下安装ROS Melodic

前言:

        本篇文章记录了一个ROS小白安装ROS的过程。本博文参考连接在文章最后。

        首先要知道的是不同的Ubuntu版本会对应着不同的ROS发行版,而18.04对应的是Melodic。

一、软件配置要求:

        配置Ubuntu 软件和更新界面,允许"main", “restricted” ,“universe,” and “multiverse”,如图:

ROS学习——Ubuntu18.04下安装ROS Melodic_第1张图片

        在下载自处,修改服务器配置。我选择的是中科大的源(USTC)

二、安装Melodic

1.配置ROS软件源

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.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 C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3.更新软件源

sudo apt update

4.安装Melodic

sudo apt install ros-melodic-desktop-full

5.初始化rosdep

sudo rosdep init
rosdep update

若出现问题

git clone https://github.com/ros/rosdistro.git

然后修改文件: (1). /usr/lib/python3/dist-packages/rosdep2/rep3.py

# REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
REP3_TARGETS_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'

(2). /usr/lib/python3/dist-packages/rosdistro/__init__.py

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

(3). /etc/ros/rosdep/sources.list.d/20-default.list

# os-specific listings first
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

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

再执行 rosdep update,成功:

ROS学习——Ubuntu18.04下安装ROS Melodic_第2张图片

 6. 用户环境设置

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

7. 安装包编译依赖

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

8. 验证安装

rosversion -d

9. 参考链接:

ROS Melodic安装教程_MAVER1CK的博客-CSDN博客_ros melodic安装

ROS学习——rosdep update 超时解决方法_senlijiu的博客-CSDN博客_rosdep update超时

Ubuntu18.04安装ROS Melodic(详细,亲测安装完成,有清晰的截图步骤)_爱跑步的mango的博客-CSDN博客_ubuntu1804安装ros

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