ROS环境安装教程

ROS环境安装步骤:(共7步)

在命令行依次执行以下指令进行安装:

  1. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
    
  2. sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116
    

此时可能报错:

在这里插入图片描述

解决方案:

依次运行以下命令:

sudo gpg --keyserver keyserver.ubuntu.com --recv F42ED6FBAB17C654
sudo gpg --export --armor F42ED6FBAB17C654 | sudo apt-key add -

再继续运行以下命令:

  1. sudo apt-get install ros-kinetic-ros-base

更多安装包可通过sudo apt-get install ros-kinecit-PACKAGE进行安装,其中“PACKAGE”为指定包名。安装完成后,继续执行:

  1. sudo rosdep init
    
  2. rosdep update
    

这一步必然出错,解决方案见下文:

错误原因:

在这里插入图片描述

默认GitHub网址已更新,此时需要更换默认配置文件(即20-default.list)

解决方案:

此时需要编辑list文件里的内容修改信息,本人习惯用vim,用以下命令安装:

sudo apt-get install vim

在这里插入图片描述

输入y按enter,安装完成如下图:

在这里插入图片描述

将此文件下载到本地,然后复制到本地的共享文件夹内,并解压,将解压后的文件夹名修改为rosdistro,

github链接:rosdistro-master

在这里插入图片描述

在Ubuntu终端下将共享文件夹内的此文件夹复制到etc/ros下,

进入Ubuntu的共享文件夹内,即 cd /mnt/hgfs/<你的共享文件夹的名字>

运行以下命令:sudo cp -r rosdistro /etc/ros/rosdistro

进入目标文件夹,命令行输入:cd /etc/ros/rosdep/sources.list.d

在这里插入图片描述

编辑list文本里面的内容,运行命令:

sudo vim 20-default.list

在这里插入图片描述

将以下内容替换原本内容并保存退出:

yaml file:///etc/ros/rosdistro/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

yaml file:///etc/ros/rosdistro/rosdep/base.yaml

yaml file:///etc/ros/rosdistro/rosdep/python.yaml

yaml file:///etc/ros/rosdistro/rosdep/ruby.yaml

gbpdistro file:///etc/ros/rosdistro/releases/fuerte.yaml fuerte

 

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

接下来需要修改三个文件:

a. 运行:

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

找到REP3_TARGETS_URL ,

替换为

REP3_TARGETS_URL = 'file:///etc/ros/rosdistro/releases/targets.yaml'

在这里插入图片描述

b. 运行:

sudo vim /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py

找到:FUERTE_GBPDISTRO_URL

替换为

FUERTE_GBPDISTRO_URL = 'file:///ros/rosdistro/' \
'releases/fuerte.yaml'

在这里插入图片描述

c. 运行:

sudo vim /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

修改DEFAULT_INDEX_URL内容为:

DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/index-v4.yaml'

在这里插入图片描述

最后运行:rosdep update,成功

在这里插入图片描述

  1. echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
    
    至此环境安装完毕。
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

部长张美玉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值