【教程】使用Windows子系统WSL安装ROS2运行小海龟
-
以下是使用Windows子系统WSL安装ROS2并运行小海龟的详细教程:
第一步:安装WSL(根据官方教程Maybe可以跳过)
官方教程:https://learn.microsoft.com/zh-cn/windows/wsl/install
1. 启用WSL功能
- 打开“控制面板”,选择“程序”>“程序和功能”>“启用或关闭Windows功能”,勾选“适用于Linux的Windows子系统”和“虚拟机平台”,然后点击“确定”并重启计算机。
- 或者在PowerShell中运行以下命令:
然后重启计算机。dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
2.安装Ubuntu22.04
命令行安装
打开PowerShell,运行以下命令:
wsl --install wsl --set-default-version 2 wsl --install -d Ubuntu-22.04
应用商店安装
在Microsoft Store中搜索并安装Ubuntu22.04。
第二步:安装ROS2
直接一键安装
wget http://fishros.com/install -O fishros && bash fishros
第三步:运行小海龟
- 启动小海龟节点
- 在一个终端中运行以下命令启动小海龟节点:
这时会弹出一个小海龟的图形界面。ros2 run turtlesim turtlesim_node
- 在一个终端中运行以下命令启动小海龟节点:
- 启动键盘控制
- 在另一个终端中运行以下命令启动键盘控制节点:
使用键盘的上下左右键可以控制小海龟的移动。ros2 run turtlesim turtle_teleop_key
- 在另一个终端中运行以下命令启动键盘控制节点:
若无法可视化可以安装xserver:https://blog.csdn.net/qq_51908382/article/details/140607102
-
@小鱼 为什么我的小乌龟不能控制运动啊,如图
-
@李万宝 我也是这个问题诶
-
@李万宝 缺少一些环境如rosdep init
可参看教程https://blog.csdn.net/qq_64671439/article/details/135287166?fromshare=blogdetail&sharetype=blogdetail&sharerId=135287166&sharerefer=PC&sharesource=m0_73665762&sharefrom=from_link -
@李万宝 我也是这样,ros2 run turtlesim turtlesim_node 可以正常显示。ros2 run turtlesim turtle_teleop_key 这个就卡住了。大佬怎样解决了啊
-
@jhjhgyu666 大佬,你给的是ros的,现在遇到问题的是ros2
-
请问一下这个小海龟的界面无法生成是什么原因a
前面好像有问题 -
@mahong1237 我也是这个问题,但是我再开启一个终端运行rqt,刷新node graph,小海龟就可以操作了
-
求大佬解读一下,为什么我的没有humble版本
-
@nefert 更换操作系统 ubuntu22
-
@小鱼 !博主,我使用的就是这个版本,应该没啥问题吧
-
此回复已被删除! -
@nefert 这是20
-
@小鱼 我嘞个豆,不好意思,安装的时候以为是22,截屏时也没注意,我一直以为安装的是22.04,不好意思
-
@小鱼 只能用fox了,学到第三章感觉也没啥问题,谢谢大佬
-
无法将磁盘“C:\Users\qwert\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx”附加到 WSL2: 系统找不到指定的文件。
错误代码: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_FILE_NOT_FOUND -
@小鱼 在 【教程】使用Windows子系统WSL安装ROS2运行小海龟 中说:
wget http://fishros.com/install -O fishros && bash fishros
@小鱼 在 【教程】使用Windows子系统WSL安装ROS2运行小海龟 中说:
wget http://fishros.com/install -O fishros && bash fishros
-
如果想要卸载怎么办呀?
-
@Zengs 在 【教程】使用Windows子系统WSL安装ROS2运行小海龟 中说:
@mahong1237 我也是这个问题,但是我再开启一个终端运行rqt,刷新node graph,小海龟就可以操作了
情况+1,大家有找到解决方案嘛
情况说明
使用wsl-22.04运行海龟程序,键盘控制无法生效
开启一个终端运行rqt,刷新node graph,可以使用关闭以后无法使用
ros2 node list等指令无法使用 -
根据您的系统,为您推荐安装源为['http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/']
创建文件:/etc/apt/sources.list.d/ros-fish.list
Run CMD Task:[sudo apt update]
[-][2.20s] CMD Result:code:100 >apt更新失败,后续程序可能会继续尝试...,[]
Run CMD Task:[sudo apt search ros-base ]
[-][1.17s] CMD Result:success换源后更新失败,第二次开始切换源,尝试更换ROS2源为华为源!
根据您的系统,为您推荐安装源为['https://repo.huaweicloud.com/ros2/ubuntu/']
Run CMD Task:[sudo rm -rf /etc/apt/sources.list.d/ros-fish.list]
[-][0.00s] CMD Result:success创建文件:/etc/apt/sources.list.d/ros-fish.list
Run CMD Task:[sudo apt update]
[-][2.42s] CMD Result:code:100 >apt更新失败,后续程序可能会继续尝试...,[]
Run CMD Task:[sudo apt search ros-base ]
[-][1.16s] CMD Result:success换源后更新失败,第三次开始切换源,尝试使用https-ROS官方源~!
根据您的系统,为您推荐安装源为['https://packages.ros.org/ros2/ubuntu/']
Run CMD Task:[sudo rm -rf /etc/apt/sources.list.d/ros-fish.list]
[-][0.00s] CMD Result:success创建文件:/etc/apt/sources.list.d/ros-fish.list
Run CMD Task:[sudo apt update]
[/][10.25s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.25s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.25s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.35s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.45s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.55s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.65s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.75s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.85s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][10.95s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][11.05s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][11.15s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][11.25s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[][11.35s] Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not matc[-][11.80s] CMD Result:successRun CMD Task:[sudo apt search ros-base ]
[-][1.06s] CMD Result:success换源后更新失败,第四次开始切换源,尝试更换ROS源为http-ROS官方源!
根据您的系统,为您推荐安装源为['http://packages.ros.org/ros2/ubuntu/']
Run CMD Task:[sudo rm -rf /etc/apt/sources.list.d/ros-fish.list]
[-][0.00s] CMD Result:success创建文件:/etc/apt/sources.list.d/ros-fish.list
Run CMD Task:[sudo apt update]
[-][3.08s] CMD Result:code:100 >apt更新失败,后续程序可能会继续尝试...,[]
Run CMD Task:[sudo apt search ros-base ]
[-][1.06s] CMD Result:successRun CMD Task:[sudo apt update]
[-][2.71s] CMD Result:code:100 >apt更新失败,后续程序可能会继续尝试...,[]
四次换源后都失败了,请及时联系小鱼获取解决方案并处理!
Run CMD Task:[sudo apt search ros-base ]
[-][1.13s] CMD Result:success欢迎加入机器人学习交流QQ群:438144612(入群口令:一键安装)
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或打开链接查看:https://item.taobao.com/item.htm?id=696573635888
如在使用过程中遇到问题,请打开:https://fishros.org.cn/forum 进行反馈小鱼哥,四次换源都失败了啊 换了网络还是不行 找不出原因了