ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Rviz crash with exception raised by qt.qpa.screen

asked 2019-10-16 22:20:06 -0500

CH_YZ gravatar image

updated 2019-10-17 03:58:57 -0500

gvdhoorn gravatar image

It's a really weird problem. When I'm trying to launch my launch file using the terminal embedded in VIsual Studio Code, I got an error called "qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display." But rviz seems totally OK while using the vanilla terminal.

Part of my launch file is shown below:

    <node type="rviz" name="rviz" pkg="rviz" args=" $(find detect_core)/rviz/config.rviz" />
    <node pkg="detect_core" type="detect_core_node" name="detect_core_node" output="screen"/>

When I launch this file in VSCode, it shows the following message while all the other processes works normally:

qt.qpa.screen: QXcbConnection: Could not connect to display  Could not connect to any X display.
[rviz-4] process has died [pid 2702, exit code 1, cmd /opt/ros/melodic/lib/rviz/rviz
__name:=rviz __log:=/home/hcd/.ros/log/053e51c0-f088-11e9-91c8-d0abd582c8c3/rviz-4.log].
log file:

But when I launch rviz directly from terminal, it works perfectly fine.

(base) <font color="#8AE234"><b>hcd@hcd-PC</b></font>:<font color="#729FCF"><b>~</b></font>$ rviz
[ INFO] [1571281807.940736481]: rviz version 1.13.4
[ INFO] [1571281807.940797989]: compiled against Qt version 5.9.5
[ INFO] [1571281807.940823596]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1571281807.944071605]: Forcing OpenGl version 0.
[ INFO] [1571281808.422031984]: Stereo is NOT SUPPORTED
[ INFO] [1571281808.422139032]: OpenGl version: 4.6 (GLSL 4.6).

Thank you for your help~~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-17 03:30:04 -0500

gvdhoorn gravatar image

Seems like it that for some reason rviz cannot contact the X server from "within" your VSCode terminal.

Could be that the DISPLAY environment variable isn't set, or some other bit of configuration is missing.

edit flag offensive delete link more


Yes, I've just solved this problem simply by setting the correct DISPLAY environment variable. Many thanks for your comment~~

CH_YZ gravatar image CH_YZ  ( 2019-10-17 03:57:40 -0500 )edit

Question Tools



Asked: 2019-10-16 22:18:49 -0500

Seen: 841 times

Last updated: Oct 17 '19