RViz2 in docker - error while starting
Hi, I'm trying ros2-humble in a docker setup on my m1 mac.
So far, I got a devcontainer running and I can use gui tools like rqt, rqtgraph and that from turtlesimnode (tutorial). I'm therefore using XQuartz (In the xquartz terminal expose the ip: xhost + 192.168.0.114:0) and in the docker container, I'm setting the env variable DISPLAY=192.168.0.114:0 as well. When I start GUI apps, XQuartz automatically opens and works fine!
But not with RViz2. I installed it with sudo apt-get install ros-humble-rviz2
within my running container.
When I try to run with rviz2
or ros2 run rviz2 rviz2
I get the following error message:
[ERROR] [1675002518.131453001] [rviz2]: Failed to create an OpenGL context. BadValue (integer parameter out of range for operation)
[ERROR] [1675002518.131543001] [rviz2]: RenderingAPIException: Unable to create a suitable GLXContext in GLXContext::GLXContext at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GLSupport/src/GLX/OgreGLXContext.cpp (line 60)
[ERROR] [1675002518.131683460] [rviz2]: rviz::RenderSystem: error creating render window: RenderingAPIException: Unable to create a suitable GLXContext in GLXContext::GLXContext at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GLSupport/src/GLX/OgreGLXContext.cpp (line 60)
You should be able to reproduce with:
docker run -it --privileged -e DISPLAY=192.168.0.114:0 -e QT_X11_NO_MITSHM=1 --net=host --name test-rviz2 ros:humble bash
Really appreciate some ideas :) Robin
Asked by robin_rob96 on 2023-01-29 09:50:37 UTC
Answers
Hi. Also using an M1 Mac. I never got the RQT suite of stuff to work very well on Mac via Docker, and barely even well running linux via docker. In general, making 3D work anything but natively can be tricky since different OS's use different drivers to produce 3D content. I would never expect the Xorg 3D stuff to work on Mac.
I switched to Foxgloves suite of visualization tools instead, so far I think it works very well. I was never fond of Rviz anyway. See https://foxglove.dev
Asked by Per Edwardsson on 2023-01-30 08:24:27 UTC
Comments
Thanks, sounds nice!
What is your setup then? Nativ Ros2 installation? In my ros2-humble container i installed the foxglove-bridge and started that node, it outputs:
[foxglove_bridge-1] [INFO] [1675104718.387759591] [foxglove_bridge]: [WS] Server running without TLS
[foxglove_bridge-1] [INFO] [1675104718.388086841] [foxglove_bridge]: [WS] WebSocket server listening at ws://0.0.0.0:8765
But when I try to connect to that adress, nothing connects (in the web view). Is there something I'm missing? Might be due to some port issues or so?
Asked by robin_rob96 on 2023-01-30 13:59:21 UTC
Problem Solved:
turns out --net=host doesn't create the same effect on m1 mac, therefore
expose 8765 (Dockerfile) and maybe port forwarding with -p 8765:8765 is whats needed.
Asked by robin_rob96 on 2023-02-02 10:49:05 UTC
Comments