Rviz from docker container on Nvidia Jetson AGX Xavier

asked 2020-06-03 09:51:27 -0500

THordijk gravatar image

updated 2020-06-04 07:32:59 -0500

gvdhoorn gravatar image

OS: L4T ROS Melodic

Currently we are trying to start Rviz from a docker container on a Jetson AGX Xavier running Linux 4 Tegra.

I have been able start Rviz on a Ubuntu 18.04 system in the same docker container and now need this ported for the Jetson.

I used method 2.3 on http://wiki.ros.org/docker/Tutorials/GUI on the ubuntu system and was hoping this would also work for the Jetson however when trying to run RVIZ I get the following error code:

 [RosLogListener::messageLogged]: OGRE EXCEPTION(3:Rendering
                   ~  APIException): Unable to create a suitable GLXContext in 
                   ~  GLXContext::GLXContext at /build/ogre-1.9-i02lBV/ogre-1.9-
                   ~  1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)

both systems have the same ogre libraries installed.

Is this maybe something anyone here is familiar with? Should I actually be asking Nvidia?

Addition, weirdly enough the ability to launch rviz from docker was a one time thing.

The run command I use is

docker run -it \
    --user=$(id -u $USER):$(id -g $USER) \
    --env="DISPLAY" \
    --workdir="/home/$USER" \
    --volume="/home/$USER:/home/$USER" \
    --volume="/etc/group:/etc/group:ro" \
    --volume="/etc/passwd:/etc/passwd:ro" \
    --volume="/etc/shadow:/etc/shadow:ro" \
    --volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
    --net=host [MyDockerImage]

The dockerfile goes as follows

 # Use the official image as a parent image.
FROM ros:melodic-robot

RUN rm -rf /var/lib/apt/lists/

# Set up Conan for Kinova Kortex
RUN apt-get update \
    && apt-get install -y python3 python3-pip \
    && python3 -m pip install conan \
    && conan config set general.revisions_enabled=1 \
    && conan profile new default --detect > /dev/null \
    && conan profile update settings.compiler.libcxx=libstdc++11 default\
    && rm -rf /var/lib/apt/lists/

# Acquire ROS dependencies
RUN mkdir -p catkin_ws/src \
    && cd catkin_ws/src \
    && apt-get update \
    && apt-get install -y ros-melodic-rqt ros-melodic-rqt-common-plugins\
    && apt-get install -y ros-melodic-realsense2-camera \
    && apt-get install -y ros-melodic-rosmon \
    && git clone https://github.com/Kinovarobotics/ros_kortex.git \
#    && git clone https://github.com/ros/dynamic_reconfigure.git \
#    && git clone https://github.com/pal-robotics/ddynamic_reconfigure.git \
    && git clone https://github.com/tue-robotics/wire.git\
    && git clone https://github.com/ros-drivers/joystick_drivers.git\
    && cd .. \
    && rosdep install --from-paths src --ignore-src -y\
    && rm -rf /var/lib/apt/lists/

# Add tools
RUN apt-get update \
    && apt-get install -y iputils-ping \
    && apt-get install -y net-tools \
    && rm -rf /var/lib/apt/lists/

# Replace the kinova CMakeList.txt with the adjusted version for ARM processors
#RUN rm catkin_ws/src/ros_kortex/kortex_driver/CMakeLists.txt
#COPY CMakeLists.txt catkin_ws/src/ros_kortex/kortex_driver/ 

# Custom package
# COPY <host dir> to <container dir>
COPY /autonomous-apple-picker /catkin_ws/src/autonomous-apple-picker

# Build ROS
RUN apt-get update \
    && apt-get upgrade -y \
    && rosdep update \
    && rosdep install --from-paths catkin_ws/src --ignore-src -y \
    && /bin/bash -c '. /opt/ros/melodic/setup.bash; cd catkin_ws/; catkin_make_isolated;' \
    && rm -rf /var/lib/apt/lists/

RUN  /bin/bash -c "echo 'source /catkin_ws/devel_isolated/setup ...
edit retag flag offensive close merge delete


Your going to need to add more info on how to reproduce the issues that just the stdout of the error code for anyone to help. E.g. your Dockerfile/image, the docker run arguments, etc. I'm also not sure the stuff like nvidia-docker works on anything other than amd64, so that amy limit the use of any hardware acceleration.

ruffsl gravatar image ruffsl  ( 2020-06-03 13:44:37 -0500 )edit

I modified my question to show the dockerfile and the run command, aside from that the system is clean.

THordijk gravatar image THordijk  ( 2020-06-04 07:00:27 -0500 )edit

First thing I would recommend: start with the minimal image to test whether you can start UI applications inside a container on your Tegra.

So don't build anything else: get rid of the Kinova stuff, building your autonomous-apple-picker packages, Torch, etc.

Try to run Rviz from a osrf/ros:melodic-desktop-full image.

If that already doesn't work, none of the other stuff will matter at this time.

And to echo @ruffsl's comment: I would suggest to look at how "other people" start Docker containers with UI applications on Tegra systems.

There's nothing really ROS-specific about this. RViz is "just a Qt application" which happens to have an embedded OGRE/OpenGL window.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-04 07:31:39 -0500 )edit