ROS安装(国内源)

1.添加源

1.1 USTC源

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'

如执行有问题,则:html

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

1.2 TUNA源

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'

注:配合http://www.javashuo.com/article/p-qumnkkio-bh.html所提到的更换Ubuntu系统源,安装速度非国外源可比。python

2.添加私钥

wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -

如不能添加,则:git

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116

3.更新软件列表

sudo apt-get update

注意:通常无需使用sudo apt-get upgrade这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,若是发现已安装的软件版本过低,就会提示你更新。而sudo apt-get update这个命令,只是访问源列表里的每一个网址读取软件列表,而后保存在本地电脑。github

3.1 GPG 错误

W: GPG 错误:http://mirrors.ustc.edu.cn/ros/ubuntu xenial InRelease: 因为没有公钥,没法验证下列签名: NO_PUBKEY F42ED6FBAB17C654

错误缘由:

多是缺乏公钥,也多是公钥过时。ubuntu

解决方法:

既然是没有公钥,天然是添加公钥。ruby

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

3.2 404 Not Found错误

W: 仓库 “http://ppa.launchpad.net/tualatrix/ppa/ubuntu xenial Release” 没有 Release 文件。
N: 没法认证来自该源的数据,因此使用它会带来潜在风险。
N: 参见 apt-secure(8) 手册以了解仓库建立和用户配置方面的细节。
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-i386/Packages  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-all/Packages  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/i18n/Translation-zh_CN  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/i18n/Translation-zh  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/i18n/Translation-en  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/dep11/Components-amd64.yml  404  Not Found [IP: 91.189.95.83 80]
W: 没法下载 http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/dep11/icons-64x64.tar  404  Not Found [IP: 91.189.95.83 80]
W: 部分索引文件下载失败。若是忽略它们,那将转而使用旧的索引文件。

错误缘由:

首先说明此问题与ROS安装无关。bash

缘由多是PPA源中此用户删除了这些文件,但又添加了此源。工具

解决方法:

打开/etc/apt/sources.list.d文件夹,删除相关源文件。测试

4.安装ROS

sudo apt-get install ros-kinetic-desktop-full

注意:fetch

  1. 按需选用full或者是base,base没有图形化界面,适合安装在机器人上;
  2. 按照Ubuntu版本选择ROS版本,kinetic版本适合于Ubuntu 16.04,其余Ubuntu版本各有其相应的ROS版本,不建议混用。
  3. 安装完成后,能够用下面的命令来查看可以使用的包
    apt-cache search ros-kinetic

5.初始化

sudo rosdep init
rosdep update

可能出现问题:

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.

解决方案:

多试几回!国内链接githubsercontent.com比较慢,容易失败。

若是屡次尝试未果,能够尝试以下方法:

http://www.javashuo.com/article/p-uzcpsfza-kd.html

下面提供我我的设置的文件:

  1. 原始20-default.list:https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/20-default.list
  2. 修改后的20-default.list文件:
    #Rewrited by HAN_Letisl
    #For more information: https://www.cnblogs.com/letisl
    
    # os-specific listings first
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/osx-homebrew.yaml osx
    
    # generic
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/base.yaml
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/python.yaml
    yaml https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/ruby.yaml
    gbpdistro https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/fuerte.yaml fuerte
    
    # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

    注意:其Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml在20-default.list不显式出现,所以未能将这个文件包括在其中,我的镜像中有这个文件(https://hansteam.coding.net/p/rosdeap_mirror/d/rosdeap_mirror/git/raw/master/index-v4.yaml),须要使用的朋友能够自行设法使用。

备注:彻底正确的结果图,供参考。

 

 

6.环境配置

#echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc 这个命令是错误的,勿用。引号是中文引号,与下一条对比。
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc source
~/.bashrc

可能出现问题:

“source:未找到命令

问题缘由:

根据提示,打开/.bashrc文件:

”source /opt/ros/kinetic/setup.bash“

发现最后一行竟然多了两侧的引号,并且是中文引号。

缘由在于,上述命令中的引号问题。

7.安装rosinstall

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

8.测试是否安装成功

roscore

若是显示以下:

started core service [/rosout]

表明安装成功。

9.安装IDE

RoboWare Studio是ROS的一款IDE,可是它的功能又比较强大,使得开发更加快速、简单。这款软件适合菜鸟入门,由于不少配置都直接自动生成。

直接进入其中文官网,http://cn.roboware.me/#/home,下载deb包安装便可。

9.1安装包

事实上,中文官网彷佛用了XX工具也不能打开。

提供我的下载连接:roboware-studio_1.1.0-1514335284_amd64.deb:https://hansteam.coding.net/s/ffc0144b-9c57-4173-974a-ba03986d2719

9.2预先安装

安装pyint用于支持Python调试功能:

sudo apt-get install python-pip
sudo python -m pip install pylint

备注:若是出现问题,可参照:

https://blog.csdn.net/zhuiqiuzhuoyue583/article/details/84536406

简单讲,能够:

  1. 执行sudo apt-get install python-pip
  2. sudo gedit /usr/bin/pip,修改成:
    #!/usr/bin/python
    # GENERATED BY DEBIAN
    
    import sys
    
    # Run the main entry point, similarly to how setuptools does it, but because
    # we didn't install the actual entry point from setup.py, don't use the
    # pkg_resources API.
    from pip import __main__
    if __name__ == '__main__':
        sys.exit(__main__._main())
    #modify when install roboware @hans,2019.11.8
    #from pip import main
    #if __name__ == '__main__':
    #    sys.exit(main())
  3. pip install --upgrade pip
  4. sudo pip install --ignore-installed enum34
  5. sudo python -m pip install pylint

安装clang-format得到更好的代码阅读体验,自动格式化整理代码:

sudo apt-get install clang-format-3.8

9.3正式安装

sudo dpkg -i roboware-studio_1.1.0-1514335284_amd64.deb

安装完毕后:

roboware-studio

输入以上命令,便可打开该IDE使用。

参考资料:RoboWare_Studio_Manual_1.1.0_CHS.pdf

也可使用最新版:roboware-studio_1.2.0-1524709819_amd64.debRoboWare_Studio_Manual_1.2.0_CHS.pdf

参考资料

更多内容,详见:http://wiki.ros.org/kinetic/Installation/Ubuntu

相关文章
相关标签/搜索