一、使用coco原生安装ROS2
1.以管理员身份启动Windows PowerShell,执行以下命令:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
2.输入coco输出如下:
Chocolatey v0.10.15
Please run 'choco -?' or 'choco <command> -?' for help menu.
3.安装设置:
mkdir c:\opt\chocolatey
set PYTHONNOUSERSITE=1
set ChocolateyInstall=c:\opt\chocolatey
choco source add -n=ros-win -s="https://aka.ms/ros/public" --priority=1
4.执行安装命令,就可以自动下载安装ROS2了:
choco upgrade ros-foxy-desktop -y --execution-timeout=0
二、跑跑小乌龟
1.打cmd执行turtesim_node:
call C:\opt\ros\foxy\x64\local_setup.bat
ros2 run turtlesim turtlesim_node
弹出模拟小乌龟模拟界面:
2.打开cmd执行turtle_teleop_key:
call C:\opt\ros\foxy\x64\local_setup.bat
ros2 run turtlesim turtle_teleop_key
显示操控界面:
通过上下(前后移动)左右(旋转方向)箭头就可以操控小乌龟了。
注意:焦点要保持在操控的cmd窗口上(该窗口接收来自键盘按键的输入)
原文链接:https://zhuanlan.zhihu.com/p/411118025