Robotics StackExchange | Archived questions

rviz2 does not open in ubuntu 20.04 docker ade image

Hi I am using ubuntu 20.04 and ROS2 foxy distro.

I was using ubuntu 18.04 and ros2 dashing installed automatically by autoware auto repo. Everything was working fine: Lgsvl simulator, rviz2, etc ....

But I needed to upgrade to get the new features. However I tried a fresh install several times, and followed step-by-step from these installation links: 1- https://autowarefoundation.gitlab.io/autoware.auto/AutowareAuto/installation-ade.html 2- https://ade-cli.readthedocs.io/en/latest/install.html 3- https://gitlab.com/ApexAI/autowareclass2020/-/blob/master/lectures/01_DevelopmentEnvironment/devenv.md

In a summarize I have installed Nvidia-driver, nvidia-container-toolkit nvidia-cuda-toolkit and all the required dependencies. The container generates the Autoware Auto images correctly, compile the ros2 packages, etc. Everything is working correctly with excpetion of rviz2 that does not open anymore. Giving the oupt error below:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-autoware-auto'
1615423952.126068 [0]      rviz2: using network interface wlp2s0 (udp/192.168.100.10) selected arbitrarily from: wlp2s0, docker0
dbus[129]: The last reference on a connection was dropped without closing the connection. This is a bug in an application. See dbus_connection_unref() documentation for details.
Most likely, the application was supposed to call dbus_connection_close(), since this is a private connection.
  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)

There are some web-solutions for ros distro installation inside container:

https://answers.ros.org/question/301056/ros2-rviz-in-docker-container/

However in my case I do not know which files to modify exactly because the images comes from the AutowareAuto repo and I do not have the same files in the same structure as the solution above. How can I manage these modifications to fix this problem?

I have already changed the .aderc file and remove the line:

ADEDISABLENVIDIA_DOCKER=false

my .aderc file is below:

export ADE_DOCKER_RUN_ARGS="--cap-add=SYS_PTRACE --net=host -e RMW_IMPLEMENTATION=rmw_cyclonedds_cpp"
export ADE_GITLAB=gitlab.com
export ADE_REGISTRY=registry.gitlab.com
export ADE_IMAGES="
  registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/ade-foxy:master
  registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/binary-foxy:master
"

The Dockerfile inside AutowareAuto/tools/ade_image is below:

ARG ROS_DISTRO=dashing

FROM ros:$ROS_DISTRO
ARG CODENAME=bionic

# Disable non-free repositories
RUN if [ "$(uname -m)" = "x86_64" ]; then \
        echo "\
deb http://archive.ubuntu.com/ubuntu/ ${CODENAME} main universe\n\
deb http://archive.ubuntu.com/ubuntu/ ${CODENAME}-backports main universe\n\
deb http://archive.ubuntu.com/ubuntu/ ${CODENAME}-updates main universe\n\
deb http://security.ubuntu.com/ubuntu/ ${CODENAME}-security main universe\n\
" > /etc/apt/sources.list; \
    else \
        echo "\
deb http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME} main universe\n\
deb http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME}-backports main universe\n\
deb http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME}-updates main universe\n\
deb http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME}-security main universe\n\
" > /etc/apt/sources.list; \
    fi

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
        gettext-base \
        locales \
        keyboard-configuration && \
    rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8; dpkg-reconfigure -f noninteractive locales
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8

RUN echo deb https://deb.nodesource.com/node_10.x ${CODENAME} main | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key 1655A0AB68576280

