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.8Accelerated: yesVideo memory: 16429MBUnified memory: yesPreferred profile: core (0x1)Max core profile version: 4.1Max compat profile version: 4.1Max GLES1 profile version: 1.1Max GLES[23] profile version: 3.0
……dod@qDoDp:~$ export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIAdod@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.8Accelerated: yesVideo memory: 22267MBUnified memory: noPreferred profile: core (0x1)Max core profile version: 4.6Max compat profile version: 4.6Max GLES1 profile version: 1.1Max GLES[23] profile version: 3.1
……
遇到的warning(暫未解決,但似乎沒有影響):
dod@qDoDp:~$ gz sim
libEGL warning: failed to open /dev/dri/renderD128: Permission deniedlibEGL warning: failed to open /dev/dri/renderD128: Permission deniedlibEGL warning: NEEDS EXTENSION: falling back to kms_swrast