ROS on Windows installation

Microsoft has stopped supporting this method of installation. It is not expected to work but is here for archival purposes.

There is more info at this answer on Robotics Stack Exchange

  Show EOL distros: 

ROS CTurtle is EOL, and these instructions for getting it to work on Windows are severely outdated. They are only kept here for historical reasons.

Please do not expect these steps to work, or try to follow them.

For future Windows support, see the relevant ROS2 resources.

Running ROS Software on Windows

ROS is currently not supported on Windows, but it is possible to run parts of ROS on Windows. In particular, you can:

  • run some of the Python code, including the ROS client library for Python (rospy). This is useful, for example, if you need to interface a process on Windows with a ROS graph running elsewhere.

  • run C++ code under Cygwin

Each of these possibilities is discussed below.

Running Python code on Windows

If you have Python code on Windows you wish to interface with ROS, you can use the rospy client library. This will enable you to run Python-based ROS nodes. Higher-level tools, like roslaunch, are not expected to work on Windows, though they can be ported.

There are some extra things you will have to do that, while cumbersome, will get you off the ground.

What you need

Copying generated message and service files

You will need the auto-generated Python files for the messages and services you plan to use. The easiest way to do this is to compile your packages on a non-Windows setup, then copy these files over.

In order to figure out which packages have messages, you can run:

$ rosmsg packages

You can then copy the src/package_name/msg from these packages onto your Windows machine.

In order to figure out which packages have services, you can run:

$ rossrv packages

You can then copy the src/package_name/srv from these packages onto your Windows machine.

Disable calls to roslib.load_manifest

rospy uses the rospack library to dynamically generate the appropriate PYTHONPATH. rospack doesn't work on Windows (yet), so you will need to disable these calls and instead configure your Python path manually.

Here is an example of how to disable this call in roslib/src/roslib/launcher.py:

def load_manifest(package_name, bootstrap_version="0.7"):
    """
    Update the Python sys.path with package's dependencies
    @param package_name: name of the package that load_manifest() is being called from.
    @type  package_name: str
    @param bootstrap_version: (keyword argument) do not use. Soon to be deprecated
    @type  bootstrap_version: str
    """
    if 1 or package_name in _bootstrapped:
        return

Note the "1 or" on the second-to-last line.

Setup your environment

You will need to set your ROS_MASTER_URI and ROS_ROOT environment variables. Also set PYTHONPATH variable to the folder containing the copied packages

Quick Check

Ideally, you'll have a folder containing the following python packages

  • roslib - copied from $HOME/ros/ros/core/roslib/src/
  • rospy - copied from $HOME/ros/ros_comm/clients/rospy/src/
  • std_msgs - copied from $HOME/ros/ros_comm/messages/std_msgs/src/
  • rosgraph_msgs - copied from $HOME/Users/tingfan/ros/ros_comm/messages/rosgraph_msgs/src/
  • other packages - copied from rospack find $package_name/src

These packages list above should be enough for running at least the "talker_listener" tutorial.

ROS windows port by Robotics Equipment Corporation

A native windows port is available here. The port currently includes

  • roslib
  • roscpp
  • rosconsole
  • message_filters
  • tf
  • actionlib

Its main purpose is to enable developers to create shiny windows GUIs connected to the ROS system running on the Linux driven robot.

System requirements:

  • Windows 7 or Vista (32/64 bit)
  • Microsoft Visual Studio 2008 or Microsoft Visual Studio 2008 Express Edition
  • CMake (version 2.8 or later)

Running with Cygwin

Please see Tingfan Wu's tutorial.

ROS Diamondback is EOL, and these instructions for getting it to work on Windows are severely outdated. They are only kept here for historical reasons.

Please do not expect these steps to work, or try to follow them.

For future Windows support, see the relevant ROS2 resources.

Overview

We are go! Well, not fully yet, but there is partial functionality and enough to be useful in some situations. To be practical, we are not targeting the windows environment as a full blown replacement for linux-ros as windows doesn't have the mechanisms to handle the scaling of complexity (e.g. rosdeps), but it needs to be able to be useful in some simple use case scenarios. For example,

  • Monitoring/debugging the robot from a remote windows pc.
  • Users interfacing with a robot via simple controlling applications.
  • Scenario apps (e.g. smach) that are more conveniently run on the network.
  • Manager applications for controlling networked robots.
  • Computationally heavy algorithms running on an idle pc away from the robot.

Status

Current functionality has been enabled by compiling with the mingw cross-compiler in linux. The cross compiling is managed by eros and the windows specific utilities and tools are in win_ros. As ros moves to a purely cmake build environment, we hope to bring in the msvc compatibility.

{X} Under Construction...

