ROS2 + Gazebo on WSL2 with WSLg (1)

Context

Previously we tried running ROS2 + Gazebo on WSL to prevent having to sideload ubuntu.

This didn't work last year, because WSL lacked good support for GUI applications.
There's been many improvements since then to WSLg (Windows Subsystem for Linux GUI), so we should try that instead of directing users to dualboot or USBs

Should we use WSL2g?

Pros Cons
Easy setup for Windows users Hardware access is lacking (cameras, sensors, etc).
Workarounds exist, but they suck
Native GUI apps on Windows WSL2's virtual networking will block ROS2 node
communication between Windows ↔ WSL2 ↔ the rover
GPU Acceleration Performance will be worse
Easy access between windows/linux files
(don't build workspaces in mnt/c/…)
For early development, yes!

Install

Installing WSL2 + Ubuntu 24.04

  1. Open command prompt with admin
    • Pasted image 20250908193247.png
  2. If you don't have WSL already, install it with the following command: wsl --install -d Ubuntu-24.04
    1. put a username you'll remember
    2. put a password you'll remember (write this down, you will need it!)
  3. After installing, WSL should launch automatically, you'll know if you have green text like the following:
    1. Pasted image 20250908193442.png
    2. If not, run WSL by searching WSL on windows
    3. Pasted image 20250908193521.png
  4. WSL is installed!