在 Ubuntu 22.04 上运行 ROS2turtlesim:“qt.qpa.xcb:无法连接到显示器”

问题描述 投票:0回答:1

我尝试在 Windows 11 上的 Ubuntu 22.04.3 上使用 ROS2 Humble,当我尝试运行“ros2 runturtlesimturtlesim_node”时,我收到以下消息:

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

[ros2run]: Aborted

enter image description here

我是否缺少一个包裹?我一直在关注this document来安装必要的软件包,并且我尝试用谷歌搜索这个问题,但没有任何帮助。我对 Linux 还很陌生,所以非常感谢您的帮助或指导!

linux ubuntu ros ros2
1个回答
0
投票

如果您在 Windows 上运行 Ubuntu,我假设您正在使用 WSL2。问题是 WSL2(或 Docker)没有桌面/GUI,因此默认情况下您无法运行任何图形应用程序。为此,您需要某种 XServer(或 Docker 的特殊设置)。

这里是 WSL2 GUI 的链接,可帮助您步入正轨。我喜欢使用 MobaXTerm 中内置的 Xserver。

以及 Docker GUI 的链接

或者,您可以使用虚拟机,或者如果您有磁盘空间和动力,可以使用虚拟机,甚至更好,可以在 Ubuntu 上进行双启动并本地运行 ROS

© www.soinside.com 2019 - 2024. All rights reserved.