• Ubuntu16.04安装ROS Kinetic详细过程


    Ubuntu16.04安装ROS Kinetic详细过程 - 古月居 (guyuehome.com)

    Ubuntu16.04安装ROS Kinetic详细过程

      • 1、设置sources.list
      • 2、设置key(公钥已更新)
      • 3、更新package
      • 4、安装ROS kinetic完整版
      • 5、初始化rosdep
      • 6、配置ROS环境
      • 7、安装依赖项
      • 8、测试ROS是否安装成功

    1、设置sources.list

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

     设置成清华的源:

    参考:https://www.bilibili.com/video/BV1VF41167Vp/?spm_id_from=333.337.search-card.all.click&vd_source=1b703ff170897441644f9890b98009c6

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

    设置key之前设置密钥:

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

    2、设置key(公钥已更新)

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

    3、更新package

    sudo apt-get update

    4、安装ROS kinetic完整版

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

    5、初始化rosdep

    注意:在使用ROS之前需要初始化rosdep

    sudo rosdep init

    rosdep update

    当运行sudo rosdep init的时候(xps 15 9550-ubuntu虚拟机)出现下面这个问题:

    qin@dell:~$ 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.

    参考解决办法:

    rosdep init ROS安装问题解决方案 - 古月居 (guyuehome.com)

    假如无法从raw.githubusercontent.com更新rosdep,

    qin@qin-virtual-machine:~$ rosdep update
    reading in sources list data from /etc/ros/rosdep/sources.list.d
    ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
        <urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)
    ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml]:
        <urlopen error ('_ssl.c:574: The handshake operation timed out',)> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)

    参考解决办法是:

    https://blog.csdn.net/qq_30267617/article/details/115028689

     终极办法:

    (三)方法三
    前面说了rosdep update做的事情就是根据20-default.list文件中的网址链接("raw.githubusercontent.com")去下载相应的文件,既然用网络下载不了,能不能手动下载呢?答案是可以的。

    raw.githubusercontent.com实际上就是github的用户数据服务器,rosdep程序下载的就是github.com/ros/rosdistro这个repository里的文件。

    执行下面的命令:

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

     
    (当然也可以直接去https://github.com/ros/rosdistro.git点Download Zip下载)

    注:我利用git clone https://github.com/ros/rosdistro.git下载后不知道下载哪里去了,所以还是从github上下载源码。

    https://github.com/search?q=rosdistro

    网速可能会有点慢,这里我也提供免费下载:ROS安装文件rosdistro-master.zip。

    会在当前目录下载进一个名为rosdistro-master.zip的文件夹,前面说的那些文件都在里面。

    首先将这个文件解压,然后放到一个新的目录下,我放到了/etc/ros下,执行命令(具体的路径根据你的目录修改)

    sudo cp -r /home/ubuntu/Documents/rosdistro-master /etc/ros

    我的路径是这样的:
    sudo cp -r /home/qin/rosdistro-master /etc/ros
    首先修改20-default.list,执行:

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

    将里面链接到"raw.githubusercontent.com"的内容全部替换为链接到本地文件,最后20-default.list的内容是这样的(具体的文件路径根据你放的位置更改):

    # os-specific listings first
    #yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
    yaml file:///etc/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
    yaml file:///etc/ros/rosdistro-master/rosdep/base.yaml
    yaml file:///etc/ros/rosdistro-master/rosdep/python.yaml
    yaml file:///etc/ros/rosdistro-master/rosdep/ruby.yaml
    gbpdistro file:///etc/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


    然后修改下面三个文件,同样将其中链接到"raw.githubusercontent.com"的内容全部替换为链接到本地文件。可以使用Ctrl+F 查找 raw.githubusercontent.com,每个文件当中都有一处需要修改。

    1. /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
    2. /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
    3. /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
    修改方法如下:
    修改gbpdistro_support.py,执行:

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


    使用Ctrl+F定位到raw.githubusercontent.com这一行(使用Ctrl+F 查找),注释掉原来的链接改为本地文件,修改的内容如下面所示:

    # FUERTE_GBPDISTRO_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml'
    FUERTE_GBPDISTRO_URL = 'file:///etc/ros/rosdistro-master/releases/fuerte.yaml'


    文件里面截图是这样的:

     

    修改rep3.py,执行:

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



    同样定位到raw.githubusercontent.com这一行(使用Ctrl+F 查找),注释掉原来的链接改为本地文件,修改的内容如下面所示:

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

    修改__init__.py,执行:

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

    同样定位到raw.githubusercontent.com这一行(使用Ctrl+F 查找),注释掉原来的链接改为本地文件,修改的内容如下面所示:

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

    好了,再次执行rosdep update,这次肯定是要成功了,结果如下面所示。

     

     

     

    6、配置ROS环境

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

    7、安装依赖项


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

     

    下面一段文字的内容来自:https://github.com/AbangLZU/ad_with_lanelet2

    For Ubuntu, the steps are the following:

    • Set up ROS, and install at least rospackcatkin and mrt_cmake_modules (e.g. ros-melodic-rospackros-melodic-catkinros-melodic-mrt-cmake-modules):

    sudo apt-get install ros-melodic-rospack ros-melodic-catkin ros-melodic-mrt-cmake-modules ros-melodic-unique-id
    当安装:

    sudo apt-get install ros-melodic-rospack

    的时候,出现下面的错误(dell 5820):

    dell@dell-Precision-5820-Tower:~$ sudo apt-get install ros-melodic-rospack
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package ros-melodic-rospack
    • Install the dependencies above:
    sudo apt-get install libboost-dev libeigen3-dev libgeographic-dev libpugixml-dev libpython-dev libboost-python-dev python-catkin-tools

    On 16.04 and below, mrt_cmake_modules is not available in ROS and you have to clone it into your workspace (git clone https://github.com/KIT-MRT/mrt_cmake_modules.git).

    Building

    As usual with Catkin, after you have sourced the ros installation, you have to create a workspace and clone all required packages there. Then you can build.

    source /opt/ros/$ROS_DISTRO/setup.bash
    mkdir catkin_ws && cd catkin_ws && mkdir src
    catkin init
    catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo # build in release mode (or whatever you prefer)
    cd src
    git clone https://github.com/fzi-forschungszentrum-informatik/lanelet2.git
    cd ..
    catkin build

    注意:
    执行git clone https://github.com/fzi-forschungszentrum-informatik/lanelet2.git的时候出现错误:
    qin@qin-virtual-machine:~/catkin_ws/src$ git clone https://github.com/fzi-forschungszentrum-informatik/lanelet2.git
    Cloning into 'lanelet2'...
    fatal: unable to access 'https://github.com/fzi-forschungszentrum-informatik/lanelet2.git/': Failed to connect to github.com port 443: Connection refused

    解决办法,换源:

    # 正常git clone
    git clone https://github.com/username/xxx.git
    
    # 换源1 -> [github.com.cnpmjs.org]
    git clone https://github.com.cnpmjs.org/fzi-forschungszentrum-informatik/lanelet2.git
     # 换源2 -> [github.com.cnpmjs.org] 
    git clone https:
    /github.com.cnpmjs.org/fzi-forschungszentrum-informatik/lanelet2.git

    依然是不行的。。。

    最后手动下载lanelet2.




    8、测试ROS是否安装成功

    (1)、CTRL+ALT+T打开终端(Termial),输入以下命令,初始化ROS环境:

    roscore

    成功打开如下图所示:

    上面显示有ROS的版本,还有一些节点、端号等内容。

    这个时候可以新打开一个终端,打入:rviz,就会出现下面的界面了:


    (2)、再 打开一个新的终端(Termial),输入以下命令,弹出一个小乌龟窗口:

    rosrun turtlesim turtlesim_node


    (3)、出现一个小乌龟的LOGO后,再 打开一个新的终端(Termial),输入以下命令

    
    rosrun turtlesim turtle_teleop_key


    然后,通过方向键控制小乌龟的移动:如下图所示

    (4)、 打开新的Termial,输入以下命令,可以查看ROS节点信息:

    rosrun rqt_graph rqt_graph


    如果你能顺利进行到这一步,说明ROS安装成功了。
    如果大家在安装的过程中出现问题或者错误(ERROR),可以给我留言,大家可以相互交流一些。

  • 相关阅读:
    Logstash收集Tomcat日志
    Logstash收集日志
    ELK搭建&Logstash 日志收集
    ELK介绍
    中文分词器
    ES数据备份与恢复
    Python开发之路
    Linux阅读目录
    333
    22222222
  • 原文地址:https://www.cnblogs.com/yibeimingyue/p/16871293.html
Copyright © 2020-2023  润新知