系列文章目录
文章目录
前言
系统:Win10+ VS2022 Community
一、VS2022配置
English language pack.
Vcpkg, is used for managing dependent libraries.
Desktop development with C++.
Windows 10 SDK (10.0.19041.0)
二、安装windows 包管理器
1.Install Chocolatey
Chocolatey is a package manager for Windows. It is used to make it easy to install tools and libraries needed for building and running ROS projects.
以管理员身份运行developer powershell,在命令行输入:
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
上述指令将Chocolatey所在的安装目录设置为全局路径(C:\ProgramData\chocolatey\bin)
2.Install Git
choco upgrade git -y
测试:
git --version
三、ROS Package Installation
1. ROS LKG Build Installation
Install the desktop_full metapackage. Metapackage is a collection of other packages.
以管理员身份运行developer powershell,在命令行输入:
mkdir c:\opt\chocolatey
set ChocolateyInstall=c:\opt\chocolatey
choco source add -n=ros-win -s="https://aka.ms/ros/public" --priority=1
choco upgrade ros-noetic-desktop_full -y --execution-timeout=0
2. ROS 2 Build Installation
以管理员身份运行developer powershell,在命令行输入:
mkdir c:\opt\chocolatey
set ChocolateyInstall=c:\opt\chocolatey
choco source add -n=ros-win -s="https://aka.ms/ros/public" --priority=1
choco upgrade ros-foxy-desktop -y --execution-timeout=0
参数 –execution-timeout=0 用于提高网络传输延时的容错能力。
四、创建ROS桌面快捷启动图标
In order to use ROS on Windows, the ROS setup script needs to be called in each command Window. In order to not forget in the future, it is helpful to have a ROS shortcut which does this automatically.
桌面单击右键,新建-快捷方式。
在属性的目标编辑框中,根据VS版本和安装路径输入:
C:\Windows\System32\cmd.exe /k "C:\Program Files \Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64&& set ChocolateyInstall=c:\opt\chocolatey&& c:\opt\ros\noetic\x64\setup.bat
在其高级属性中,设置为管理员模式运行。
此后,需要运行命令行ROS节点和服务器时,直接点击ROS快捷方式图标就行了。
五、ROS运行测试
点击桌面ROS快捷方式,在命令行输入:
roscore
另外再开启一个命令行终端窗口,命令行输入:
rosrun turtlesim turtlesim_node
再开启一个命令行终端窗口,命令行输入:
rosrun turtlesim turtle_teleop_key.exe