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

相关推荐
济6172 天前
ROS开发专栏---基于激光雷达的自动避障---适配Ubuntu 22.04
嵌入式·ros2·机器人开发·机器人方向
济6172 天前
ROS开发专栏---基于 SLAM Toolbox 实现仿真环境 SLAM 建图--适配Ubuntu 22.04
嵌入式·ros2·机器人开发·机器人方向
BestOrNothing_20153 天前
ROS2 xacro 保姆级使用教程!零基础从入门到精通
机器人·ros2·macro·xacro·prefix·引用变量·调用宏
kyle~5 天前
ROS2 --- RMW(ROS Middleware Interface)
linux·c++·机器人·ros2
济6175 天前
ROS开发专栏---IMU 数据读取实验实现---适配Ubuntu 22.04
ubuntu·ros2·机器人开发
济6175 天前
ROS开发专栏---基于 IMU 实现机器人航向锁定实验---适配Ubuntu 22.04
嵌入式·ros2·机器人开发
kyle~6 天前
ROS2---rosbag2记录和回放话题、服务和动作数据
linux·机器人·数据采集·ros2
济6177 天前
ROS开发专栏---激光雷达数据获取仿真实验+ RViz2使用教程--适配Ubuntu 22.04
嵌入式硬件·嵌入式·ros2·机器人方向
学机械的鱼鱼7 天前
PX4与ROS2通信原理与仿真环境搭建教程
笔记·学习·px4·ros2
kyle~7 天前
机器人时间链路---工程流程示例
c++·3d·机器人·ros2