当前位置: 首页 > news >正文

Windows 10上安装ROS noetic平台

根据ROS官网的指南, 安装ROS noetic的过程我摘录在下面,注意:和官网不一样的地方我用中文特别说明了一下。

ROS on Windows installation

Windows Operating System

  • ROS for Windows requires 64-bit Windows 10 Desktop or Windows 10 IoT Enterprise.
  • Please ensure that you have Powershell installed and in the system path.
  • Exclude c:\opt (and later your workspace folder) from real-time virus Scanners, as they can interfere with install and development.

说明:推荐安装时关闭病毒扫描软件等。

Reserve space for the installation

  • Clean and back up any existing data under c:\opt before proceeding.

  • c:\opt is the required install location. Relocation is not currently enabled.

  • Please ensure you have 10 GB of free space on the C:\ drive for the installation and development.

说明:c:\opt被选定为特定文件夹,请保证至少10G的可用空间。

Install Visual Studio 2019

Building a ROS project for Windows requires Visual Studio 2019 and the Microsoft Windows 10 SDK.

  • Download Visual Studio 2019

    • Visual Studio 2019 is required to maintain toolchain compatibility with published binaries.
    • 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)".

说明:安装VS2019,如果是个人的话一般都是community。

Install Windows Package Manager

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. The following instructions redirect the chocolatey install location into the c:\opt, so that you can clean or move a ROS environment from that one location.

  • In the Start Menu, find the "x64 Native Tools Command Prompt for VS 2019" item.
  • Right Click, select More then "Run as Administrator"
  • Copy the following command line:
    • @"%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"
    • Paste it into the command window.
    • Approve any prompts
    • Once it has completed, close the command prompt to complete the install.
  • Install Git:
    • Reopen the Visual Studio Command Window as described above.
    • Please install Git using the command here, even if you have it installed as an application.
      choco upgrade git -y
    • After Git installed, ensure Git is now available in the Visual Studio command window.
      git --version
    • Close and Reopen the Visual Studio Command Window as described above.

说明:安装时需要打开控制台窗口,请注意“以管理员身份运行”。

Binary Package Installation

To set up ROS for Windows follow these recommended steps:

ROS Last Known Good (LKG) Build Installation

To get things started, install the recommended desktop_full metapackage. A Metapackage is a collection of other packages. The Desktop-Full metapackage refers to a number of other packages needed to build, run, debug and visualize a robot.

Open the Visual Studio Command Prompt as Administrator as described above.

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

说明:安装工具chocolatey + 添加源 + 安装ROS noetic,安装完成后你可以找到这个文件夹“C:\opt\ros\noetic\x64”。

ROS 2 Build Installation

To get started with ROS 2, one can also follow the similar steps to install ROS 2 from the same Chocolatey feed.

For example, if you want to install ROS2 Foxy build, open the ROS Command Prompt created above and approve the administrative elevation if not already opened.

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

Create a ROS Command Window shortcut

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.

  • Create an Administrative command line shortcut for Visual Studio:
  • Right click in a Windows Explorer folder, select New > Shortcut

  • In the shortcut path, copy the highlighted command line from the following options, depending on the Visual Studio install above:
    • If you are using Community:
      C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64&& set ChocolateyInstall=c:\opt\chocolatey&& c:\opt\ros\noetic\x64\setup.bat
    • If you are using Professional:
      C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64&& set ChocolateyInstall=c:\opt\chocolatey&& c:\opt\ros\noetic\x64\setup.bat
    • If you are using Enterprise:
      C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64&& set ChocolateyInstall=c:\opt\chocolatey&& c:\opt\ros\noetic\x64\setup.bat
    • Name the shortcut "ROS"
    • Set that shortcut as Administrator
      • Right Click on the shortcut and choose "Properties".
      • Select the Shortcut Tab if not already selected.
      • Press the Advanced button
      • Check the button "Run as Administrator".
      • Press OK on the Advanced properties dialog.
      • Press OK on the "ROS Properties" shortcut dialog.

说明:这里是指创建控制台快捷方式,例如你可以直接创建一个快捷方式(放在任意位置均可),然后填写前面提到的快捷内容即可,例如我的是,

C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64&& set ChocolateyInstall=c:\opt\chocolatey&& c:\opt\ros\noetic\x64\setup.bat

Using the new Windows Terminal

Microsoft released a new open source terminal for Windows, which includes many improvements over the built in command line, including tabs and appearance customization. You can install it from the Microsoft Store.

