2025-gazebo配置on vmware,wsl
ros2安装
# 安装ros2, 推荐鱼香ros一键式安装
wget http://fishros.com/install -O fishros && . fishros
安装版本:ubuntu24.04 + ros2 jazzy
gazebo
Getting Started with Gazebo? — Gazebo ionic documentation
ros与gz的版本对应关系:
使用推荐版本安装
sudo apt-get install ros-${ROS_DISTRO}-ros-gz
Try
# Fortress uses "ign gazebo" instead of "gz sim"
gz sim
vmware
起初使用ubuntu20.04+ros2-humble,安装的gazebo测试黑屏,遇到了如下issure提交的信息:(总结,与qt相关,尚未解决)
VMWare Ubuntu: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. · Issue #618 · gazebosim/gz-gui
一些解决办法,并不work,会有其他error。
# method 1, not work
export LIBGL_DRI3_DISABLE=1
# method 2, not work
export SVGA_VGPU10=0
ubuntu24.04+ros2-jazzy实测还是类似问题:
一个老办法,关闭vmware的3D加速,但是感觉不能接受,转战wsl。
wsl
参考官方教程:
旧版本 WSL 的手动安装步骤 |Microsoft 学习 — Manual installation steps for older versions of WSL | Microsoft Learn
wsl --install
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
下载并手动安装24发行版:
# 该链接是下载的Appxbundle,先执行下面步骤,解压后得到一系列appx版本
Rename-Item .\Ubuntu[your version].appx Ubuntu.zip
Expand-Archive .\Ubuntu.zip -Verbose
cd .\Ubuntu\
.\ubuntu[your version].exe
安装完成测试gz sim
发现帧率并不高,找到了相关issure中,执行NVIDIA的环境变量。
Windows Docker 中的 Gazebo 无法使用 Nvidia GPU,回退到使用 CPU。·问题 #2595 ·凉亭/GZ-SIM — Gazebo in Windows Docker cannot use Nvidia GPU, falls back to using CPU. · Issue #2595 · gazebosim/gz-sim
echo "export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA" > ~/.bashrc
如下是前后对比(将核显改成了nvidia显卡):
dod@qDoDp:~$ glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Microsoft Corporation (0xffffffff)
Device: D3D12 (Intel(R) UHD Graphics) (0xffffffff)
Version: 24.2.8
Accelerated: yes
Video memory: 16429MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.1
Max compat profile version: 4.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.0
……
dod@qDoDp:~$ export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA
dod@qDoDp:~$ glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Microsoft Corporation (0xffffffff)
Device: D3D12 (NVIDIA GeForce GTX 1660 Ti) (0xffffffff)
Version: 24.2.8
Accelerated: yes
Video memory: 22267MB
Unified memory: no
Preferred profile: core (0x1)
Max core profile version: 4.6
Max compat profile version: 4.6
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.1
……
遇到的warning(暂未解决,但似乎没有影响):
dod@qDoDp:~$ gz sim
libEGL warning: failed to open /dev/dri/renderD128: Permission denied
libEGL warning: failed to open /dev/dri/renderD128: Permission denied
libEGL warning: NEEDS EXTENSION: falling back to kms_swrast