COPY ros-deps /tmp/
RUN apt-get update && \
    apt-get install -y \
      python3-vcstool \
      ros-$ROS_DISTRO-cyclonedds \
      ros-$ROS_DISTRO-rmw-cyclonedds-cpp && \
    /bin/bash /tmp/ros-deps && \
    rm -rf /var/lib/apt/lists/* /tmp/ros-deps

COPY apt-packages /tmp/
RUN apt-get update && \
    apt-get install -y \
        $(cat /tmp/apt-packages | cut -d# -f1 | envsubst) \
    && rm -rf /var/lib/apt/lists/* /tmp/apt-packages

RUN echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN echo 'Defaults env_keep += "DEBUG ROS_DISTRO"' >> /etc/sudoers


COPY pip3-packages /tmp/
RUN pip3 install -U \
        $(cut -d# -f1 </tmp/pip3-packages) \
    && rm -rf /root/.cache /tmp/pip-* /tmp/pip3-packages


RUN git clone https://github.com/rigtorp/udpreplay && mkdir -p udpreplay/build \
      && cd udpreplay/build && cmake .. && make && make install \
      && cd - && rm -rf udpreplay/


COPY bashrc-git-prompt /
RUN cat /bashrc-git-prompt >> /etc/skel/.bashrc && \
    rm /bashrc-git-prompt
COPY gdbinit /etc/gdb/


# ===================== CLEAN UP ZONE ===================== #
# Commands in the cleanup zone will be cleaned up before every release
# and put into the correct place.
RUN apt-get update \
  && apt-get install -y \
    unzip \
    ca-certificates \
    libx11-6 \
    libxau6 \
    libxcb1 \
    libxdmcp6 \
    libxext6 \
    libvulkan1 \
    libgl1 \
    libgtk2.0-0 \
    vulkan-utils \
  && apt-get clean

ADD "https://gitlab.com/nvidia/container-images/vulkan/raw/master/nvidia_icd.json" /etc/vulkan/icd.d/nvidia_icd.json
RUN chmod 644 /etc/vulkan/icd.d/nvidia_icd.json

# ===================== END OF CLEAN UP ZONE ===================== #

# Do full package upgrade as last step
# to avoid disrupting layer caching
RUN apt-get update && \
    apt-get -y dist-upgrade && \
    rm -rf /var/lib/apt/lists/*

COPY env.sh /etc/profile.d/ade_env.sh
COPY gitconfig /etc/gitconfig
COPY entrypoint /ade_entrypoint
COPY colcon-defaults.yaml /usr/local/etc/colcon-defaults.yaml
RUN echo "export COLCON_DEFAULTS_FILE=/usr/local/etc/colcon-defaults.yaml" >> \
    /etc/skel/.bashrc
ENTRYPOINT ["/ade_entrypoint"]
CMD ["/bin/sh", "-c", "trap 'exit 147' TERM; tail -f /dev/null & wait ${!}"]

I do not understand why in Dockerfile the ROS_DIstro is set to dashing, when actually I have built an image from ROS foxy aderc:

Starting ade with the following images:
ade-foxy    | b882a89112a7 | master | registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/ade-foxy:master   
binary-foxy | 5a7fdd94a7b5 | master | registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/binary-foxy:master
ade_registry.gitlab.com_autowarefoundation_autoware.auto_autowareauto_amd64_binary-foxy_master
non-network local connections being added to access control list

Asked by Vini71 on 2021-03-10 20:13:20 UTC

Comments

I think I encountered something like this with rviz and docker a month or so ago using rocker, but can no longer reproduce this now on rocker, so make sure you're using images built from the latest foxy binaries?

Asked by ruffsl on 2021-03-10 22:07:04 UTC

Hi thanks for the reply. However I have installed from the latest foxy binaries. I also always update ade-cli and the images before enter ade, using sudo ade --start --update. Is there a chance to be other issue? Such set NVidia Gpus, ip, change dockerfile? I am really lost on this topic cause I am not a computer scientist or software engineer, so I do not understand what is going on and what the error means. Do you remember how you fixed please?

Asked by Vini71 on 2021-03-10 22:21:31 UTC

Answers

I found the issue!

For some reason in ubuntu 20.04, rviz2 does not work in the following BOLDED images does not work get from the command: % ls -l .aderc*

.aderc-amd64-dashing

.aderc-amd64-dashing-lgsvl

.aderc-amd64-foxy

.aderc-amd64-foxy-lgsvl

There is some line missing on .aderc configuration file or Dockerfile when these images are built through the command:

$ade --rc .aderc-amd64-dashing start      or     $ade --rc .aderc-amd64-foxy start

Just the images built with lgsvl simulator have the correct code and configuration files written for ubuntu 20.04 that allows rviz2 works. Then it is required to build ros-distro with the lgsvl internal simulator:

ade --rc .aderc-amd64-dashing-lgsvl start
or 
ade --rc .aderc-amd64-foxy-lgsvl start

In my case I am using foxy as it is the most recent ros distro available for ubuntu 20.04.

There is just one way to make rviz2 work without trigger the lgsvl simulator image. It is setting the --privileged flag to build the images:

ade --rc .aderc-amd64-dashing start --privileged
ade --rc .aderc-amd64-foxy start --privileged 
or just
ade start --privileged 

that will start the standard ros-distro image without the lgsvl simulator

However it is not recommended use --privileged flags to run docker for security reasons... This was the way I have worked around to launch rviz2 successfully.

Asked by Vini71 on 2021-03-12 13:32:45 UTC

Comments

ros2 generally didn't run for me not only rviz2,

But your solution worked for me, so thank you.

However ade start --privileged syntax didn't run correctly for me. But this one did: ade start -- --privileged

Asked by omarabdelaziz on 2021-07-17 14:55:04 UTC

Nice I am glad this answer helped you.

Asked by Vini71 on 2021-07-17 22:56:16 UTC