introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.71k stars 775 forks source link

rtab map not running on jetson nano 2gb #776

Open CarlosSosaJN opened 2 years ago

CarlosSosaJN commented 2 years ago

Installed acording to procedure in https://github.com/introlab/rtabmap/wiki/Installation#rtab-map-desktop-ubuntu-1804-2004.

OS: Ubuntu 18.04 System: Jetson nano 2Gb

i get this:

docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination:: Type:bind Source:/var/lib/docker/volumes/60c3e5389f25f6f62dd663626cb6d85f8a2e1887498ec05ef6c1b05960c43a40/_data Options:[rbind]}: mount destination

What next?

matlabbe commented 2 years ago

I tried with latest jetpack 4.6 on a nano 4GB and I have a different error. The docker is starting, but rtabmap has a seg fault on start. First, to avoid this error:

rtabmap: error while loading shared libraries: libnvrm.so: cannot open shared object file: No such file or directory

We should add /usr/lib/aarch64-linux-gnu/tegra to Dockerfile:

FROM introlab3it/rtabmap:bionic

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

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/aarch64-linux-gnu/tegra

Build:

docker build -t rtabmap3d .

Then when launching with (following this):

$ docker run -it --rm  \
  --privileged  \
   --env="DISPLAY=$DISPLAY"  \
   --env="QT_X11_NO_MITSHM=1" \
   --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
   --env="XAUTHORITY=$XAUTH" \
   --volume="$XAUTH:$XAUTH"  \
   --runtime=nvidia    rtabmap3d    rtabmap
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile

We can see the "R" logo on start, then it closes. Looking at gdb:

FROM introlab3it/rtabmap:bionic

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

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/aarch64-linux-gnu/tegra

RUN apt install gdb -y

Build:

docker build -t rtabmap3d .

Run with gdb :

docker run -it --rm  \
   --privileged \
   --env="DISPLAY=$DISPLAY"  \
   --env="QT_X11_NO_MITSHM=1"  \
   --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw"  \
   --env="XAUTHORITY=$XAUTH"  \
   --volume="$XAUTH:$XAUTH" \
   --runtime=nvidia    rtabmap3d    gdb --args rtabmap

Type "run", wait the crash then type "bt":

(gdb) run
Starting program: /usr/local/bin/rtabmap 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fa0bc8d50 (LWP 35)]
[New Thread 0x7fa03c7d50 (LWP 36)]
[New Thread 0x7f9fbc6d50 (LWP 37)]
[New Thread 0x7f9f3c5d50 (LWP 38)]
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[New Thread 0x7f9e53fd50 (LWP 39)]
libEGL warning: DRI2: failed to authenticate
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
BFD: warning: /usr/lib/aarch64-linux-gnu/libLLVM-10.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
[New Thread 0x7f9c8e3d50 (LWP 40)]
[New Thread 0x7f9415bd50 (LWP 41)]
[New Thread 0x7f9395ad50 (LWP 42)]
[New Thread 0x7f93159d50 (LWP 43)]
[New Thread 0x7f92958d50 (LWP 44)]
[New Thread 0x7f92157d50 (LWP 45)]
[New Thread 0x7f91956d50 (LWP 46)]
[New Thread 0x7f91155d50 (LWP 47)]
[New Thread 0x7f90853d50 (LWP 48)]
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
[New Thread 0x7f6be2ed50 (LWP 49)]

Thread 1 "rtabmap" received signal SIGSEGV, Segmentation fault.
0x0000007f6b55a744 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libGLX_nvidia.so.0
(gdb) bt
#0  0x0000007f6b55a744 in  () at /usr/lib/aarch64-linux-gnu/tegra/libGLX_nvidia.so.0
#1  0x0000007f6b587e28 in  () at /usr/lib/aarch64-linux-gnu/tegra/libGLX_nvidia.so.0
#2  0x0000007fa63097e4 in glXCreateContext () at /usr/lib/aarch64-linux-gnu/libGLX.so.0
#3  0x0000007fb44f28dc in vtkXOpenGLRenderWindow::CreateAWindow() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingOpenGL-6.3.so.6.3
#4  0x0000007fb44efbac in vtkXOpenGLRenderWindow::WindowInitialize() ()
    at /usr/lib/aarch64-linux-gnu/libvtkRenderingOpenGL-6.3.so.6.3
#5  0x0000007fb44efacc in vtkXOpenGLRenderWindow::Start() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingOpenGL-6.3.so.6.3
#6  0x0000007fb3f3b3e4 in vtkRenderWindow::DoStereoRender() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingCore-6.3.so.6.3
#7  0x0000007fb3f3d620 in vtkRenderWindow::DoFDRender() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingCore-6.3.so.6.3
#8  0x0000007fb3f3e4b8 in vtkRenderWindow::DoAARender() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingCore-6.3.so.6.3
#9  0x0000007fb3f3ce08 in vtkRenderWindow::Render() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingCore-6.3.so.6.3
#10 0x0000007fb44f532c in vtkXOpenGLRenderWindow::Render() () at /usr/lib/aarch64-linux-gnu/libvtkRenderingOpenGL-6.3.so.6.3
#11 0x0000007fb7d5c678 in rtabmap::CloudViewer::setCameraPosition(float, float, float, float, float, float, float, float, float) ()
    at /usr/local/lib/librtabmap_gui.so.0.20
#12 0x0000007fb7d6003c in rtabmap::CloudViewer::CloudViewer(QWidget*, rtabmap::CloudViewerInteractorStyle*) ()
    at /usr/local/lib/librtabmap_gui.so.0.20
#13 0x0000007fb7bc27f0 in rtabmap::MainWindow::MainWindow(rtabmap::PreferencesDialog*, QWidget*, bool) ()
    at /usr/local/lib/librtabmap_gui.so.0.20
#14 0x000000555555c754 in main ()

Similar error with the introlab3it/rtabmap:focal image too. I tried the same thing on my laptop and rtabmap starts correctly. I checked on the internet about similar errors, then saw this issue: https://github.com/OE4T/meta-tegra/discussions/734

It seems adding --network host to docker run fixes the problem. So the final solution based on dockerfile above:

 # those following 3 lines would need to be done only one time
 $ export XAUTH=/tmp/.docker.xauth
 $ touch $XAUTH
 $ xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -

docker run -it --rm  \
   --privileged \
   --env="DISPLAY=$DISPLAY"  \
   --env="QT_X11_NO_MITSHM=1"  \
   --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw"  \
   --env="XAUTHORITY=$XAUTH"  \
   --volume="$XAUTH:$XAUTH" \
   --runtime=nvidia  \
   --network host \
   rtabmap3d    rtabmap

I updated the instructions on this page: https://github.com/introlab/rtabmap/wiki/Installation#rtab-map-desktop-ubuntu-1804-2004 Screenshot from 2021-11-03 14-48-38

Note that if you plan to use ROS and run rtabmap without ui, you may check this page

.