代码先锋网 代码片段及技术文章聚合

Ubuntu22.04使用清华镜像本地安装ros2 humble

技术标签: ros2  ubuntu  linux

1 设置Ubuntu镜像源为清华镜像源

1.1 备份source.list文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

1.2 更改文件权限

sudo chmod 777 /etc/apt/sources.list

1.3 使用vim编辑器打开 并删除原内容

sudo vim /etc/apt/sources.list
gg d G  # 删除首行到尾行内容快捷键

1.4 访问清华镜像源并按照页面提示拷贝源代码至source.list

2 设置ros2获取链接

2.1 添加ros2的资源库**

sudo apt install curl gnupg2
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 port443:Connection refused 

表面你的访问被墙了或者DNS域名解析被污染
解决:
1 访问域名解析工具网页 输入raw.githubusercontent查看对应的IPv4地址
2 新开一个终端,进入到/etc/hosts目录下,输入sudo vim /etc/hosts打开,进入insert模式,插入以下内容:

185.199.110.133 raw.githubusercontent.com 
185.199.110.133 user-images.githubusercontent.com 
185.199.110.133 avatars2.githubusercontent.com 
185.199.110.133 avatars1.githubusercontent.com

保存退出后重试即可解决 若不行 尝试其余三个IP地址

2.2 将镜像链接加载进本地source.list目录

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt upgrade

2.3 执行安装

sudo apt install ros-humble-desktop

2.4 测试

source /opt/ros/humble/setup.bash
ros2 run turtlesim turtlesim_node

出现小海龟图片即成功 以后每次进入ros环境均要source一下setup.bash

版权声明:本文为qq_44384856原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_44384856/article/details/127207509

智能推荐

Humble Numbers

题意:因子只由2,3,5,7组成的数字为Humble Numbers,问你第n个Humble Numbers是几。 链接:HDU 1058传送门 想法:Humble Numbers都可以写成2的几次方*3的几次方*5的几次方*7的几次方,可以用dp也可以直接打表来模拟,我用的是直接打表,也很快且容易理解 代码:  ...

Humble Numbers

题目:Humble Numbers 题解:这是一个简单dp,就是输出比较麻烦。题目要求的数字是只能整除2、3、5、7的,所以可以对于第i个数,可以从1~i-1依次遍历,每个数都可以乘上2、3、5、7,寻找比第i个数大的最小的。...

Humble Numbers

Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … shows the f...

humble nunber

Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … shows the f...

Humble Numbers

Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … shows the f...

猜你喜欢

Humble Numbers

题意 A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers...

Humble Numbers

M - Humble Numbers Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description A number whose...

humble numbers

Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first ...

Humble Numbers

Humble Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 25735    Accepted Submission(s): 11344 P...