ROS2仿真问题

ROS错误记录_unable to create the rendering window after 100 tr-CSDN博客

这篇博客说是重新安装显卡驱动;

运行

make px4_sitl gz_x500

 编译完成之后出现界面然后闪退,前面开了3D加速,使用的是虚拟机;

报错信息:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1137]  Unable to create the rendering window: OGRE EXCEPTION(3:RenderingAPIException): OpenGL 3.3 is not supported. Please update your graphics card drivers. in GL3PlusRenderSystem::initialiseContext at ./RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp (line 3434)
[GUI] [Err] [Ogre2RenderEngine.cc:1145] Unable to create the rendering window after [11] attempts.
[GUI] [Err] [Ogre2RenderEngine.cc:1054] Failed to create dummy render window.
[GUI] [Err] [Ogre2RenderEngine.cc:1055] Please see the troubleshooting page for possible fixes: https://gazebosim.org/docs/fortress/troubleshooting
Stack trace (most recent call last):

查看OpenGL版本,先安装sudo apt install mesa-utils

再执行glxinfo | grep version

server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 3.3
    Max compat profile version: 3.3
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 2.0
OpenGL core profile version string: 3.3 (Core Profile) Mesa 23.0.4-0ubuntu1~22.04.1
OpenGL core profile shading language version string: 1.20
OpenGL version string: 3.3 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~22.04.1
OpenGL shading language version string: 1.20
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 23.0.4-0ubuntu1~22.04.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

打开3D加速:

server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 0.0
    Max compat profile version: 2.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 2.0
OpenGL version string: 2.1 Mesa 23.0.4-0ubuntu1~22.04.1
OpenGL shading language version string: 1.20
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 23.0.4-0ubuntu1~22.04.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

如此看来,使用ROS2中gazebo仿真,无法使用VMware17pro的3D加速,因为打开3D加速,OpenGL的版本就变低了,不满足gazebo的要求;暂时没有找到解决办法;

### ROS2 仿真使用教程及配置方法 #### 配置路径与CMake设置 在ROS2环境中,如果遵循特定的配置包结构,则会自动生成配置路径[@bus_config_path@]。此功能通过`CMakeLists.txt`实现自动化构建流程[^1]。因此,在创建新的仿真项目时,需确保项目的CMake脚本已正确定义依赖项及相关参数。 #### 启动文件位置及其作用 项目的核心启动逻辑通常由位于`ros2_execution/`目录下的Python脚本提供支持,例如`ros2_execution.py`。这个脚本的主要职责是初始化仿真环境并按照预定顺序执行一系列动作序列[^2]。开发者可以通过修改该脚本来调整仿真的运行行为。 #### 运行时错误处理 当尝试连接到模拟器时,可能会遇到诸如“RuntimeError: time-out of 2000ms”的异常情况。这表明当前程序未能成功建立与本地主机上监听端口`localhost:2000`的服务之间的通信链接[^3]。解决此类问题的方法包括确认模拟器服务是否已经正常启动以及网络地址和端口号设置是否匹配预期值。 #### 模型重置选项说明 对于某些类型的仿真应用而言,“Reset Model Poses”是一项非常实用的功能。它允许用户将场景内的所有对象恢复至初始状态而无需重新加载整个世界文件[^4]。具体操作方式取决于所使用的图形界面工具或者命令行接口的具体设计。 ```python import rclpy from ros2cli.node.direct import DirectNode from std_srvs.srv import Empty def reset_simulation(): with DirectNode() as node: client = node.create_client(Empty, '/gazebo/reset_world') if not client.wait_for_service(timeout_sec=5.0): raise RuntimeError('Service /gazebo/reset_world unavailable.') request = Empty.Request() future = client.call_async(request) if __name__ == '__main__': rclpy.init() try: reset_simulation() finally: rclpy.shutdown() ``` 上述代码片段展示了一个简单的例子来调用Gazebo中的重置服务。 ---
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值