In this tutorial, we'll be installing ROS on Windows 10.
The requirements are as follows:
C:\
drivePerform the following steps (in the given order) to install ROS on your system running Windows 10.
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.Check Desktop development with C++ workload and Universal Windows Platform development workload under "Desktop and Mobile"
You have now successfully installed the Visual Studio dependencies required for the installation of ROS.
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.
@"%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"
With this, "Chocolatey" has been installed on your system. You can verify this by running choco /?
on the command prompt and observing the output.
choco /?
after installing the "Chocolatey" package manager through the given instructionsecho %PATH%
and see the output). The path of choco is found using where choco
.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.
choco upgrade git -y
git --version
refreshenv
to refresh the environment and avoid closing and reopening the command prompt repeatedly.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.
mkdir c:\opt\chocolatey
set ChocolateyInstall=c:\opt\chocolatey
choco source add -n=ros-win -s="https://roswin.azurewebsites.net/api/v2" --priority=1
choco list
and finding an entry by the name "ros-win" and the properties set above.choco upgrade ros-eloquent-desktop -y --execution-timeout=0 --pre
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.
choco list
after adding the new sourceNow 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:
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:
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
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
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
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.
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:
You can now run ROS commands here. Let's start with rosversion -d
to get the version / distribution name of ROS installed.
rosversion -d
command when executed in the command prompt opened by double clicking the "ROS" shortcut.roscore
and inspecting parameters on the ROS Parameter ServerTo 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.
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.
Now, the icon of the shortcut resembles the ROS logo.