Ubuntu 20.04安装ROS2

本文档详细记录了在Ubuntu20.04上安装ROS2过程中遇到的网络连接、源更新超时以及RTIConnext环境配置等问题,并提供了相应的解决方案,包括修改hosts文件、添加https://ghproxy.com/前缀到源列表以及安装RTIConnext和设置NDDSHOME环境变量。
摘要由CSDN通过智能技术生成

Ubuntu 20.04安装ROS2


参考ROS2官方安装文档,安装ROS2。安装过程中会遇到如下问题

报错 1

运行

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

时报错:

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
  • 解决方案:
    1. 使用工具,找到raw.githubusercontent.com对应的ip地址185.199.110.133

    2. sudo vim /etc/hosts,在最后添加 185.199.110.133 raw.githubusercontent.com
      127.0.0.1 localhost
      127.0.1.1 dc-virtual-machine

      # The following lines are desirable for IPv6 capable hosts
      ::1     ip6-localhost ip6-loopback
      fe00::0 ip6-localnet
      ff00::0 ip6-mcastprefix
      ff02::1 ip6-allnodes
      ff02::2 ip6-allrouters
      185.199.110.133 raw.githubusercontent.com
      
    3. 重新执行
      sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

    4. 如果还是不行,打开手机热点,pc连接手机热点之后重新执行。

报错 2

运行

rosdep update

时报错:

reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: error loading sources list:
	The read operation timed out
  • 解决方案
    1. sudo vim /etc/ros/rosdep/sources.list.d/20-default.list修改文件,添加https://ghproxy.com/前缀
      # os-specific listings first
      yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

      # generic
      yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
      yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
      yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
      gbpdistro https://ghproxy.com/https://raw.githubusercontent.com/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
      
    2. 重新执行
      rosdep update

    3. 如果还是不行,打开手机热点,pc连接手机热点之后重新执行。

    4. 也可以运行以下脚本,直到rosdep update运行成功。
      #!/bin/bash

      for (( ;; ))
      do
         rosdep update
         if(($? == 0))
         then
            exit
         fi
      done
      

报错 3

运行

. ~/ros2_galactic/ros2-linux/setup.bash

时报错:

[connext_cmake_module] Warning: The location at which Connext was found when the workspace was built [[/opt/rti.com/rti_connext_dds-5.3.1]] does not point to a valid directory, and the NDDSHOME environment variable has not been set. Support for Connext will not be available.
  • 解决方案:
    1. 安装RTI Connext
      sudo apt install -q -y rti-connext-dds-5.3.1
    2. 导入设置文件设置 NDDSHOME 环境变量
      cd /opt/rti.com/rti_connext_dds-5.3.1/resource/scripts && source ./rtisetenv_x64Linux3gcc5.4.0.bash; cd -
    3. 重新执行
      . ~/ros2_galactic/ros2-linux/setup.bash
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值