WSLg with GPU support available on latest version of Gazebo Garden and Harmonic!

Hello everyone!

For a long time (roughly since Ignition Edifice release, i.e. April 2021), gz-sim had problems with running under WSLg with GPU support. A workaround that at this point was suggested in the community was to force software rendering when running gz sim on WSLg, by setting the environment variable export LIBGL_ALWAYS_SOFTWARE=1.

As tracked in No camera/render on ubuntu (WSLg + vGPU) · Issue #920 · gazebosim/gz-sim · GitHub, thanks to several fixes that were applied in ogre-next and gz-rendering, export LIBGL_ALWAYS_SOFTWARE=1 (i.e. forcing software rendering) is not necessary anymore when running the latest version of Gazebo Garden and Harmonic on Ubuntu 22.04 on WSLg.

If instead you are still experiencing problems with Gazebo Garden or Harmonic, please open a new issue in Sign in to GitHub · GitHub, providing all the graphics-related information requested in the template.

Note that WSLg is still not an officially tested platform for Gazebo, and so regression may happen. Also in this case, feel free to open issue if you experience regressions.

5 Likes

Is there more info on how to run this?
Is WSLg WSL1 or WSL2?

You just need to follow the instructions on how to install Gazebo Harmonic on Ubuntu 22.04, see Gazebo , there is nothing different to do between a normal Ubuntu system or Ubuntu on WSLg.

WSLg supports only WSL 2, see Run Linux GUI apps with WSL | Microsoft Learn and GitHub - microsoft/wslg: Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios .

1 Like

Neat. It’s much faster (responsive) than Gazebo in VMWare. I tested harmonic on Windows 10, with a 12th Gen Intel(R) Core(TM) i7-12850HX CPU and Nvidia RTX A3000 GPU. The shapes.sdf file loads fine.

I look forward to trying this out with some more complex use cases.

2 Likes

Great! Feel free to post issues or comments here for any problem or hiccup you may experience. Just as information, which version of Ubuntu are you using? Which version of mesa?

Default “Ubuntu 22.04.3 LTS”. Sadly, WSL is not a solution at my company because our VPN provider breaks WSL networking. Once that is fixed, I can report back on more test results. For now, I can’t download any packages, and glxinfo isn’t installed.

1 Like

Ah, that is annoying. Just FYI, things are also moving on the side of native Windows packages.

This is all extremely experimental, but since a few days, conda create -n gz-sim8 gz-sim8 on Windows results in a working gz sim -g command, that you can use with with gz sim -s to launch a simulation and visualize it. I am still working in getting gz sim to work, but hopefully it should not be too hard.

Related PRs:

Neat. If it can be used without admin level permissions for install, I’ll try it out.

It should not be necessary. You can download a minimal conda-forge based distributions such as https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe, and as long you specify a user-writable directory you should not need any admin permissions.

I tried this out on a new laptop (Lenovo Thinkpad X1 Pro) in WSL2, but the gazebo GUI displays a black screen. (Using harmonic, Ubuntu 22 in WSL2)

I get this console output:

[GUI] [Msg] Loading plugin [gz-rendering-ogre2]
libEGL warning: failed to open /dev/dri/renderD128: Permission denied
libEGL warning: NEEDS EXTENSION: falling back to kms_swrast
ryan@ryan-thinkpad:~/Dev/ardupilot_ws/src/ardupilot$ groups
ryan adm dialout cdrom floppy sudo audio dip video plugdev netdev docker
ryan@ryan-thinkpad:~/Dev/ardupilot_ws/src/ardupilot$ ll /dev/dri
total 0
drwxr-xr-x  3 root root        100 Oct 23 11:44 ./
drwxr-xr-x 16 root root       3560 Oct 23 11:44 ../
drwxr-xr-x  2 root root         80 Oct 23 11:44 by-path/
crw-rw----  1 root video  226,   0 Oct 23 11:44 card0
crw-rw----  1 root render 226, 128 Oct 23 11:44 renderD128

Should I file an issue?

Yes, thanks, this is unexpected. The problem may be that your D3D12 driver does not support the features required to emulate the OpenGL features required by ogre2, but it is easier to debug if you open an issue an fill the template, thanks!

1 Like

Logs coming shortly.