Windows用户劝退篇!建议使用Linux/Mac操作Docker。。。
问题:执行命令显示
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: xcb, eglfs, minimal, minimalegl, offscreen, vnc
原因参考:https://www.cnblogs.com/larva-zhh/p/10531824.html
PS:Docker原生支持Linux而非Windows,所以如非必要能用Linux就不要用Windows了。
在Linux/Mac终端上启动docker:
docker run -itd --rm --net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name ROS2 osrf/ros:iron-desktop
在终端测试:
docker exec -it ROS2 /ros_entrypoint.sh bash
ros2 run turtlesim turtlesim_node