sea-bass / turtlebot3_behavior_demos

Example repository for autonomous behaviors using TurtleBot3, as well as Docker workflows in ROS based projects.
MIT License
270 stars 53 forks source link

`make sim` fails to render #2

Open trunc8 opened 3 years ago

trunc8 commented 3 years ago

Hi, everything till make term USE_GPU=true worked. make sim gives the following error message:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  38
  Current serial number in output stream:  37
[ INFO] [1622302771.457205900]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1622302771.458421671]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  38
  Current serial number in output stream:  37

System description: Ubuntu 20.04 with Nvidia GTX1650
Neofetch output here

sea-bass commented 3 years ago

Did you first install the NVIDIA Container Toolkit?

https://github.com/NVIDIA/nvidia-docker

And then also enter this:

xhost + local:docker

If that doesn't do it, it might also be an NVIDIA driver version. The bummer about graphics inside Docker is that you now have to depend on your host machine's settings to get things working.

trunc8 commented 3 years ago

Yeah, I have nvidia-container-toolkit installed. I had run the xhost command as well.
nvidia-smi output-

Sat May 29 22:19:30 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.19.01    Driver Version: 465.19.01    CUDA Version: 11.3     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0  On |                  N/A |
| N/A   50C    P8     2W /  N/A |    441MiB /  3903MiB |     14%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1021      G   /usr/lib/xorg/Xorg                 35MiB |
|    0   N/A  N/A      1766      G   /usr/lib/xorg/Xorg                205MiB |
|    0   N/A  N/A      1862      G   alacritty                          10MiB |
|    0   N/A  N/A      2300      G   ...AAAAAAAAA= --shared-files       29MiB |
|    0   N/A  N/A    443038      G   ...AAAAAAAAA= --shared-files      149MiB |
+-----------------------------------------------------------------------------+

nvcc --version output-

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:15:46_PDT_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0

I had designed a Docker environment for ROS that runs on my system. This is my base Dockerfile and this is the docker run command.
I had tried making some minor changes in this repo's Makefile without success. nvidia/cudagl:11.1.1-base-ubuntu20.04 has a version conflict with my CUDA version and might be the culprit.
Only in the context of nvidia drivers, do you feel that my Docker image design might be more generalized or does it have flaws as well?

sea-bass commented 3 years ago

Yeah, I think that may be right... maybe try switch to a base Dockerfile of nvidia/cudagl:11.3.0-base-ubuntu20.04 and see if that does it?

Based on https://hub.docker.com/r/nvidia/cudagl

In the context of your Dockerfile, I think starting with one of the OSRF images (like you do) will certainly make the install easier, but I've personally found it better if you need graphics to start with an NVIDIA Image and then install ROS yourself over that -- in your case, you can follow the standard ROS 2 Foxy installation steps.

trunc8 commented 3 years ago

Nope, that sadly didn't work out. Still the same error.
I then pasted these lines in the dockerfile_nvidia_ros file-

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,display
ADD "https://gitlab.com/nvidia/container-images/vulkan/raw/master/nvidia_icd.json" /etc/vulkan/icd.d/nvidia_icd.json

as these were the only mentions of Nvidia in my Dockerfile. This didn't help either :(