当前位置:网站首页>ROS2专题【01】:win10上安装ROS2
ROS2专题【01】:win10上安装ROS2
2022-07-05 20:10:00 【无水先生】
一、提要:
假如我们终于设置好了计算机,建立了网络连接,我们可以开始安装 ROS 了!这实际上并不难,虽然官方文档非常详细,但初学者应该从哪里开始?尤其是,该不该用ROS2?这篇文章主要是为了给你指出方向和正确的安装方法。
ROS2迟早要取代ROS1,因此,提前接触ROS2是明知选择。一般来说,windows比Ubuntu要方便开发,因此,这里推荐ROS2+Win10的系统配置。
二、必要的工具和准备
2.1 系统要求
- ROS-for-Windows需要64位Windows 10桌面或Windows 10物联网企业版。
- 请确保已在系统路径中安装Powershell。
- 从实时病毒扫描程序中排除c:\opt(以及稍后的工作区文件夹),因为它们可能会干扰安装和开发。
2.1 powershell介绍
powershell是一个交互终端,其命令和linux下差不多,ls,ssh,ping,scp等等都是支持的。可以使用win+R,输入powershell打开,也可以通过左下方搜索powershell打开。
三、安装Visual Studio 2019
(安装VC2019帖子很多,在网上找找吧)
- Vcpkg is used for managing dependent libraries. It requires that the English language pack be installed.
- Include "Desktop development with C++" workload.
- In the Individual Components, select "Windows 10 SDK (10.0.19041.0)".
注意:安装完VC2019后,有一个VC版本的命令行工具很重要,如图:
凡进行64位的软件操作,都需要打开此命令行进行。
四、 “巧克力”-Chocolatey安装
4.1 Chocolatey是啥?
在Ubuntu下有下载更新工具apt-get,Chocolatey就理解成win10版的apt-get就成了。
4.2 安装一个chocolatey
- 在开始菜单中,找到“VS 2019的x64本机工具命令提示符”项。
- 右键单击,选择“更多”,然后选择“以管理员身份运行”
- 复制以下命令行:
使用管理员权限打开powershell,记得一定要管理员权限
复制粘贴大法到powershell,安装好choco
@"%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"
- 将其粘贴到命令窗口中。
- 批准任何提示
- 完成后,关闭命令提示符以完成
安装完成后在powershell中输入choco会是这个样子的
五、安装ROS2
5.1 管理员身份进入powershell安装
然后将下列四行拷贝到终端:
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
等待半小时......安装完成.
5.2 更新ROS2到新版本
choco upgrade ros-foxy-desktop -y --execution-timeout=0
中间会自动下载安装好ros2,也是挺方便的
搞定后,下面开始跑小乌龟~
六、跑跑小乌龟
这个时候需要打开cmd了,Win+R,cmd,输入下面的两行指令
call C:\opt\ros\foxy\x64\local_setup.bat
ros2 run turtlesim turtlesim_node
你应该可以看到下面的打印,同时有一个乌龟模拟器跳出来【时间较长,大约10秒】
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community>ros2 run turtlesim turtlesim_node &
[INFO] [1631619840.995104400] [turtlesim]: Starting turtlesim with node name /turtlesim
[INFO] [1631619840.999301900] [turtlesim]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]
接着我们如法炮制,启动键盘控制节点
再启动一个窗口~
call C:\opt\ros\foxy\x64\local_setup.bat
ros2 run turtlesim turtle_teleop_key
参考文章:
边栏推荐
- js实现禁止网页缩放(Ctrl+鼠标、+、-缩放有效亲测)
- Let's talk about threadlocalinsecurerandom
- Debezium series: modify the source code to support drop foreign key if exists FK
- openh264解码数据流向分析
- 【c语言】快速排序的三种实现以及优化细节
- 函数的概念及语法
- - Oui. Net Distributed Transaction and Landing Solution
- 14. Users, groups, and permissions (14)
- Autumn byte interviewer asked you any questions? In fact, you have stepped on thunder
- 深度學習 卷積神經網絡(CNN)基礎
猜你喜欢
【数字IC验证快速入门】7、验证岗位中必备的数字电路基础知识(含常见面试题)
Jvmrandom cannot set seeds | problem tracing | source code tracing
Unity编辑器扩展 UI控件篇
Based on vs2017 and cmake GUI configuration, zxing and opencv are used in win10 x64 environment, and simple detection of data matrix code is realized
leetcode刷题:二叉树15(找树左下角的值)
Redis cluster simulated message queue
After 95, Alibaba P7 published the payroll: it's really fragrant to make up this
实操演示:产研团队如何高效构建需求工作流?
Win10 x64环境下基于VS2017和cmake-gui配置使用zxing以及opencv,并实现data metrix码的简单检测
Base du réseau neuronal de convolution d'apprentissage profond (CNN)
随机推荐
ffplay文档[通俗易懂]
- Oui. Net Distributed Transaction and Landing Solution
Let's talk about threadlocalinsecurerandom
Some problems encountered in cocos2d-x project summary
How to select the Block Editor? Impression notes verse, notation, flowus
[C language] string function and Simulation Implementation strlen & strcpy & strcat & StrCmp
Tasks in GStreamer
浅浅的谈一下ThreadLocalInsecureRandom
Base du réseau neuronal de convolution d'apprentissage profond (CNN)
Build your own website (16)
【数字IC验证快速入门】6、Questasim 快速上手使用(以全加器设计与验证为例)
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
点云文件的.dat文件读取保存
函数的概念及语法
Is it safe for Anxin securities to open an account online?
Debezium series: record the messages parsed by debezium and the solutions after the MariaDB database deletes multiple temporary tables
2023年深圳市绿色低碳产业扶持计划申报指南
Wildcard selector
. Net distributed transaction and landing solution
c——顺序结构