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

相关推荐
别催小唐敲代码6 小时前
ROS2从入门到实战:去中心化机器人操作系统详解
wpf·ros2
酸梅果茶2 天前
ROS2 foxy环境下源码安装Navigation2
ros2·navigation·agx
某林2125 天前
ros从底层硬件到 Web 端部署
python·机器人·硬件架构·ros2
zh路西法5 天前
【Navigation2进阶】(十二):自主探索性能优化与 RIG 算法推导与 Nav2 插件实现
c++·dijkstra·ros2·rrt·navigation2·前沿探索
视图猿人6 天前
Astra Pro相机+gazebo构建 ROS2 虚实联动数字孪生系统
ros2
zh路西法7 天前
【10天速通ROS2-PX4无人机】(四) 关掉GPS和气压计,纯激光定位还能飞吗
c++·无人机·px4·ros2·卡尔曼滤波·fastlio2
视图猿人8 天前
ROS2 AGV SLAM导航仿真系统技术详解与踩坑实录
机器人·ros2
zh路西法9 天前
【10天速通ROS2-PX4无人机】(一) 从零搭建仿真环境,妈妈再也不用担心我炸机了!
无人机·仿真·px4·ros2·gazebo
某林21211 天前
ROS2 + WebRTC + MQTT 异构系统架构
架构·系统架构·机器人·硬件架构·webrtc·ros2
Zeku13 天前
10.ROS2-URDF机器人建模-从概念到开发与调试全记录
机器人·ros2·linux驱动开发·linux应用开发