ROS Electric is EOL, and these instructions for getting it to work on Windows are severely outdated. They are only kept here for historical reasons.

Please do not expect these steps to work, or try to follow them.

For future Windows support, see the relevant ROS2 resources.

Overview

We are go! Well, not fully yet, but there is partial functionality and enough to be useful in some situations. To be practical, we are not targeting the windows environment as a full blown replacement for linux-ros as windows doesn't have the mechanisms to handle the scaling of complexity (e.g. rosdeps), but it needs to be useful in some simple use case scenarios. For example,

  • Monitoring/debugging/interfacing with ros robots from a remote windows pc.
  • Integrating with programs that only utilise windows drivers/libraries.
  • Using ros comms to connect ros robots to a much larger networked environment.
  • Computationally heavy algorithms running on an idle pc away from the robot.

The current status is still experimental. Various components are working and we hope to start realising some real usefulness with electric. You can check the roadmap to see what's been done and what is on the immediate todo list (if you're interested in helping, contact one of the devs!).

Getting Started

Windows C++ Development

This is for native windows development with the microsoft visual studio compiler (currently supporting visual studio/express 10+).

For more advanced usage:

Linux C++ Development

This is for the control roboticists who love working in linux and get flustered when asked to build windows apps for the rest of the world (namely users/test engineers) there is the mingw cross-compiler. There is also qt support here - write the code once and compile your qt app for both windows and linux without any changes.

Where To Go From Here

All guides and documentation for installing and using ros on windows can be found in the win_ros wiki pages.

Overview

ROS Groovy is EOL, and these instructions for getting it to work on Windows are severely outdated. They are only kept here for historical reasons.

Please do not expect these steps to work, or try to follow them.

For future Windows support, see the relevant ROS2 resources.

Under development - ymmv.

Information

Getting Started

WinRos on Windows

This is for native windows development with the microsoft 2010 compiler. Currently supporting either windows sdk 7.1 (cl/nmake) or visual studio 10.0.

For more advanced users who are familiar with ros and catkin:

WinRos on Linux

{X} It is not likely we'll have mingw re-enabled for groovy.

This is for the control roboticists who love working in linux and get flustered when asked to build windows apps for the rest of the world (namely users/test engineers) there is the mingw cross-compiler. There is also qt support here - write the code once and compile your qt app for both windows and linux without any changes.

Support

  • Contact - where to go for help or to ask about contributing.

  • Troubleshooting - if you are having issues, consult this first.

  • Additional Help - general questions about working in win_ros.

Contributing

  • Roadmap/ChangeList - current status and plans.

  • Contributing - if you're interested in helping, either with the infrastructure or porting stacks, start here.

All guides and documentation for installing and using ros on windows can be found in the win_ros wiki pages.

Overview

ROS Hydro is EOL, and these instructions for getting it to work on Windows are outdated. They are only kept here for historical reasons.

Please do not expect these steps to work, or try to follow them.

For future Windows support, see the relevant ROS2 resources.

Information

Getting Started

WinRos on Windows

This is for native Windows development with the Microsoft Visual C++ Compilers 2010. Currently supporting either Windows SDK 7.1 (cl/nmake) or Visual Studio 10.0.

  • Msvc Status - what's working and what's not.

  • Msvc SDK - installing, configuring and verifying a pre-built sdk.

  • Msvc SDK Projects - developing projects with visual studio and the sdk.

  • Msvc SDK Messages - developing new ros msg types with the sdk.

  • Msvc Runtime Environment - rosmaster, roslaunch'ers, rosparam and ros logging with the sdk.

For more advanced users who are familiar with ros and catkin:

Support

  • Contact - where to go for help or to ask about contributing.

  • Troubleshooting - if you are having issues, consult this first.

  • Additional Help - general questions about working in win_ros.

Contributing

  • Roadmap/ChangeList - current status and plans.

  • Contributing - if you're interested in helping, either with the infrastructure or porting stacks, start here.

Refer to hydro version for old installation instructions.

Refer to lunar if you are able to use a newer ROS version.

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.

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

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

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.

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.

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.

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.

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)".
    • If you already have Visual Studio 2019 installed, you can Modify Installation

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.

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-melodic-desktop_full -y --execution-timeout=0

ROS 2 Foxy 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\melodic\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\melodic\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\melodic\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.

(Optional) Using the new Windows Terminal

Microsoft is working on 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\\melodic\\x64\\setup.bat",
                "guid" : "{xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx}",
                "icon" : "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
                "name" : "ROS",
                "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.

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. You can also leave a comment about your case on GitHub issue.

Wiki: Installation/Windows (last edited 2024-11-28 22:22:15 by TullyFoote)