ubuntu安装ROS

news/2024/10/17 15:21:47/

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

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,再来一遍

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

最后是日本的可以:

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'
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.

raw.githubusercontent.com其实可以ping通,不过没什么用。
这个问题很大,网上的方法很多。简单点的:
sudo nano /etc/hosts
在文件末尾添加199.232.68.133 raw.githubusercontent.com(也有人在 /etc/hosts文件的末尾添加
199.232.68.133 raw.githubusercontent.com)
保存退出。我的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]:
    <urlopen error [Errno 104] Connection reset by peer> (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地址全部修改为指向本地文件的地址:

# os-specific listings first
yaml file:///home/username/rosdistro-master/rosdep/osx-homebrew.yaml osx# generic
yaml file:///home/username/rosdistro-master/rosdep/base.yaml
yaml file:///home/username/rosdistro-master/rosdep/python.yaml
yaml file:///home/username/rosdistro-master/rosdep/ruby.yaml
gbpdistro file:///home/username/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

记得替换/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

def command_init(options):try:data = download_default_sources_list()except URLError as e:print('ERROR: cannot download default sources list from:\n%s\nWebsite may be down.' % (DEFAULT_SOURCES_LIST_URL))return 4except DownloadFailure as e: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


http://www.ppmy.cn/news/1132073.html

相关文章

北京互联网公司、外企、国企大盘点

今天来盘点北京的泛互联网公司。涵盖了综合类、外企类、硬件类、电商类、游戏类、娱乐类、生活类、工具类、人工智能类、金融类、教育类、招聘类、汽车类、外包类、信息化类以及国企央企类等多个领域。 综合类 字节跳动 美团 百度 阿里巴巴 腾讯 网易 外企类 微软 谷歌 亚马逊…

wsl2 更新报错问题解决记录

1、问题 win10 中安装的 wsl2&#xff0c;启动 docker desktop 时提示 wsl2 有问题&#xff1a; 于是点击推荐的地址连接到微软&#xff0c;下载 wsl2 的更新文件。之后运行&#xff0c;又报错&#xff1a; 更新被卡住。 2、解决方法 WinR 输入 cmd 打开命令行窗口&#x…

【Linux】 OpenSSH_7.4p1 升级到 OpenSSH_9.3p2(亲测无问题,建议收藏)

&#x1f468;‍&#x1f393;博主简介 &#x1f3c5;云计算领域优质创作者   &#x1f3c5;华为云开发者社区专家博主   &#x1f3c5;阿里云开发者社区专家博主 &#x1f48a;交流社区&#xff1a;运维交流社区 欢迎大家的加入&#xff01; &#x1f40b; 希望大家多多支…

【HTTP 常用的状态码及使用场景】

HTTP 常用的状态码及使用场景 HTTP常用的状态码有&#xff1a;HTTP状态码的使用场景&#xff1a; HTTP常用的状态码有&#xff1a; 1xx&#xff1a;信息提示 100&#xff1a;继续101&#xff1a;切换协议 2xx&#xff1a;成功 200&#xff1a;成功201&#xff1a;已创建202…

当面试被问到jvm(Java虚拟机)时,如何将面试官引入自己的节奏?

本文目录 前言快问快答抛砖引玉锦上添花好书推荐总结 前言 作为一名Java开发工程师&#xff0c;不管是校招还是社招jvm一定是必问必会的知识点。虽然说真正开发中用到的不多&#xff0c;甚至可以说用不到&#xff08;对于刚入行或者Java初级&#xff09;&#xff0c;但是当面试…

步进电机只响不转

我出现问题的原因是相位线接错。 我使用的滑台上示17H的步进电机&#xff0c;之前用的是57的步进电机。 57步进电机的相位线是A黑、A-绿、B红、B-蓝。 17步进电机的相位线是A红、A-绿、B黑、B-蓝。 这两天被一个问题困扰了好久&#xff0c;在调试步进电机开发板的时候电机发生…

Socket网络编程练习题五:客户端多用户上传文件(多线程版)并使用线程池管理线程

题目 想要服务器不停止&#xff0c;能接收很多客户上传的图片&#xff1f;我们知道是使用循环加多线程的方案来解决&#xff0c;但是如果频繁的创建和销毁线程&#xff0c;是非常浪费系统资源的&#xff0c;那应该怎么办呢&#xff1f; 解决方案 采用线程池&#xff0c;来管…

【C语言深入理解指针(1)】

1.内存和地址 1.1内存 在讲内存和地址之前&#xff0c;我们想有个⽣活中的案例&#xff1a; 假设有⼀栋宿舍楼&#xff0c;把你放在楼⾥&#xff0c;楼上有100个房间&#xff0c;但是房间没有编号&#xff0c;你的⼀个朋友来找你玩&#xff0c;如果想找到你&#xff0c;就得挨…