How to use Rviz2 with GPU in jetson docker container?

Currently, I’m trying to use Rviz2 with GPU by settings the following environment variable __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia, however i got these errors on docker container /tmp/.X11-unix and /tmp/.docker.xauth volume mounted.

ai@ubuntu:~$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia rviz2
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ai'
[ERROR] [1756109491.419668382] [rviz2]: rviz::RenderSystem: error creating render window: basic_string::_M_construct null not valid
[ERROR] [1756109491.419858655] [rviz2]: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
[ERROR] [1756109491.419906367] [rviz2]: rviz::RenderSystem: error creating render window: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
[ERROR] [1756109491.419930496] [rviz2]: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
[ERROR] [1756109491.419984576] [rviz2]: rviz::RenderSystem: error creating render window: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)

Does anyone know how to use Rviz2 with gpu? since it use a lot of CPU load.

Currently I’m using Jetpack 5.1.2 (L4T 35.4.1) due to camera driver problem.

1 Like

Hi,

Which device do you use?
Could you share more information about your environment?

Thanks.

1 Like

I have the same problem. In my case, I try to display rviz2 inside Isaac ROS docker container from a remote Jetson AGX Orin machine via SSH in my ubuntu workstation.

I am able to display xclock and xeyes from inside Isaac Ros container in my workstation successfully but cannot make it for rviz2. I got similar error from the post.

Here is my jetson info from jetson_release command:

 - Model: NVIDIA Jetson AGX Orin Developer Kit
 - L4T: 36.4.4
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
 - Module: Check with sudo
Platform:
 - Distribution: Ubuntu 22.04 Jammy Jellyfish
 - Release: 5.15.148-tegra
jtop:
 - Version: 4.3.2
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
 - Service: Inactive
Libraries:
 - CUDA: 12.6.68
 - cuDNN: 9.10.2.21
 - TensorRT: 10.7.0.23
 - VPI: 3.2.4
 - OpenCV: 4.5.4 - with CUDA: NO

Hi, here is my jetson_release

ai@ubuntu:~ $ jetson_release
Software part of jetson-stats 4.3.2 - (c) 2024, Raffaello Bonghi
Model: Jetson AGX Orin Developer Kit - Jetpack 5.1.2 [L4T 35.4.1]
NV Power Mode[3]: MODE_50W
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
 - P-Number: p3701-0005
 - Module: NVIDIA Jetson AGX Orin (64GB ram)
Platform:
 - Distribution: Ubuntu 20.04 Focal Fossa
 - Release: 5.10.120-tegra
jtop:
 - Version: 4.3.2
 - Service: Active
Libraries:
 - CUDA: 12.2.140
 - cuDNN: 1.0
 - TensorRT: 8.5.2.2
 - VPI: 2.3.9
 - Vulkan: 1.3.204
 - OpenCV: 4.5.4 - with CUDA: NO

Hi, both

Please make sure you have launched the container with --runtime nvidia.
This plugin will mount the essential driver to allow the container to access the GPU.

Thanks.

I have already run with nvidia on the /etc/docker/daemon.json by default runtime with nvidia.

i have this docker compose file.

services:
  jetson-moveit:
    image: dockerfiles-jetson:moveit
    build:
      context: .
      dockerfile: Dockerfile.moveit
      args:
        USER_ID: 1000
        GROUP_ID: 1000
    container_name: jetson-gpu-moveit
    runtime: nvidia
    env_file:
      - .env
    environment:
      - DISPLAY=:0
      - QT_X11_NO_MITSHM=1
      - ROS_DOMAIN_ID=${ROS_DOMAIN_ID}
      - XAUTHORITY=/tmp/.docker.xauth
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILITIES=all
      - CUDA_HOME=/usr/local/cuda-12.2
      - PATH=/usr/local/cuda-12.2/bin:$PATH
      - LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64:$LD_LIBRARY_PATH
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix:rw
      - /tmp/.docker.xauth:/tmp/.docker.xauth:rw
      - $HOME/moveit_ws:/home/ai/moveit_ws:rw
      - /dev:/dev:rw
      - $HOME/.bash_history:/home/ai/.bash_history:rw
      - $HOME/.inputrc:/home/ai/.inputrc:rw
    network_mode: host
    privileged: true
    ipc: host
    tty: true
    stdin_open: true
    cap_add:
      - SYS_ADMIN
      - SYS_PTRACE
    restart: always
    shm_size: 8gb

but it still not able to use it./

1 Like

Hi,

Could you try to build our CUDA sample inside the container?

If CUDA can work well inside the container, please check with the container owner to see if they support JetPack 5.1.2.

Or you can find our ROS container below:

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.