This guide will show how you can ROS inside windows without the need to use a virtual machine, but just using the Windows Subsystem for Linux (WSL).
Except for running ROS headless this guide will show how to run also the graphical tools of ROS such as RViz.
- Windows 10
- Administration rights in Windows
- USB device mount to WSL
Step 1: Install WSL
To install Windows Subsystem for Linux (WSL) follow this guide from Microsoft. Note that is recommended to install WSL2.
The choice of Ubuntu version is coupled with choice of ROS version you want to use.
Step 3: X-server forwarding
This step is needed to support the tools that need a GUI. For this we are going to use VcXsrv Windows X Server.
- Download VcXsrv
- Install and accept all the defaults
- Lunch VcXsrv from the start menu. Choose the defaults for the display settings and how to start clients.
For the extra settings make sure to uncheck “Native opengl” and to check “Disable access control”.
Right before you click “finish” you can select “Save configuration” so that you can simply double-click the config file to launch VcXsrv with these custom settings.
See below images for the default working configuration.
Step 4: Update .bashrc
In the Ubuntu installation add the following in the
echo "export DISPLAY=:0" >> ~/.bashrc
and don’t forget to reload it:
source ~/.bashrcAnd you done! You can now use all the GUI tools of ROS!
If the GUI tools don’t work
Try using the environmental variable
echo 'export LIBGL_ALWAYS_INDIRECT=0' >> ~/.bashrc
If you get:
ImportError: libQt5Core.so.5: cannot open shared object file: No such file or directorywhen running RViz or any other tool. Fix: See this. Run
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5