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
### 安装 ROS Humble 版本Gazebo 相关包 为了正确安装 `ros-humble-gazebo-ros-pkgs` 和 `ros-humble-gazebo-plugins`,可以遵循以下方法: #### 方法一:单独安装指定包 可以通过以下命令分别安装所需的两个包: ```bash sudo apt-get update sudo apt-get install ros-humble-gazebo-ros-pkgs ros-humble-gazebo-plugins ``` 此方式适用于仅需特定功能的情况,并能减少不必要的依赖项被安装[^1]。 #### 方法二:批量安装所有 Gazebo 相关包 如果希望一次性安装所有的 Gazebo 插件及相关工具,则可运行如下命令: ```bash sudo apt install ros-humble-gazebo-* ``` 这种方式会将与 Gazebo 相关的所有 ROS 软件包全部安装上,适合开发环境较为宽松或者硬盘空间充足的场景[^2]。 #### 验证安装成功与否 完成上述任一种操作之后,可通过下面这条指令来验证是否正常加载了插件以及启动示例世界文件: ```bash gazebo /opt/ros/humble/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world ``` 当仿真界面无误弹出并展示移动机器人模型即表明配置恰当[^3]。 #### 处理可能遇到的问题 有时可能会碰到因仓库源未同步最新数据而导致某些特定模式匹配失败的现象,比如尝试通过通配符(*)形式查找却报错找不到对应名称下的项目集合。此时应该先确认官方文档里确切命名规则再执行精确指派下载动作;另外也要注意清理旧版残留影响新版本覆盖更新过程中的干扰因素[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

路飞DoD

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值