Search this site
Embedded Files
No Boredom
  • Home
    • Computer Geek
    • Learning
    • Math Geek
    • Projects
No Boredom
  • Home
    • Computer Geek
    • Learning
    • Math Geek
    • Projects
  • More
    • Home
      • Computer Geek
      • Learning
      • Math Geek
      • Projects

ROS on Windows 10

< Back to ROS Intermediate tutorials
Prerequisites
Installation Procedure
Installing Visual Studio 2019
Existing Installation
New Installation
Install Chocolatey Package Manager
Installing Git
Install the Binary Packages
Create a Shortcut
Running ROS
Additional Resources
Installation
Retry installing ROS Melodic Desktop
Shortcut
ROS Icon

In this tutorial, we'll be installing ROS on Windows 10.

Prerequisites

The requirements are as follows:

  • 64-bit Windows 10 Desktop or Windows 10 IoT Enterprise
  • At least 10 GB of free space on C:\ drive
  • Administrator access of your PC

Installation Procedure

Official Page

Perform the following steps (in the given order) to install ROS on your system running Windows 10.

  • Backup anything in C:\opt\ folder and delete the C:\opt folder (if it exists). Create the folder c:\opt if it does not exist and ensure that it's empty.

Installing Visual Studio 2019

  • ROS depends upon Desktop development with C++ workload and Universal Windows Platform development workload that come with Visual Studio 2019. These are crucial dependencies for ROS and have to be installed along with Visual Studio 2019

Existing Installation

Official page
  • If you already have Visual Studio 2019 installed, then go to the start menu and launch the app "Visual Studio Installer". It'll help you add workloads to an existing installation.
    • Open the app "Visual Studio Installer"
    • Choose your Visual Studio installation and click Modify option next to it.
  • On the next screen, under "Desktop and Mobile", check Desktop development with C++ workload and Universal Windows Platform development workload.
  • You may also check some individual components that you think will be needed by you. (This is also be done later, at your own convenience).
  • Select the option "Install while downloading" and wait for the download and install of workloads to finish.
Application "Visual Studio Installer" home screen. Select Modify option.

Check Desktop development with C++ workload and Universal Windows Platform development workload under "Desktop and Mobile"

New Installation

Official page
  • If you do not have Visual Studio 2019 already installed, you'll have to install it from the official website (I'd suggest Visual Studio Community 2019).
  • While installation, the same prompt will be asked to choose workloads. Under "Desktop and Mobile", check Desktop development with C++ workload and Universal Windows Platform development workload.
  • Then, you can choose to Install components while downloading, just to speed things up a bit.

You have now successfully installed the Visual Studio dependencies required for the installation of ROS.

Install Chocolatey Package Manager

Official website

Chocolatey is a Windows Software Package Manager. It makes deployment of software like ROS simple, thus ROS is currently delivered to Windows through it.

