wsl2的ubuntu22.04中安装ros2

1、设置编码

复制代码
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

2、hosts文件中添加域名解析

vim /etc/hosts

199.232.96.133 raw.githubusercontent.com

199.232.96.133 raw.github.com

3、设置软件源

复制代码
sudo apt update && sudo apt install curl gnupg2 lsb-release

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

sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'

4、安装ros2安装包

复制代码
sudo apt update
sudo apt install ros-humble-desktop

注意:

此处以Ubuntu22.04下安装ROS2 Humble为例,如使用Ubuntu 20.04,请将"humble"改为"foxy。

或者安装基础版

复制代码
sudo apt install ros-humble-ros-base
apt-get update

5、然后我们还需要安装编译工具colcon

复制代码
sudo apt install python3-colcon-common-extensions

6、设置环境变量

复制代码
source /opt/ros/humble/setup.bash

7、安装自动补全工具

复制代码
sudo apt install python3-argcomplete

8、验证

跑几个例程测试一下: 先运行一个talker:

source /opt/ros/humble/setup.bash

ros2 run demo_nodes_cpp talker

再运行一个Listener

source /opt/ros/humble/setup.bash

ros2 run demo_nodes_py listener

问题一:

Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决办法:通过修改hosts解决此问题。

查询真实IP:

https://www.ipaddress.com/

查询raw.githubusercontent.com和raw.github.com的真实IP。

修改hosts:

sudo vim /etc/hosts

添加如下内容:

199.232.96.133 raw.githubusercontent.com

199.232.96.133 raw.github.com

更多参考:https://blog.csdn.net/xiaxinkai/article/details/112975134

https://blog.csdn.net/weixin_45367061/article/details/122678266

电脑端环境配置 - OriginBot智能机器人开源套件

相关推荐
-点灯-3 天前
【无标题】
ros2
General_G3 天前
irobot_benchmark的编译和使用
linux·中间件·机器人·ros2
阿豪只会阿巴4 天前
【多喝热水系列】从零开始的ROS2之旅——Day10 话题的订阅与发布1:Python
开发语言·c++·python·ubuntu·ros2
阿豪只会阿巴5 天前
【多喝热水系列】从零开始的ROS2之旅——Day9 初识话题通信:基本命令
c++·笔记·python·ubuntu·ros2
阿豪只会阿巴5 天前
项目心得——发布者和订阅者问题解决思路
linux·开发语言·笔记·python·ubuntu·ros2
Tipriest_7 天前
ROS 2 rosbag2 播放出现 “Message queue starved. Messages will be delayed.” 的处理步骤
消息队列·ros2·缓存机制
Will_Ye9 天前
ROS2 Humble 配置 Orbbec Gemini2L相机 和 Mid360
ros2·mid360·orbbec gemini2l
boss-dog10 天前
realsense_camera ros2 输出点云平面不完整问题
ros2·realsense
无人装备硬件开发爱好者12 天前
ROS2:无人机从 “能飞” 到 “会思考” 的全栈技术引擎 —— 深度拆解与落地指南(上)
无人机·ros2·无人机飞控
MIXLLRED13 天前
Ubuntu 22.04/ROS2 Humble下使用Intel RealSense D435i相机
ubuntu·d435i·ros2·深度相机