Windows 10上安装ROS noetic平台

21 篇文章 0 订阅

根据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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值