Installing WSL-ROS2 on Windows
Applicable to: Windows 10 or 11 personal (unmanaged) computers
The WSL-ROS2 Simulation Environment¶
To support this course we've created a custom ROS 2 environment which runs on Windows 10 or 11 using the Windows Subsystem for Linux (WSL). We call this "WSL-ROS2" and you can download it via the University of Sheffield Software Download Service (University login required).
Note
When you download WSL-ROS2 from the Software Download Service you will receive an email with installation instructions. We recommend that you follow the instructions provided on this page instead, as this page will be kept more up-to-date throughout the semester.
Prerequisites¶
- Your computer must be running Windows 10 Build 19044 or higher, or Windows 11.
- Update the GPU drivers for your machine.
- Install or update WSL:
- If you don't already have WSL installed on your machine then follow these instructions to install it.
- If you do already have WSL installed on your machine, then follow these instructions to update it.
- Install the Windows Terminal.
- Install Visual Studio Code and the WSL VS Code extension.
- Install the VcXsrv Windows X Server.
Installing¶
- Go to the IT Services Software Downloads page (you'll need to log in with your university MUSE credentials).
-
Scroll down to the bottom, where you should see WSL-ROS listed.
Click on the blue "Request WSL-ROS" button and then wait to receive an email to your university email address.
-
The email will contain a link to download WSL-ROS2 to your machine as a
.zipfile (~2 GB). -
On your computer, create a new folder in the root of your
C:\drive calledWSL-ROS2. - Extract the content of the downloaded
.zipfile into to theC:\WSL-ROS2\folder. -
Launch PowerShell and enter the follow command to install WSL-ROS2 as a WSL distro on your machine:
-
This may take a couple of minutes. Once it's done, you can verify that it was successful with the following command:
Where
WSL-ROS2should be listed. -
Next (optional), open up the Windows Terminal App, then:
- Go to Settings (Ctrl+,)
- Under
Profilesin the left-hand menu, findWSL-ROS2(or scroll further down and click theAdd a new profilebutton to create it). -
Configure the settings for the
WSL-ROS2profile as shown below:
-
Then, in
Startup(back in the left-hand menu again), underDefault profileselect WSL-ROS2 from the drop-down list.This will ensure that each time you open the Windows Terminal App or you press the New Tab () button a WSL-ROS2 Terminal Instance will be launched by default.
Using a Dedicated X Server¶
WSL-ROS2 requires an XServer in order to render graphical applications (such as Gazebo and RViz)1. You need to make sure you have one up and running whenever you're working with WSL-ROS2.
- Having installed VcXsrv in the Prerequisites Section...
-
Download this config file for VcXsrv and save it to your desktop as
wsl_ros_config.xlaunch.
-
Double click this to launch VcXsrv with the appropriate settings. An icon should then appear in your notification tray (bottom-right) to indicate that the X Server is running:
-
Launch the WSL-ROS2 environment by launching the Windows Terminal App:
-
In the WSL-ROS2 terminal instance, try running the empty world Gazebo simulation:
This should hopefully present you with something like this:
Important
You need to make sure you have the X Server running (by clicking the
wsl_ros_config.xlaunchshortcut) every time you work with WSL-ROS2.
See Also¶
-
WSL2 does support GUI applications natively, however we are finding that the latest version of Gazebo (Ignition) doesn't seem to play nicely with this, and performance is generally pretty poor. Using a dedicated XServer seems to offer slightly better performance. ↩