0
$\begingroup$

I have a question about image rendering in headless mode in a cluste.

My task is I want to train a RL agent in the cluster. I use ROS2 and gazebo simulator. Since the algorithm needs to constantly interact with the environment it needs to run gazebo in headless mode. I will need the output from the simulator of RGB images and other information such a odometry for training. What is the best way to achieve this ?

What i have seen so far to run gazebo ros in headless mode i have to run on the gazebo server and not run the gazebo client.

I have access to a Jetson which also has no display like a cluster . So since it was bit of a similar setup like the cluster , i wanted to see if it would work on that before testing on the cluster . I tested by ssh into a NVIDIA Jetson which has a docker container of my code(also including ROS2 and gazebo) and trying to run in headless mode . But the gzserver keeps crashing without giving any specific error even in the debugger mode. It just say it crashes with the :error "[ERROR] [gzserver-1]: process has died [pid 6487, exit code -2, cmd 'gzserver".

But if I run it with the client it does not crash.

The docker container had no issue running gazebo when i testted it on a different Jetson which had a display . So I dont think it is a issue with docker. Im using docker because the cluster doesnt have ROS and gazebo . Also itll allow me to easily duplicate my env

My Dockerfile

FROM ros:foxy

USER root
RUN sudo apt update
RUN sudo apt install locales
RUN  locale-gen en_US en_US.UTF-8
RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
RUN export LANG=en_US.UTF-8

# RUN sudo apt install software-properties-common
# RUN sudo add-apt-repository universe

# RUN apt update && apt upgrade

# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
    ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics



ARG UNAME=foxy_user
ARG WS_DIR=/home/$UNAME/foxy_ws
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -s /bin/bash -N -u $UID $UNAME && \
    adduser $UNAME sudo && \
    echo "$UNAME ALL=(ALL:ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$UNAME && \
    mkdir -p $WS_DIR/src &&\
    chown $UNAME:$GID -R $WS_DIR

USER $UNAME
WORKDIR $WS_DIR/src
WORKDIR $WS_DIR
WORKDIR /home/$UNAME
RUN mkdir src

CMD /bin/bash

my docker-compose

version: "2.0"
services:
    dfki_foxy:
        image: dfki:foxy
        volumes:
            - /tmp/.X11-unix:/tmp/.X11-unix:rw
            - $HOME/.Xauthority:/root/.Xauthority:rw
            - ./../src:/home/humble_user/src
        environment:
            - DISPLAY=$DISPLAY
            - QT_X11_NO_MITSHM=1
            

        # runtime: nvidia
        
        devices:
            - /dev/dri:/dev/dri
        privileged: true
        tty: true
        network_mode: "host"
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.