我在为大学做一个项目。我们必须使用Docker容器化Gazebo模拟。
在研究如何做到这一点时,我偶然发现了这个链接,并尝试运行其中显示的模拟。如果它工作,我想我们可以改变一些东西,使它为我们的项目工作。这是详细介绍我尝试运行的模拟的链接:https://docs.aws.amazon.com/robomaker/latest/dg/run-hello-world-ros-2.html
复制我们尝试做的事情所需的所有代码都可以在亚马逊AWS指南中找到,所以我不会在这里粘贴它的大部分。
关于我们正在使用的系统和技术的一些信息:
- 操作系统:Ubuntu 20.04
- 露台11
- ROS2 Foxy
- NVIDIA GeForce RTX 2070与版本510驱动程序
模拟分为3个图像,Base,RobotApp和SimulationApp。然后我们运行两个应用程序图像。当使用示例中给出的命令“docker run”时,第一个命令创建了一个旋转对象,并且似乎工作得很好。
第一个Docker命令:
docker run -it -e DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ --name robot_app \
-u robomaker -e ROBOMAKER_GAZEBO_MASTER_URI=http://localhost:5555 \
-e ROBOMAKER_ROS_MASTER_URI=http://localhost:11311 \
helloworldsampleappros2foxygazebo11robotapp:latest
第二个Docker命令:
docker run -it -e DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ --name sim_app \
-u robomaker -e ROBOMAKER_GAZEBO_MASTER_URI=http://localhost:5555 \
-e ROBOMAKER_ROS_MASTER_URI=http://localhost:11311 \
helloworldsampleappros2foxygazebo11simapp:latest
第二个给了我这个错误消息沿着一些警告:
[gzserver-1] libGL error: No matching fbConfigs or visuals found
[gzserver-1] libGL error: failed to load driver: swrast
以下是运行第二个Docker命令时打印到控制台的所有消息:
ROS_VERSION=2
NVIDIA_VISIBLE_DEVICES=all
GAZEBO_MASTER_URI=http://localhost:11345
ROS_PYTHON_VERSION=3
HOSTNAME=0ff33fe3f61a
ROBOMAKER_GAZEBO_MASTER_URI=http://localhost:5555
PWD=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws
NVIDIA_DRIVER_CAPABILITIES=graphics, display
ROBOMAKER_ROS_MASTER_URI=http://localhost:11311
HOME=/home/robomaker
GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:
LANG=C.UTF-8
GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
AMENT_PREFIX_PATH=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/turtlebot3_description_reduced_mesh:/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/hello_world_simulation:/opt/ros/foxy
CMAKE_PREFIX_PATH=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/turtlebot3_description_reduced_mesh:/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/hello_world_simulation
GAZEBO_RESOURCE_PATH=/usr/share/gazebo-11:
COLCON_PREFIX_PATH=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install
PYTHONPATH=/opt/ros/foxy/lib/python3.8/site-packages
TERM=xterm
DISPLAY=:1
SHLVL=1
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/foxy/opt/yaml_cpp_vendor/lib:/opt/ros/foxy/opt/rviz_ogre_vendor/lib:/opt/ros/foxy/lib/x86_64-linux-gnu:/opt/ros/foxy/lib:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:
ROS_LOCALHOST_ONLY=0
LC_ALL=C.UTF-8
GAZEBO_MODEL_PATH=/usr/share/gazebo-11/models:
PATH=/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DEBIAN_FRONTEND=noninteractive
ROS_DISTRO=foxy
QT_X11_NO_MITSHM=1
OGRE_RESOURCE_PATH=/usr/lib/x86_64-linux-gnu/OGRE-1.9.0
OLDPWD=/
_=/usr/bin/printenv
[INFO] [launch]: All log files can be found below /home/robomaker/.ros/log/2022-02-04-12-17-26-791225-0ff33fe3f61a-39
[INFO] [launch]: Default logging verbosity is set to INFO
/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/turtlebot3_description_reduced_mesh/share/turtlebot3_description_reduced_mesh/launch/spawn_turtlebot.launch.py:61: UserWarning: The parameter 'node_executable' is deprecated, use 'executable' instead
Node(
[INFO] [gzserver-1]: process started with pid [41]
[INFO] [spawn_entity.py-2]: process started with pid [43]
[spawn_entity.py-2] [INFO] [1643977047.395921509] [spawn_entity]: Spawn Entity started
[spawn_entity.py-2] [INFO] [1643977047.396308383] [spawn_entity]: Loading entity XML from file /home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/turtlebot3_description_reduced_mesh/share/turtlebot3_description_reduced_mesh/urdf/turtlebot3_waffle_pi.urdf
[spawn_entity.py-2] [INFO] [1643977047.398652203] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-2] [INFO] [1643977047.399013641] [spawn_entity]: Waiting for service /spawn_entity
[gzserver-1] libGL error: No matching fbConfigs or visuals found
[gzserver-1] libGL error: failed to load driver: swrast
[spawn_entity.py-2] [INFO] [1643977047.904187249] [spawn_entity]: Calling service /spawn_entity
[gzserver-1] [WARN] [1643977048.247457510] [rcl]: Found remap rule '~/out:=imu'. This syntax is deprecated. Use '--ros-args --remap ~/out:=imu' instead.
[gzserver-1] [INFO] [1643977048.250959996] [turtlebot3_imu]: <initial_orientation_as_reference> is unset, using default value of false to comply with REP 145 (world as orientation reference)
[gzserver-1] [WARN] [1643977048.251600689] [rcl]: Found remap rule '~/out:=imu'. This syntax is deprecated. Use '--ros-args --remap ~/out:=imu' instead.
[spawn_entity.py-2] [INFO] [1643977048.335266898] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [robot]
[gzserver-1] [WARN] [1643977048.341230833] [rcl]: Found remap rule '~/out:=scan'. This syntax is deprecated. Use '--ros-args --remap ~/out:=scan' instead.
[gzserver-1] [WARN] [1643977048.344790289] [rcl]: Found remap rule '~/out:=scan'. This syntax is deprecated. Use '--ros-args --remap ~/out:=scan' instead.
[INFO] [spawn_entity.py-2]: process has finished cleanly [pid 43]
[gzserver-1] [INFO] [1643977048.476454488] [turtlebot3_diff_drive]: Wheel pair 1 separation set to [0.287000m]
[gzserver-1] [INFO] [1643977048.476502091] [turtlebot3_diff_drive]: Wheel pair 1 diameter set to [0.066000m]
[gzserver-1] [INFO] [1643977048.477502575] [turtlebot3_diff_drive]: Subscribed to [/cmd_vel]
[gzserver-1] [INFO] [1643977048.478593142] [turtlebot3_diff_drive]: Advertise odometry on [/odom]
[gzserver-1] [INFO] [1643977048.479685530] [turtlebot3_diff_drive]: Publishing odom transforms between [odom] and [base_footprint]
[gzserver-1] [WARN] [1643977048.487264720] [rcl]: Found remap rule '~/out:=joint_states'. This syntax is deprecated. Use '--ros-args --remap ~/out:=joint_states' instead.
[gzserver-1] [INFO] [1643977048.490953326] [turtlebot3_joint_state]: Going to publish joint [wheel_left_joint]
[gzserver-1] [INFO] [1643977048.490991604] [turtlebot3_joint_state]: Going to publish joint [wheel_right_joint]
[gzserver-1] [WARN] [1643977048.491042853] [rcl]: Found remap rule '~/out:=joint_states'. This syntax is deprecated. Use '--ros-args --remap ~/out:=joint_states' instead.
在此之后,我遵循最后一组指令:
# Enable access to X server to launch Gazebo from docker container
$ xhost +
# Check that the robot_app and sim_app containers are running. The command should list both containers
$ docker container ls
# Connect to the sim app container
$ docker exec -it sim_app bash
# Launch Gazebo from within the container
$ /home/robomaker/simulation-entrypoint.sh ros2 launch gazebo_ros gzclient.launch.py
并得到以下错误:
[gzclient -1] libGL error: No matching fbConfigs or visuals found
[gzclient -1] libGL error: failed to load driver: swrast
[gzclient -1] libGL error: No matching fbConfigs or visuals found
[gzclient -1] libGL error: failed to load driver: swrast
[gzclient -1] Segmentation fault (core dumped)
[ERROR] [gzclient -1]: process has died [pid 156, exit code 139, cmd 'gzclient '].
以下是运行上述命令时打印到控制台的所有消息:
ROS_VERSION=2
NVIDIA_VISIBLE_DEVICES=all
GAZEBO_MASTER_URI=http://localhost:11345
ROS_PYTHON_VERSION=3
HOSTNAME=0ff33fe3f61a
ROBOMAKER_GAZEBO_MASTER_URI=http://localhost:5555
PWD=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws
NVIDIA_DRIVER_CAPABILITIES=graphics, display
ROBOMAKER_ROS_MASTER_URI=http://localhost:11311
HOME=/home/robomaker
GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:
LANG=C.UTF-8
GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
AMENT_PREFIX_PATH=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/turtlebot3_description_reduced_mesh:/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/hello_world_simulation:/opt/ros/foxy
CMAKE_PREFIX_PATH=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/turtlebot3_description_reduced_mesh:/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install/hello_world_simulation
GAZEBO_RESOURCE_PATH=/usr/share/gazebo-11:
COLCON_PREFIX_PATH=/home/robomaker/workspace/aws-robomaker-sample-application-helloworld-ros2/simulation_ws/install
PYTHONPATH=/opt/ros/foxy/lib/python3.8/site-packages
TERM=xterm
DISPLAY=:1
SHLVL=2
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/foxy/opt/yaml_cpp_vendor/lib:/opt/ros/foxy/opt/rviz_ogre_vendor/lib:/opt/ros/foxy/lib/x86_64-linux-gnu:/opt/ros/foxy/lib:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:
ROS_LOCALHOST_ONLY=0
LC_ALL=C.UTF-8
GAZEBO_MODEL_PATH=/usr/share/gazebo-11/models:
PATH=/opt/ros/foxy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DEBIAN_FRONTEND=noninteractive
ROS_DISTRO=foxy
QT_X11_NO_MITSHM=1
OGRE_RESOURCE_PATH=/usr/lib/x86_64-linux-gnu/OGRE-1.9.0
OLDPWD=/
_=/usr/bin/printenv
[INFO] [launch]: All log files can be found below /home/robomaker/.ros/log/2022-02-04-12-17-58-244883-0ff33fe3f61a-124
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzclient -1]: process started with pid [156]
[gzclient -1] libGL error: No matching fbConfigs or visuals found
[gzclient -1] libGL error: failed to load driver: swrast
[gzclient -1] libGL error: No matching fbConfigs or visuals found
[gzclient -1] libGL error: failed to load driver: swrast
[gzclient -1] Segmentation fault (core dumped)
[ERROR] [gzclient -1]: process has died [pid 156, exit code 139, cmd 'gzclient '].
也就是说,我们花了几个小时检查每一个帖子,试图解决这个问题:
[gzserver-1] libGL error: No matching fbConfigs or visuals found
[gzserver-1] libGL error: failed to load driver: swrast
但还是不行我们尝试重新安装NVIDIA驱动程序,发现了一堆关于一些梅萨驱动程序的帖子,这些驱动程序给予此错误,但我检查了一下,我的驱动程序文件下没有梅萨。这是论坛:https://askubuntu.com/questions/834254/steam-libgl-error-no-matching-fbconfigs-or-visuals-found-libgl-error-failed-t
这是我运行sudo ldconfig -p | grep -i gl.so
后得到的结果:
libwayland-egl.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libwayland-egl.so.1
libcogl.so.20 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcogl.so.20
libQt5OpenGL.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libQt5OpenGL.so.5
libQt5OpenGL.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libQt5OpenGL.so
libOpenGL.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libOpenGL.so.0
libOpenGL.so.0 (libc6) => /lib/i386-linux-gnu/libOpenGL.so.0
libOpenGL.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libOpenGL.so
libGL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libGL.so.1
libGL.so.1 (libc6) => /lib/i386-linux-gnu/libGL.so.1
libGL.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libGL.so
libEGL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libEGL.so.1
libEGL.so.1 (libc6) => /lib/i386-linux-gnu/libEGL.so.1
libEGL.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libEGL.so
我们还认为,也许我们在Dockerfile中缺少了openGL或类似的东西,所以我们试图让硬件加速工作,按照这里的说明:http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration,所以我们尝试安装nvidia-docker 2。
如果我们运行nvidia-docker version
,我们得到:
NVIDIA Docker: 2.8.0
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:45:33 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:42 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
我们遵循这里提供的说明:https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html设置环境变量,我们需要控制哪些库将安装在容器中。
由于我们的错误似乎表明,OpenGL是失踪,我补充说,
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics, display
第一个Dockerfile graphics
是openGL所必需的,display
是x11显示所必需的(我认为我们使用它,因为它的一些内容写在原始Dockerfile中,但我不确定)。
在所有这些和更多之后,我们仍然会得到这些错误。
1条答案
按热度按时间e37o9pze1#
我知道这对你的大学项目来说太晚了,但我发现工作是use NVIDIA's official graphics image