To set up the terminal for ROS:

  • Find the Windows Terminal from the start menu, right click and select 'Run as Administrator'
  • Select settings from the drop down arrow next to the Add Tab (+) Button.
  • In the list array in the "profiles" object, add a new block for ROS.
    "profiles" :
    {
        list: 
        [
            ...
            {
                "commandline" : "C:\\Windows\\System32\\cmd.exe /k \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\Tools\\VsDevCmd.bat\" -arch=amd64 -host_arch=amd64 && set ChocolateyInstall=c:\\opt\\chocolatey&& c:\\opt\\ros\\noetic\\x64\\setup.bat",
                "guid" : "{xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx}",
                "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
                "name" : "ROS Noetic",
                "startingDirectory" : "c:\\ws"
        },
  • from a Visual Studio command window, use the command uuidgen to generate a globally unique identifier (aka universally unique identifier).

  • copy the guid (select the text, then right click to copy)
  • Replace xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx with the text copied above.
  • (Optionally) Set this guid as the "defaultProfile"

        "alwaysShowTabs" : true,
        "copyOnSelect" : false,
        "defaultProfile" : "{xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx}",
        ....

When launching the new Windows terminal, please remember to Run as Administrator, by right clicking on the Windows Terminal and Select *Run as Administrator*. There is a Always Run Terminal elevated feature request that needs to be implemented before this requirement is lifted.

Alternatively, Ctrl+Shift+clicking on the terminal icon in either the start menu or task bar is a handy shortcut to run as administrator.

说明:这一段其实不是必须的, 如果你习惯使用前面的控制台窗口,那这步就没有必要了。

因为我不使用windows store,所以就到github的仓库里去找,根据上面的说法,可以使用chocolatey安装,前面我们已经安装了choco,所以很简单,安装 只需要一句指令就可以了,

choco install microsoft-windows-terminal

如果你要使用ms的最新terminal,那就根据这个提示安装,中文版的windows是先以管理员身份打开“windows terminal",然后打开标题栏最右侧那个向下的箭头(下拉菜单)--> 设置 --> 左侧"添加新配置文件",输入名称"ROS Noetic", 其他的照上面填写;

特别说明:

uuidgen貌似没地方可以写,可能版本变了取消了;

command line多了两个反斜杠,正确的是这样的,

C:\\Windows\\System32\\cmd.exe /k "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\Tools\\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 && set ChocolateyInstall=c:\\opt\\chocolatey&& c:\\opt\\ros\\noetic\\x64\\setup.bat

效果如下图所示,不要忘记右下角最后要保存配置。

Stay Up to Date

If you want to update your ROS install, use Chocolatey's upgrade feature.

Open the ROS Command Prompt created above and approve the administrative elevation if not already opened.

Run the following command:

set ChocolateyInstall=c:\opt\chocolatey
choco upgrade all -y --execution-timeout=0

It is recommended to add --execution-timeout=0 to accommodate a chocolatey install failure due to slow network.

Uninstall

  1. Before the uninstallation, make sure no ROS system or program is running on your system.
  2. In a command prompt, run the following command:
  rmdir /s /q c:\opt

Feedback

In case you run into any upgrade/install/uninstall issues, you are encouraged to ask a question on answers.ros.org and tag windows.

相关文章:

  • Ubuntu查看环境变量
  • 四元素(四元数quaternion)的理解
  • SLAM算法资料收集
  • Ubuntu查看网卡信息
  • GDB最常用的命令
  • Ubuntu20.04+vscode快速调试ROS通用程序
  • ROS-Tutorials:rviz之Markers: Sending Basic Shapes (C++,附vscode调试说明)
  • Qt Creator 的下载与安装
  • Ubuntu20.04突然丢失网络时恢复的办法
  • Linux设置访问权限
  • ROS noetic view_frames TypeError: cannot use a string pattern on a bytes-like object
  • ROS noetic [turtle1_tf_broadcaster-4] process has died
  • Ubuntu下使用unzip或p7zip解压带密码的zip文件
  • libcurl: (51) SSL: no alternative certificate subject name
  • SSL和SSH和OpenSSH,OpenSSL有什么区别
  • 11111111
  • 345-反转字符串中的元音字母
  • docker容器内的网络抓包
  • HTTP请求重发
  • Java 网络编程(2):UDP 的使用
  • Linux编程学习笔记 | Linux多线程学习[2] - 线程的同步
  • Linux快速配置 VIM 实现语法高亮 补全 缩进等功能
  • Spark in action on Kubernetes - Playground搭建与架构浅析
  • vagrant 添加本地 box 安装 laravel homestead
  • 从@property说起(二)当我们写下@property (nonatomic, weak) id obj时,我们究竟写了什么...
  • 从setTimeout-setInterval看JS线程
  • 工程优化暨babel升级小记
  • 开发基于以太坊智能合约的DApp
  • 容器化应用: 在阿里云搭建多节点 Openshift 集群
  • 我的zsh配置, 2019最新方案
  • 在weex里面使用chart图表
  • 7行Python代码的人脸识别
  • Play Store发现SimBad恶意软件,1.5亿Android用户成受害者 ...
  • 阿里云重庆大学大数据训练营落地分享
  • 昨天1024程序员节,我故意写了个死循环~
  • ​ 全球云科技基础设施:亚马逊云科技的海外服务器网络如何演进
  • ​Java并发新构件之Exchanger
  • ​MySQL主从复制一致性检测
  • ​猴子吃桃问题:每天都吃了前一天剩下的一半多一个。
  • ​一些不规范的GTID使用场景
  • (04)odoo视图操作
  • (二)c52学习之旅-简单了解单片机
  • (附源码)计算机毕业设计SSM基于健身房管理系统
  • (十八)三元表达式和列表解析
  • (算法)求1到1亿间的质数或素数
  • (一)使用IDEA创建Maven项目和Maven使用入门(配图详解)
  • .net 程序 换成 java,NET程序员如何转行为J2EE之java基础上(9)
  • .NET 中 GetProcess 相关方法的性能
  • .net访问oracle数据库性能问题
  • .net流程开发平台的一些难点(1)
  • .NET中使用Redis (二)
  • .pop ----remove 删除
  • @Transactional类内部访问失效原因详解
  • [ 手记 ] 关于tomcat开机启动设置问题
  • [<MySQL优化总结>]