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

Rviz crash with exception raised by qt.qpa.screen

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

CH_YZ gravatar image

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

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:

<launch>
    <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"/>
</launch>

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
/home/hcd/ROS_LiDAR/src/LiDAR/detect_core/rviz/config.rviz
__name:=rviz __log:=/home/hcd/.ros/log/053e51c0-f088-11e9-91c8-d0abd582c8c3/rviz-4.log].
log file:
/home/hcd/.ros/log/053e51c0-f088-11e9-91c8-d0abd582c8c3/rviz-4*.log

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
1

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

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

Comments

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 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 959 times

Last updated: Oct 17 '19