Closed AngryTurtle2 closed 3 months ago
Yes Yes!!!✌
I finally finally find a solution after two days hard working.
To those man who suffer same quesiton, I now post an answer.
It's all about Containerizing GUI applications with WSLg
Thanks for rr-robot post an issue about WSL2 + Docker + OpenGL + NVIDIA not working (uses llvmpipe) and give the solution.
Now run the container with following command:
docker run --name test -v /tmp/.X11-unix:/tmp/.X11-unix \
-v /mnt/wslg:/mnt/wslg \
-e DISPLAY=unix$DISPLAY \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
--device=/dev/dxg \
-v /usr/lib/wsl:/usr/lib/wsl \
-it --gpus all --device /dev/dri:/dev/dri --privileged \
-v /dev:/dev -e NVIDIA_DRIVER_CAPABILITIES=all \
-e LD_LIBRARY_PATH=/usr/lib/wsl/lib \
--net=host osrf/ros:jazzy-desktop-full /bin/bash
The additional part:
-v /mnt/wslg:/mnt/wslg \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
--device=/dev/dxg \
-v /usr/lib/wsl:/usr/lib/wsl \
-e LD_LIBRARY_PATH=/usr/lib/wsl/lib \
In this case:
the container simulate the prius example in gz sim quick start faster.
Now the camera fps is about 62.
The output from nvidia-smi covers the two processess named "ruby" relates to simulator.
Here is My origin answer in Robtics StackExchange: gazebo-not-use-nvidia-gpu-when-i-installed-ros2-jazzy-by-using-docker-desktop-on-Windows wsl2
Now I shou close the issue....
Hello everyone.
I set up wsl2 ubuntu on windows, and then install docker desktop.
With docker desktop, I pull the image osrf/ros:jazzy-desktop-full
I run the container by following command
The container is perfect in wsl, rviz2 can show up, gazebo can show up, except one thing that gazebo simulation too slow.
I check the ouput from nvidia-smi, there is not process about gazebo.
In wsl2 ubuntu terminal, nvidia-smi is available.
And I have tried to install gazebo harmonic on wsl2 Ubuntu .
gz sim
and select the pruis example in quick start. The camera fps is about 60. And there are two process named "ruby" in the nvidia-smi output.In container terminal, nvidia-smi is available too.
run the same project, the camera fps is about 10. nvidia-smi output is nothing about simulation.
Are there any steps I missed or wrong? How do I setup the correct enviroment?
My Computer And My Env Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz 2.90 GHz Windows 10 22H2
Here is a question I post in Robotics StackExchange gazebo-not-use-nvidia-gpu-when-i-installed-ros2-jazzy-by-using-docker-desktop-on