What is explained: In this tutorial, we explain how to Install ROS2 Jazzy Jalisco in Windows Subsystems for Linux (WSL2) and How to Verify the Installation by Running Demo Example and Rviz. The YouTube tutorial accompanying this webpage is given below.
Background Information
ROS2 Jazzy Jalisco is the newest ROS2 release (distribution) released in May 2024. The end of life date is May 2029. Sooner or later, ROS1 and ROS2 programs have to be updates such that they can run in ROS2 Jazzy Jalisco. Consequently, you should start learning ROS2 Jazzy.
Motivation for creating this tutorial
On the official ROS2 website, there are instructions on how to install ROS2 Jazzy Jalisco on Ubuntu 24.04 and in Windows. Windows installation might be complex and involve a number of prerequisites. However, nowhere it is mentioned that ROS2 Jazzy Jalisco can be installed in Windows Subsystem for Linux (WSL2). WSL2 enables you to run Linux Ubuntu and Linux programs within the Windows operating system. In this tutorial, we will teach you how to properly install and setup ROS Jazzy Jalisco in WSL2 and how to run a demo program and RViz that will test the installation. Note that we did not try to run other applications in ROS2 WSL2, and we cannot guarantee that everything will work perfectly. Maybe you will eventually have to do some fine-tuning and tweaking to be able to develop and run programs in ROS2 WSL2. In any case, this tutorial might be a good starting point for you.
Professional tutoring, skill development, and engineering services
If you need help with your professional engineering problem, or you need to develop new skills in the fields of control, signal processing, embedded systems, programming, optimization, machine learning, robotics, etc., we are here to help. We provide engineering services, as well as tutoring and skill development services. We have significant industry, research, and university-level teaching experience. Describe your problem and we will send you a quote for our services. For more information, see the contact menu at the top of this webpage.
Prerequisites – Install WSL2 in Windows and Install Linux Ubuntu 24.04 in WSL2
You need to have WSL2 installed in Windows – We created a video tutorial on how to install WSL2 in Windows. We will briefly explain this in this tutorial. You can do that by opening a PowerShell terminal in the administrator mode. To open PowerShell, click on Start, and search for PowerShell, and then do the right click on PowerShell and click on “Run as administrator”. Then, in PowerShell type this:
wsl --install
This will install the WSL2 for windows and it will install the default Linux distribution. In our case, the default Linux distribution is Ubuntu 22.04. However, to run ROS2 Jazzy Jalisco, you will need Ubuntu 24.04. Next, we explain how to install Ubuntu 24.04 in WSL2.
We created a tutorial on how to install any supported version of Ubuntu in WSL2. Here is the video. Here, for the completeness of this tutorial, we will explain this. To list all available Linux distributions that can be run through WSL, open a PowerShell in the administrator mode, and type:
wsl --list --online
The output should look like this
Here, we see that Ubuntu 24.04 can be installed through PowerShell. To install this version of Ubuntu, in PowerShell Type
wsl --install -d Ubuntu-24.04
This will install the desired version of Ubuntu. After the installation is completed you will be asked to set your username and password. After that, you can close PowerShell.
Install ROS2 Jazzy Jalisco in Windows by Using WSL2
First, you need to start Ubuntu 24.04 through WSL. There are several ways to do that. The first method is to click on Start and to search for Ubuntu 24.04. Then, you need to click on the application.
wsl -d Ubuntu-24.04
Another approach is to click on Start, then search for command prompt, then open a command prompt and type
wsl -d Ubuntu-24.04
In any case, make sure that you are in the home folder by typing
cd ~
Then, execute the following set of commands
Set locale
locale # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale # verify settings
Enable required repositories
sudo apt install software-properties-common
sudo add-apt-repository universe
Add the ROS2 GPG key with apt
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
And finally, add the repository to the source list
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
Then, install the development tools and install ROS2
sudo apt update && sudo apt install ros-dev-tools
sudo apt update
sudo apt upgrade
sudo apt install ros-jazzy-desktop
Run ROS2 Demo Example to verify the Installation
Here, we will run a simple built-in demo demonstrating how to use ROS2. The demo will run a ROS2 talker in one terminal. This talker node will send a simple Hello World message with an increased string counter. This will be done with the period of 1 second. On the other hand, in another terminal, we will run a ROS2 listener example, that will receive the message and print the message on the computer screen. First of all, let us start the talker node. In the same terminal type
source /opt/ros/jazzy/setup.bash
ros2 run demo_nodes_cpp talker
Then, we need to open a new terminal in the same session of Ubuntu 24.04. To do that, hold shift, and click (click on) on the icon of Ubuntu 24.04 in the bottom screen (bottom Windows Menu )
This will open a new terminal, and in the new terminal type
source /opt/ros/jazzy/setup.bash
ros2 run demo_nodes_py listener
This will start the listener, and you should see this
How to Start RViz in ROS2 in WSL
We can do that by typing
ros2 run rviz2 rviz2
The output is shown below.