Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

WSL上のROSがQtのプラグイン初期化ができない云々で怒り始めたら、DISPLAY変数を疑うといいかもしれない

実際のところ

$ roslaunch xarm_description xarm7_rviz_display.launch
...
process[rviz-4]: started with pid [8059]
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.

[rviz-4] process has died [pid 8059, exit code -6, cmd /opt/ros/noetic/lib/rviz/rviz -d /home/mtmshirono/catkin_ws/src/xarm_ros/xarm_description/launch/display.rviz __name:=rviz __log:=/home/mtmshirono/.ros/log/b93e14d8-0b09-11ec-9d6f-98af652cba8b/rviz-4.log].
log file: /home/mtmshirono/.ros/log/b93e14d8-0b09-11ec-9d6f-98af652cba8b/rviz-4*.log

これを額面通りに受け取っているとダメです。
要は外部出力ができてないといってるので、DISPLAYの設定問題です。
というわけで

$ DISPLAY=:0 roslaunch xarm_description xarm7_rviz_display.launch

としてやれば動きます。