-
Notifications
You must be signed in to change notification settings - Fork 1
4.3 Installing ROS Noetic on WSL with Ubuntu 20.04 (for Windows)
This guide will walk you through installing ROS Noetic on WSL (Windows Subsystem for Linux) with Ubuntu 20.04 on a Windows machine. These steps were tested on Windows 11.
Before you start, you can refer to the following webpages for detailed instructions and troubleshooting:
-
Install WSL
- Download and install WSL from this link.
-
Enable WSL in Windows Features
- Open "Turn Windows features on or off."
- Ensure that "Windows Subsystem for Linux" and "Virtual Machine Platform" are checked. If they're not, enable them manually.
- Restart your computer
-
Set Default WSL Version to 2
- Run the following commands in an elevated (Administrator) PowerShell or Command Prompt:
wsl --set-default-version 2 wsl -l -v
- The output should look something like this (it is okay if Ubuntu is not yet displayed):
NAME STATE VERSION * Ubuntu-20.04 Stopped 2
- Run the following commands in an elevated (Administrator) PowerShell or Command Prompt:
-
Install the WSL Update
- I recommend installing the update from this link.
-
Install Ubuntu 20.04 from Microsoft Store (if it does not appear after
wsl -l -v
)- Go to the Microsoft Store and install Ubuntu 20.04.6.
-
Run Ubuntu
- You can now run Ubuntu as an application from the Start menu.
Alternatively, you can run Ubuntu directly through WSL:
- Open a terminal.
- Run the following command
wsl --set-default Ubuntu-20.04
- You can now run Ubuntu by simply typing
wsl
in you terminal.
-
Verify Ubuntu Installation
- In your terminal, running
wsl -l -v
should now list Ubuntu.
- In your terminal, running
-
Install ROS Noetic
-
Launch your installation of Ubuntu.
-
Run the following commands in your Ubuntu terminal:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add - sudo apt update sudo apt install -y ros-noetic-desktop python3-rosdep sudo rosdep init rosdep update
-
I recommend adding ROS setup to your bashrc file:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
-
I recommend you install the following packages for ease of use of rosserial:
sudo apt update sudo apt install tmux -y sudo apt install git -y sudo apt install vim -y sudo apt install build-essential -y sudo apt install -y ros-noetic-rosserial sudo apt install python3-catkin-tools -y sudo apt install ros-noetic-rosserial-arduino ros-noetic-rosserial -y sudo apt install ros-noetic-sbg-driver -y #allows sensors package to build source /opt/ros/noetic/setup.bash
-
-
Run VSCode from WSL (optional)
- Ensure Visual Studio Code is already installed on your Windows machine.
- Launch VSCode in Windows, then type
code
in your Ubuntu terminal. VSCode from Windows should launch in your Ubuntu environment. - If you want to use your WSL environment in VScode, you will need to install the WSL extension on VScode.
- If you want to be able to develop your WSL environment, you can follow the tutorial in this link.
- If you install the WSL extension in VScode, you can navigate to your WSL environment through the following steps:
- Remote Explorer
- WSL Targets
- Ubuntu-20.04
-
Connect USB Devices to WSL
- Run the following command in a terminal:
wsl --update
- Download the
.msi
from this link and run it to install USB support.
- Run the following command in a terminal:
-
List USB Devices
- Open an elevated terminal and type:
usbipd list
- Identify the
<busid>
of the USB device you want to connect to Ubuntu.
- Open an elevated terminal and type:
-
Bind USB Device to WSL
- Run the following command to bind the USB device to WSL:
usbipd bind --busid <busid>
- Example:
usbipd bind --busid 4-4
- Run the following command to bind the USB device to WSL:
-
Attach USB Device to WSL
- To attach the USB device to your WSL instance, use:
usbipd attach --wsl --busid <busid>
- To attach the USB device to your WSL instance, use:
-
Verify USB Connection in Ubuntu
- In your Ubuntu terminal, type:
lsusb
- This command will list the USB devices connected to your Ubuntu environment.
- In your Ubuntu terminal, type:
-
Detach USB Device from WSL
- To disconnect the USB device from Ubuntu, run:
usbipd detach --busid <busid>
- To disconnect the USB device from Ubuntu, run:
This guide should help you set up ROS Noetic on WSL with Ubuntu 20.04 and connect USB devices seamlessly. If you run into any issues, refer to the linked guides or reach out to your team for support.