• ubuntu安装ROS


    进官网,选版本,操作系统

    ROS: Home

    开始安装:

    noetic/Installation/Ubuntu - ROS Wiki

    Installation

    Configure your Ubuntu repositories

    Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this.

    Setup your sources.list

    Setup your computer to accept software from packages.ros.org.

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

    Mirrors

    Source Debs are also available

    选择清华的镜像

    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'

    Set up your keys

    curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

    报错了:

    ~$ 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'
    [sudo] password for wangzhao:
    xxx@RedmiBook-14:~$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

    Command 'curl' not found, but can be installed with:

    sudo snap install curl  # version 7.76.1, or
    sudo apt  install curl  # version 7.68.0-1ubuntu2.5

    See 'snap info curl' for additional versions.

    gpg: no valid OpenPGP data found.

    按照提示安装curl,再来一遍

    所有国内的都试遍了,都不行。。。。

    最后是日本的可以:

    1. sudo sh -c 'echo "deb http://packages.ros.org.jsk.imi.i.u-tokyo.ac.jp/ros/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
    2. wget http://ros.jsk.imi.i.u-tokyo.ac.jp/jsk.key -O - | sudo apt-key add -

     ~$ wget http://ros.jsk.imi.i.u-tokyo.ac.jp/jsk.key -O - | sudo apt-key add -
    --2021-06-28 22:17:21--  http://ros.jsk.imi.i.u-tokyo.ac.jp/jsk.key
    Resolving ros.jsk.imi.i.u-tokyo.ac.jp (ros.jsk.imi.i.u-tokyo.ac.jp)... 133.11.216.230
    Connecting to ros.jsk.imi.i.u-tokyo.ac.jp (ros.jsk.imi.i.u-tokyo.ac.jp)|133.11.216.230|:80... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: http://packages.ros.org.jsk.imi.i.u-tokyo.ac.jp/jsk.key [following]
    --2021-06-28 22:17:23--  http://packages.ros.org.jsk.imi.i.u-tokyo.ac.jp/jsk.key
    Resolving packages.ros.org.jsk.imi.i.u-tokyo.ac.jp (packages.ros.org.jsk.imi.i.u-tokyo.ac.jp)... 133.11.216.230
    Reusing existing connection to ros.jsk.imi.i.u-tokyo.ac.jp:80.
    HTTP request sent, awaiting response... 200 OK
    Length: 2448 (2.4K)
    Saving to: ‘STDOUT’

    -                   100%[===================>]   2.39K  --.-KB/s    in 0s      

    2021-06-28 22:17:26 (66.0 MB/s) - written to stdout [2448/2448]

    OK

    那继续吧。

    这步也可以直接用

    sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
    sudo apt update
    sudo apt install ros-noetic-desktop-full

    漫长的安装过程,可以干点别的。

    装完以后,设置环境

    You must source this script in every bash terminal you use ROS in.

    source /opt/ros/noetic/setup.bash

     安装依赖库

    Dependencies for building packages

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

    Initialize rosdep

    rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS. If you have not yet installed rosdep, do so as follows.

    sudo apt install python3-rosdep
    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.

    1. raw.githubusercontent.com其实可以ping通,不过没什么用。
    2. 这个问题很大,网上的方法很多。简单点的:
    sudo nano /etc/hosts
    1. 在文件末尾添加
    2. 199.232.68.133 raw.githubusercontent.com
    3. (也有人在 /etc/hosts文件的末尾添加
    4. 199.232.68.133 raw.githubusercontent.com)
    5. 保存退出。我的ubuntu20,这样设置就解决了。

    $ sudo rosdep init
    Wrote /etc/ros/rosdep/sources.list.d/20-default.list
    Recommended: please run

        rosdep update

    但是rosdep update,还是没有过:

    ~$ 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]:
         (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)

    最后一个办法,自己下载rosdistro,本地init。

    首先去github.com/ros/rosdistro把包下载下来。

    修改这个包中rosdep/source.list.d/下的文件20-default.list,将这个文件中指向raw.githubusercontent.com的url地址全部修改为指向本地文件的地址:

    1. # os-specific listings first
    2. yaml file:///home/username/rosdistro-master/rosdep/osx-homebrew.yaml osx
    3. # generic
    4. yaml file:///home/username/rosdistro-master/rosdep/base.yaml
    5. yaml file:///home/username/rosdistro-master/rosdep/python.yaml
    6. yaml file:///home/username/rosdistro-master/rosdep/ruby.yaml
    7. gbpdistro file:///home/username/rosdistro-master/releases/fuerte.yaml fuerte
    8. # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

    记得替换/etc/ros/rosdep/sources.list.d下的20-default.list文件,如果没有/etc/ros/rosdep/sources.list.d就新建路径。

    修改python中的默认的url的地址,

    /usr/lib/python3/dist-packages/rosdep2/main.py

    1. def command_init(options):
    2. try:
    3. data = download_default_sources_list()
    4. except URLError as e:
    5. print('ERROR: cannot download default sources list from:\n%s\nWebsite may be down.' % (DEFAULT_SOURCES_LIST_URL))
    6. return 4
    7. except DownloadFailure as e:
    8. print('ERROR: cannot download default sources list from:\n%s\nWebsite may be down.' % (DEFAULT_SOURCES_LIST_URL))

    download_default_sources_list函数在/usr/lib/python3/dist-packages/rosdep2 文件夹下面的sources_list.py文件里

    DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdistro/rosdep/sources.list.d/20-default.list'

    修改以下两个文件里面的代码:

    /usr/lib/python3/dist-packages/rosdep2/rep3.py
    /usr/lib/python3/dist-packages/rosdistro/__init__.py

    /usr/lib/python3/dist-packages/rosdep2/rep3.py

    # location of targets file for processing gbpdistro files
    REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'

    # seconds to wait before aborting download of gbpdistro data

    /usr/lib/python3/dist-packages/rosdistro/__init__.py

    # index information

    DEFAULT_INDEX_URL = 'file:///home/xxx/rosdistro/index-v4.yaml'

    def get_index_url():

    然后:

    ~$ sudo rosdep init
    Wrote /etc/ros/rosdep/sources.list.d/20-default.list
    Recommended: please run

        rosdep update

    rosdep update

    ~$ rosdep update
    reading in sources list data from /etc/ros/rosdep/sources.list.d
    Hit file:///home/xxx/rosdistro-master/rosdep/osx-homebrew.yaml
    Hit file:///home/xxx/rosdistro-master/rosdep/base.yaml
    Hit file:///home/xxx/rosdistro-master/rosdep/python.yaml
    Hit file:///home/xxx/rosdistro-master/rosdep/ruby.yaml
    Hit file:///home/xxx/rosdistro-master/releases/fuerte.yaml
    Query rosdistro index file:///home/xxx/rosdistro-master/index-v4.yaml
    Skip end-of-life distro "ardent"
    Skip end-of-life distro "bouncy"
    Skip end-of-life distro "crystal"
    Skip end-of-life distro "dashing"
    Skip end-of-life distro "eloquent"
    Add distro "foxy"
    Add distro "galactic"
    Skip end-of-life distro "groovy"
    Skip end-of-life distro "hydro"
    Skip end-of-life distro "indigo"
    Skip end-of-life distro "jade"
    Skip end-of-life distro "kinetic"
    Skip end-of-life distro "lunar"
    Add distro "melodic"
    Add distro "noetic"
    Add distro "rolling"
    updated cache in /home/xxx/.ros/rosdep/sources.cache

  • 相关阅读:
    挑战来了!如何应对大商家订单多小商家没有订单的数据倾斜问题?
    ByteTrack多目标追踪论文阅读
    项目总结(制作报表)
    软件系统功能测试的依据
    基于神经网络的系统辨识,神经网络的种类和特点
    ceph部署踩坑——OSD服务无法启动
    趣解设计模式之《办理入职这么难吗?》
    【后端学习笔记·Golang】邮箱邮件验证
    Three.js系列: 在元宇宙看电影,享受 VR 视觉盛宴
    【MySQL】基本查询 (一)
  • 原文地址:https://blog.csdn.net/puma004/article/details/118312945