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智能机器人开源套件

相关推荐
Hi202402178 天前
基于ROS2进行相机标定,并通过测试相机到棋盘格之间的距离进行验证
数码相机·docker·ros·相机·机器视觉·ros2·单目测距
Zhichao_9717 天前
【ROS2 自动驾驶学习】03-ROS2常用命令
ros2
Zhichao_9721 天前
【ROS2 自动驾驶学习】02-安装ROS2及其配套工具
自动驾驶·ros2
Mr.Winter`21 天前
轨迹优化 | 基于激光雷达的欧氏距离场ESDF地图构建(附ROS C++仿真)
c++·人工智能·机器人·自动驾驶·ros·ros2·具身智能
超喜欢下雨天23 天前
服务器安装 ros2时遇到底层库依赖冲突的问题
linux·运维·服务器·ros2
曹勖之1 个月前
simuilink和ROS2数据联通,Run后一直卡在Initializting
windows·matlab·simulink·ros2
YueiL1 个月前
ROS 2 中 Astra Pro 相机与 YOLOv5 检测功能编译启动全记录
yolo·ros2
PleaseBrave1 个月前
记录:安装VMware、Ubuntu、ROS2
linux·ubuntu·vmware·ros2
曹勖之1 个月前
ROS2中,在工作空间根目录下执行source ./install/setup.bash的作用?
ros2
听风吹雨yu1 个月前
JY901-ROS2驱动代码
slam·ros2·humble·rviz·imu·foxy