ubuntu18.04安装ros



系统ubuntu18.04,安装rosMelodic

安装过程

主要借鉴下面的几个链接:
https://blog.csdn.net/leonardohaig/article/details/82813738
http://wiki.ros.org/melodic/Installation/Ubuntu
https://blog.csdn.net/r1141207831/article/details/105079463/

1.1 Setup your sources.list

使用国内清华源
Tsinghua University:

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'

1.2 Set up your keys

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

1.3 安装

首先,确保你的Debian软件包索引是最新的:

sudo apt update

1.4 安装桌面完整版

包含ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及2D/3D感知

sudo apt install ros-melodic-desktop-full

1.5 安装编译依赖

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

Initialize rosdep:

sudo apt install python-rosdep
sudo rosdep init
rosdep update

1.6 环境配置

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

问题

2.1 sudo rosdep init

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://www.guyuehome.com/12640

sudo gedit /etc/hosts
 
199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

解决方案2.还是不可行。最后是在中午网路好的时候可以了!!要等到网好

2.2 rosdep update

rosdep update

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
ERROR: error loading sources list:
(‘The read operation timed out’,)
解决:
参考https://www.guyuehome.com/34072
链接: https://pan.baidu.com/s/1cUmU91XYyf1Uz5fTXx2tAQ?pwd=ugp7
提取码: ugp7
rosdep update
这一步本质上是从20-default.list文件中的几个链接里面下载文件,并进行相关的配置。同样由于长城的缘故,容易下载失败。

解决方法
将我提供的资源中的 _rosdistro-master/文件夹 copy到/etc/ros/rosdep/sources.list.d/_路径下

(sudo cp -r ./rosdistro-master/ /etc/ros/rosdep/sources.list.d)
然后分别修改以下三个文件
第一个文件

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
将其中的资源路径改为离线路径
DEFAULT_SOURCES_LIST_URL = ‘file:/etc/ros/rosdep/sources.list.d/20-default.list’
第二个文件同理

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

REP3_TARGETS_URL = ‘file:/etc/ros/rosdep/sources.list.d/rosdistro-master/releases/targets.yaml’
第三个文件依然同理

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/init.py

DEFAULT_INDEX_URL = ‘file:/etc/ros/rosdep/sources.list.d/rosdistro-master/index-v4.yaml’
最后在最开始的终端

rosdep update
ok!
很好用,一次通过!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值