nvidia-docker容器中的rViz

时间:2019-12-18 08:45:09

标签: docker nvidia ros nvidia-docker

我设置了一堆ros节点,每个节点在docker容器中运行,并通过docker-compose启动。除了rviz速度很慢之外,因为它仅在cpu上运行,因此在笔记本电脑上运行它没有任何问题。现在,我将项目移至在ubuntu18.04LTS上具有nVidia RTX2080的计算机上,并且相同的设置会产生这些错误。我已经安装了nvidia-docker2,并且daemon.json将默认运行时设置为nvidia。我真的不知道从哪里开始寻找错误。我发现的帖子已关闭,无法解决我的问题。

如何使rViz在nVidia-docker2中运行?

rviz_1           | libGL error: No matching fbConfigs or visuals found
rviz_1           | libGL error: failed to load driver: swrast
rviz_1           | libGL error: No matching fbConfigs or visuals found
rviz_1           | libGL error: failed to load driver: swrast
rviz_1           | libGL error: No matching fbConfigs or visuals found
rviz_1           | libGL error: failed to load driver: swrast
rviz_1           | [ INFO] [1576658065.533954900]: rviz version 1.13.6
rviz_1           | [ INFO] [1576658065.534009692]: compiled against Qt version 5.9.5
rviz_1           | [ INFO] [1576658065.534021481]: compiled against OGRE version 1.9.0 (Ghadamon)
rviz_1           | [ INFO] [1576658065.548489531]: Forcing OpenGl version 0.
rviz_1           | [ WARN] [1576658065.859692866]: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
rviz_1           | rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
rviz_1           | rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)

2 个答案:

答案 0 :(得分:0)

我今天真的遇到了同样的问题。我在CPU笔记本电脑上的docker中测试了rviz,一切正常,直到我在GPU加速的硬件上测试了设置。我已经能够使用http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration在“ nvidia-docker2”下提出的解决方案来解决这个问题。

显然,您需要使用环境变量“ NVIDIA_VISIBLE_DEVICES”和“ NVIDIA_DRIVER_CAPABILITIES”构建映像,并使用runtime = nvidia运行容器。希望这会有所帮助。

答案 1 :(得分:0)

请参见http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration
Nvidia docker映像需要自己构建。

$ cd path/to/dir
$ cat Dockerfile
FROM your-repo/your-image:your-tag
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
    ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
$ docker build -t your-nvidia-image .
$ xhost +local:
$ docker run --gpus all -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY your-nvidia-image /bin/bash