[Documentation] [TitleIndex] [WordIndex

Windows Operating System

Reserve space for the installation

Install Visual Studio 2019

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

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.

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

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.

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:

    "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"
        },

        "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.

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.


2022-05-28 12:49