Note: To install "Chocolatey", you need to have Administrative privileges.

  • In the start menu, search for application "x64 Native Tools Command Prompt for VS 2019" and run the application as an administrator.
  • Agree to the dialog boxes that appear. These will request for granting administrator level privileges to the session.
  • Run the following command to install "Chocolatey" in one command:
    • @"%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"
      • This command launches powershell (in the same session, so a new window won't open since "-NoProfile" is given). It shall download and execute the installer for "Chocolatey" from it's official website. It then sets the PATH variable to include the "Chocolatey" binaries.
  • Close the current session and reopen the Command Prompt for VS 2019 so that effects take place.

With this, "Chocolatey" has been installed on your system. You can verify this by running choco /? on the command prompt and observing the output.

Output of the command choco /? after installing the "Chocolatey" package manager through the given instructions
After installing Chocolatey, you must observe the path where binaries of chocolatey are store in the PATH variable (run echo %PATH% and see the output). The path of choco is found using where choco.
Launching "x64 Native Tools Command Prompt for VS 2019" through Start menu. Select Run as Administrator.
Output of the installation command for "Chocolatey"

Installing Git

Official page

Git is a version control system used for maintaining large projects. It is important to have it installed through "Chocolatey", even if you already have it installed as an application.

  • To install git, run the following command
    • choco upgrade git -y
      • This upgrades an existing package and installs it if not already installed. It does not ask a prompt, since "-y" is given (yes to all prompts).
  • To confirm the installation of git, run the following command
    • git --version
  • Close and reopen the application "x64 Native Tools Command Prompt for VS 2019" (as administrator, always).
  • You can also use the command refreshenv to refresh the environment and avoid closing and reopening the command prompt repeatedly.
Installing git using "Chocolatey". The procedure to install any software through "Chocolatey" is roughly the same.

Install the Binary Packages

To keep things simple, we shall install the "desktop_full" version (everything that comes in a complete installation). This takes up space and time but is also the easiest to install and work with.

  • Make the directory for chocolatey in the opt folder. Run the following command
    • mkdir c:\opt\chocolatey
      • This makes the folder chocolatey inside the opt folder in C: drive. The opt folder shall have the installation and chocolatey folder inside it will handle the installation.
  • Set the installation folder to the created folder (this is a chocolatey setting). Run the following command
    • set ChocolateyInstall=c:\opt\chocolatey
      • This simply creates a variable which "Chocolatey" uses to decide the installation directory.
  • Add source for chocolatey to fetch software from ROS servers. Run the following command
    • choco source add -n=ros-win -s="https://roswin.azurewebsites.net/api/v2" --priority=1
      • This will add "https://roswin.azurewebsites.net/api/v2" as a source for downloading software for your chocolatey distribution. You can verify the success of this command by running choco list and finding an entry by the name "ros-win" and the properties set above.
  • Install the software ros-melodic-desktop_full through chocolatey. Run the following command
    • choco upgrade ros-eloquent-desktop -y --execution-timeout=0 --pre
      • This takes some time to install

You have now successfully installed ROS Melodic on your system, but you're not done yet. After the installation has finished, you may close the open command window.

The output of choco list after adding the new source
Running the commands shown above to install binary packages for ROS Melodic
ROS Melodic Desktop (Full) installation has finished. Now we only need to create a shortcut.

Create a Shortcut

Now that you've installed ROS. To use it, you must source it. That is, you must run the setup batch script in "C:\opt\ros\melodic\x64" every time you want to do anything ROS. In order to avoid typing all the source lines again and again in each and every terminal you open, it's best to create a shortcut which will open a terminal, source everything and then hand it over to you for doing anything ROS. Let's make a shortcut like this:

  • Go to Desktop using "Windows Key + D" key combination
  • Right click -> Select New -> Select "Shortcut" in the menu
  • For the location of the item, you can give any location. We'll be changing it later anyways. It's easiest to Browse and select "Desktop". Click Next.
  • Give it a name. I'd suggest "ROS" would be perfect.

Now, we have created a shortcut. But we need to modify what happens when we open it (double click on it and execute it). Do the following:

  • Right click on the shortcut and click on "Properties"
  • The "Target" has to be made an executable which initializes ROS setup and then hands over the control to the user. To do this enter the following in the "Target" field
    • If you are using Visual Studio Community 2019
      • 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 Visual Studio Professional 2019
      • 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 Visual Studio Enterprise 2019
      • 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
    • This command does the following
      • Starts a Command Prompt session with the session continuing even after the given commands have finished executing (because of "/k").
      • Calls the developer command file (VsDevCmd.bat) of the Visual Studio installation. It passes the architecture.
      • It sets the "ChocolateyInstall" variable for Chocolatey to know the location of installed files.
      • It sources the setup.bat file, which is a setup file written in Windows Batch format.
      • Once the above actions are completed, the command prompt is spawned and the user can now enter anything.
  • It is important to run the shortcut as an Administrator so that ROS can access system resources. To give administrator privileges to the prompt launched by the shortcut, the shortcut needs to be given administrative privileges. To do this:
    • Select "Advanced" in properties
    • Check "Run as Administrator" in the "Advanced Properties" window. Click "OK" and close this window.
  • We have now finished setting the properties for the shortcut. Click "Apply" and then "OK" to close the "Properties" window.

You're ready to use ROS through this shortcut.

There's a procedure given in Additional Material to give this an icon of the ROS logo (since normal PNG doesn't work). Refer it if interested.

Creating a new shortcut on Desktop
Assign a location to the shortcut.This can be any random location on the system. For convenience, Desktop is chosen.
Name the shortcut "ROS"
The properties that must be changed for the shortcut ("Target" is changed). Advanced settings are changed to run the shortcut as administrator.

Running ROS

Now that everything is done, we can run ROS by simply executing the shortcut. Just by double clicking the shortcut, a command prompt session which has ROS setup will open and we may execute ROS commands in it.

To run ROS, do the following:

  • Double click the "ROS" shortcut created
  • Agree to the prompt asking for permissions

You can now run ROS commands here. Let's start with rosversion -d to get the version / distribution name of ROS installed.

Output of rosversion -d command when executed in the command prompt opened by double clicking the "ROS" shortcut.
Running roscore and inspecting parameters on the ROS Parameter Server

Additional Resources

Installation

Retry installing ROS Melodic Desktop

To retry installation, simply delete the "C:/opt" folder using the command rmdir /s /q c:\opt and retry the installation from the point of Installing the Binary Packages.

Shortcut

ROS Icon

The shortcut has the CMD icon by default. Some might like it to have a ROS icon. For this, I've used https://icoconvert.com/ to create an ICO file from the ROS logo. The file can be obtained from here.

  • Download the icon file from here
  • Right click the shortcut "ROS" that was created to access ROS
  • Select Properties -> Change Icon
  • Select the icon downloaded in the explorer window that opens
  • Apply the settings and close the properties window

Now, the icon of the shortcut resembles the ROS logo.

Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse