introlab / rtabmap

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

Performance difference on Windows and Ubuntu? #1332

Open bingogome opened 2 months ago

bingogome commented 2 months ago

Hi,

Thank you for your amazing work!

I noticed some performance difference on Windows and Ubuntu while I move the camera. It seems on Windows the perform is better. Is this somewhat expected? On Windows, I used the released installer and on Ubuntu built from the source. I wonder if there is a way to look at the dependency, setting difference etc?

Also, the Odometry Viewer on Ubuntu has some disruption. It doesn't behave the same as in the main app.

Some screen recordings:

My CMake:

 ANDROID_PREBUILD                 OFF
 BUILD_APP                        ON
 BUILD_EXAMPLES                   ON
 BUILD_SHARED_LIBS                ON
 BUILD_TOOLS                      ON
 BUILD_WITH_RPATH_NOT_RUNPATH     OFF
 Boost_DATE_TIME_LIBRARY_RELEAS   /usr/lib/x86_64-linux-gnu/libboost_date_time.so.1.74.0
 Boost_FILESYSTEM_LIBRARY_RELEA   /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.74.0
 Boost_INCLUDE_DIR                /usr/include
 Boost_IOSTREAMS_LIBRARY_RELEAS   /usr/lib/x86_64-linux-gnu/libboost_iostreams.so.1.74.0
 Boost_SERIALIZATION_LIBRARY_RE   /usr/lib/x86_64-linux-gnu/libboost_serialization.so.1.74.0
 Boost_SYSTEM_LIBRARY_RELEASE     /usr/lib/x86_64-linux-gnu/libboost_system.so.1.74.0
 CHOLMOD_INCLUDE_DIR              CHOLMOD_INCLUDE_DIR-NOTFOUND
 CHOLMOD_LIB                      CHOLMOD_LIB-NOTFOUND
 CMAKE_BUILD_TYPE
 CMAKE_INSTALL_PREFIX             /usr/local
 CSPARSE_INCLUDE_DIR              CSPARSE_INCLUDE_DIR-NOTFOUND
 CSPARSE_LIBRARY                  CSPARSE_LIBRARY-NOTFOUND
 DC1394_INCLUDE_DIRS              /usr/include/dc1394
 DC1394_LIBRARIES                 /usr/lib/x86_64-linux-gnu/libdc1394.so
 FLANN_INCLUDE_DIR                /usr/include
 FLANN_KDTREE_MEM_OPT             OFF
 FLANN_LIBRARY_DEBUG_SHARED       FLANN_LIBRARY_DEBUG_SHARED-NOTFOUND
 FLANN_LIBRARY_DEBUG_STATIC       FLANN_LIBRARY_DEBUG_STATIC-NOTFOUND
 FLANN_LIBRARY_SHARED             /usr/lib/x86_64-linux-gnu/libflann_cpp.so
 FLANN_LIBRARY_STATIC             /usr/lib/x86_64-linux-gnu/libflann_cpp_s.a
 FlyCapture2_INCLUDE_DIR          FlyCapture2_INCLUDE_DIR-NOTFOUND
 FlyCapture2_LIBRARY              FlyCapture2_LIBRARY-NOTFOUND
 FlyCaptureBridge_LIBRARY         FlyCaptureBridge_LIBRARY-NOTFOUND
 Freenect_INCLUDE_DIRS            Freenect_INCLUDE_DIRS-NOTFOUND
 Freenect_LIBRARY                 Freenect_LIBRARY-NOTFOUND
 Freenect_sync_LIBRARY            Freenect_sync_LIBRARY-NOTFOUND
 G2O_CLI_LIBRARY                  G2O_CLI_LIBRARY-NOTFOUND
 G2O_CLI_LIBRARY_DEBUG            G2O_CLI_LIBRARY_DEBUG-NOTFOUND
 G2O_CONFIG_FILE                  G2O_CONFIG_FILE-NOTFOUND
 G2O_CORE_LIBRARY                 G2O_CORE_LIBRARY-NOTFOUND
 G2O_CORE_LIBRARY_DEBUG           G2O_CORE_LIBRARY_DEBUG-NOTFOUND
 G2O_FACTORY_FILE                 G2O_FACTORY_FILE-NOTFOUND
 G2O_INCLUDE_DIR                  G2O_INCLUDE_DIR-NOTFOUND
 G2O_SOLVER_CHOLMOD               G2O_SOLVER_CHOLMOD-NOTFOUND
 G2O_SOLVER_CHOLMOD_DEBUG         G2O_SOLVER_CHOLMOD_DEBUG-NOTFOUND
 G2O_SOLVER_CSPARSE               G2O_SOLVER_CSPARSE-NOTFOUND
 G2O_SOLVER_CSPARSE_DEBUG         G2O_SOLVER_CSPARSE_DEBUG-NOTFOUND
 G2O_SOLVER_CSPARSE_EXTENSION     G2O_SOLVER_CSPARSE_EXTENSION-NOTFOUND
 G2O_SOLVER_CSPARSE_EXTENSION_D   G2O_SOLVER_CSPARSE_EXTENSION_DEBUG-NOTFOUND
 G2O_SOLVER_DENSE                 G2O_SOLVER_DENSE-NOTFOUND
 G2O_SOLVER_DENSE_DEBUG           G2O_SOLVER_DENSE_DEBUG-NOTFOUND
 G2O_SOLVER_EIGEN                 G2O_SOLVER_EIGEN-NOTFOUND
 G2O_SOLVER_EIGEN_DEBUG           G2O_SOLVER_EIGEN_DEBUG-NOTFOUND
 G2O_SOLVER_PCG                   G2O_SOLVER_PCG-NOTFOUND
 G2O_SOLVER_PCG_DEBUG             G2O_SOLVER_PCG_DEBUG-NOTFOUND
 G2O_SOLVER_SLAM2D_LINEAR         G2O_SOLVER_SLAM2D_LINEAR-NOTFOUND
 G2O_SOLVER_SLAM2D_LINEAR_DEBUG   G2O_SOLVER_SLAM2D_LINEAR_DEBUG-NOTFOUND
 G2O_SOLVER_STRUCTURE_ONLY        G2O_SOLVER_STRUCTURE_ONLY-NOTFOUND
 G2O_SOLVER_STRUCTURE_ONLY_DEBU   G2O_SOLVER_STRUCTURE_ONLY_DEBUG-NOTFOUND
 G2O_STUFF_LIBRARY                G2O_STUFF_LIBRARY-NOTFOUND
 G2O_STUFF_LIBRARY_DEBUG          G2O_STUFF_LIBRARY_DEBUG-NOTFOUND
 G2O_TYPES_DATA                   G2O_TYPES_DATA-NOTFOUND
 G2O_TYPES_DATA_DEBUG             G2O_TYPES_DATA_DEBUG-NOTFOUND
 G2O_TYPES_ICP                    G2O_TYPES_ICP-NOTFOUND
 G2O_TYPES_ICP_DEBUG              G2O_TYPES_ICP_DEBUG-NOTFOUND
 G2O_TYPES_SBA                    G2O_TYPES_SBA-NOTFOUND
 G2O_TYPES_SBA_DEBUG              G2O_TYPES_SBA_DEBUG-NOTFOUND
 G2O_TYPES_SCLAM2D                G2O_TYPES_SCLAM2D-NOTFOUND
 G2O_TYPES_SCLAM2D_DEBUG          G2O_TYPES_SCLAM2D_DEBUG-NOTFOUND
G2O_TYPES_SLAM3D                 G2O_TYPES_SLAM3D-NOTFOUND
 G2O_TYPES_SLAM3D_DEBUG           G2O_TYPES_SLAM3D_DEBUG-NOTFOUND
 GTSAM_DIR                        GTSAM_DIR-NOTFOUND
 HDF5_C_LIBRARY_crypto            /usr/lib/x86_64-linux-gnu/libcrypto.so
 HDF5_C_LIBRARY_curl              /usr/lib/x86_64-linux-gnu/libcurl.so
 HDF5_C_LIBRARY_dl                /usr/lib/x86_64-linux-gnu/libdl.a
 HDF5_C_LIBRARY_hdf5              /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so
 HDF5_C_LIBRARY_hdf5_hl           /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.so
 HDF5_C_LIBRARY_m                 /usr/lib/x86_64-linux-gnu/libm.so
 HDF5_C_LIBRARY_pthread           /usr/lib/x86_64-linux-gnu/libpthread.a
 HDF5_C_LIBRARY_sz                /usr/lib/x86_64-linux-gnu/libsz.so
 HDF5_C_LIBRARY_z                 /usr/lib/x86_64-linux-gnu/libz.so
 ICU_INCLUDE_DIR                  /usr/include
 LZMA_INCLUDE_DIR                 /usr/include            
 LZMA_LIBRARY                     /usr/lib/x86_64-linux-gnu/liblzma.so
 MRPT_DIR                         MRPT_DIR-NOTFOUND
 MULTI_ARCH                       OFF
 OPENGL_GLES2_INCLUDE_DIR         /usr/include
 OPENGL_GLES3_INCLUDE_DIR         /usr/include
 OPENNI_INCLUDE_DIR               /usr/include/ni
 OPENNI_LIBRARY                   /usr/lib/libOpenNI.so
 OpenCV_DIR                       /usr/lib/x86_64-linux-gnu/cmake/opencv4   
 OpenNI2_INCLUDE_DIRS             /usr/include/openni2            
 OpenNI2_LIBRARY                  /usr/lib/x86_64-linux-gnu/libOpenNI2.so
 PCL_DIR                          /usr/lib/x86_64-linux-gnu/cmake/pcl
 PCL_OMP                          ON
 PDAL_DIR                         PDAL_DIR-NOTFOUND        
 PTHREADS_INCLUDE_DIR             /usr/include
 PTHREADS_LIBRARY                 /usr/lib/x86_64-linux-gnu/libpthread.a
 Qhull_DIR                        /usr/lib/x86_64-linux-gnu/cmake/Qhull
 Qt5Core_DIR                      /usr/lib/x86_64-linux-gnu/cmake/Qt5Core
 Qt5Gui_DIR                       /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui
 Qt5OpenGL_DIR                    /usr/lib/x86_64-linux-gnu/cmake/Qt5OpenGL
 Qt5PrintSupport_DIR              /usr/lib/x86_64-linux-gnu/cmake/Qt5PrintSupport
 Qt5Svg_DIR                       /usr/lib/x86_64-linux-gnu/cmake/Qt5Svg
 Qt5Widgets_DIR                   /usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets
 Qt5_DIR                          /usr/lib/x86_64-linux-gnu/cmake/Qt5
 RTABMAP_QT_VERSION               AUTO
 RealSenseImage_LIBRARY           RealSenseImage_LIBRARY-NOTFOUND  
 RealSenseSP_Core_LIBRARY         RealSenseSP_Core_LIBRARY-NOTFOUND    
 RealSenseSlam_INCLUDE_DIRS       RealSenseSlam_INCLUDE_DIRS-NOTFOUND        
 RealSenseSlam_LIBRARY            RealSenseSlam_LIBRARY-NOTFOUND
 RealSenseTracker_LIBRARY         RealSenseTracker_LIBRARY-NOTFOUND
 RealSense_INCLUDE_DIRS           RealSense_INCLUDE_DIRS-NOTFOUND
 RealSense_LIBRARY                RealSense_LIBRARY-NOTFOUND     
 TBB_DIR                          /usr/lib/x86_64-linux-gnu/cmake/TBB
 Triclops_INCLUDE_DIR             Triclops_INCLUDE_DIR-NOTFOUND
 Triclops_LIBRARY                 Triclops_LIBRARY-NOTFOUND        
 VTK_DIR                          /usr/lib/x86_64-linux-gnu/cmake/vtk-9.1
 VTK_GLOBAL_WARNING_DISPLAY       OFF
 VTK_MPI_NUMPROCS                 2
 WITH_ALICE_VISION                OFF
 WITH_CCCORELIB                   OFF
 WITH_CERES                       OFF
 WITH_CPUTSDF                     OFF
 WITH_CVSBA                       OFF
 WITH_DC1394                      ON
 WITH_DEPTHAI                     OFF
 WITH_DVO                         OFF
 WITH_FASTCV                      ON
 WITH_FLOAM                       OFF
WITH_FLYCAPTURE2                 ON
 WITH_FOVIS                       OFF
 WITH_FREENECT                    ON
 WITH_FREENECT2                   ON
 WITH_G2O                         ON
 WITH_GRIDMAP                     ON
 WITH_GTSAM                       ON
 WITH_K4A                         ON
 WITH_K4W2                        ON
 WITH_LOAM                        OFF
 WITH_MADGWICK                    ON
 WITH_MRPT                        ON
 WITH_MSCKF_VIO                   OFF
 WITH_MYNTEYE                     ON
 WITH_OCTOMAP                     ON
 WITH_OKVIS                       OFF
 WITH_OPEN3D                      OFF
 WITH_OPENCHISEL                  OFF
 WITH_OPENGV                      ON
 WITH_OPENMP                      ON
 WITH_OPENNI                      ON
 WITH_OPENNI2                     ON
 WITH_OPENVINS                    OFF
 WITH_ORB_OCTREE                  ON
 WITH_ORB_SLAM                    OFF
 WITH_PDAL                        ON
 WITH_POINTMATCHER                ON
 WITH_PYTHON                      OFF
 WITH_PYTHON_THREADING            OFF
 WITH_QT                          ON
 WITH_REALSENSE                   ON
 WITH_REALSENSE2                  ON
 WITH_REALSENSE_SLAM              ON
 WITH_TORCH                       OFF
 WITH_TORO                        ON
 WITH_VERTIGO                     ON
 WITH_VINS                        OFF
 WITH_VISO2                       OFF
 WITH_XVSDK                       OFF
 WITH_ZED                         ON
 WITH_ZEDOC                       ON
 ZEDOC_INCLUDE_DIR                ZEDOC_INCLUDE_DIR-NOTFOUND
 ZEDOC_LIBRARY                    ZEDOC_LIBRARY-NOTFOUND           
 ZED_DIR                          ZED_DIR-NOTFOUND                     
 flann_DIR                        flann_DIR-NOTFOUND                         
 freenect2_DIR                    freenect2_DIR-NOTFOUND        
 g2o_DIR                          g2o_DIR-NOTFOUND
 grid_map_core_DIR                grid_map_core_DIR-NOTFOUND     
 k4a_DIR                          k4a_DIR-NOTFOUND               
 k4arecord_DIR                    k4arecord_DIR-NOTFOUND             
 libpointmatcher_DIR              libpointmatcher_DIR-NOTFOUND 
 libusb_INCLUDE_DIR               /usr/include                     
 mynteye_DIR                      mynteye_DIR-NOTFOUND
 netCDF_DIR                       /usr/lib/x86_64-linux-gnu/cmake/netCDF
 octomap_DIR                      octomap_DIR-NOTFOUND
 opengv_DIR                       opengv_DIR-NOTFOUND
 pnmutils_LIBRARY                 pnmutils_LIBRARY-NOTFOUND
 realsense2_DIR                   /home/.conan/data/realsense/2.54.2-pck-a/stable/package/lib/cmake/realsense2
 tmp                              tmp-NOTFOUND
 yaml-cpp_DIR                     yaml-cpp_DIR-NOTFOUND
bingogome commented 2 months ago

I realized I did not install the G2O dependency. However, after installing G2O, I got some very jumpy results. Both translation and rotation became very unstable. Here is a recording. https://drive.google.com/file/d/1Z8zhv7aNKZkijUcokgZz_GstBfVU1Px4/view?usp=drive_link

matlabbe commented 2 months ago

It should perform roughly the same on Windows and Ubuntu. If you search OMP_WAIT_POLICY on this page, you will some issues depending on the OS config where there could be high artificial CPU usage. Other thing is how the dependencies are compiled between the OS. In your case, you seem to be using mostly system dependencies on Ubuntu, so it should be okay.

For your first videos, fast motion like that and pointing the camera to white wall are more likely to cause red screens, see description here https://github.com/introlab/rtabmap/wiki/Kinect-mapping#lost-odometry-red-screens

For the jumps on the last post, it looks like related to IMU (the extrinsic between imu and camera may be wrong). Is it the same camera on both Windows and Ubuntu? Which kind of camera is it? You can try without IMU by detting IMU filtering to None here: image

bingogome commented 2 months ago

Thank you for getting back to me!

For the jumps on the last post, it looks like related to IMU (the extrinsic between imu and camera may be wrong). Is it the same camera on both Windows and Ubuntu? Which kind of camera is it? You can try without IMU by detting IMU filtering to None here:

In all my tests, I use the same camera connected to the same PC with a dual boot. It is a RealSense 435i. I was also expecting the same behavior since the only difference I can think of is the dependency. Later, I also checked the settings options. I found one difference is the feature extraction. On Windows, I have GFTT+BRIEF, but it was grayed out on Ubuntu. On Ubuntu, it was GFTT+ORL.

Thank you for your suggestion to disable IMU. I will report back after the tests.

Edit Sep 09: Disabling IMU filter did the job, thank you so much! That being said, you also mentioned the calibration results might be wrong. Would it still be the case? Should I calibrate the camera? Even that's the case, I am still not sure what was the reason that it worked fine on Windows (no jumps in the last video) but jumped on Ubuntu?

Edit Sep 12: It looks like there is something wrong in the firmware of RealSense 2. The newest version 5.16.0.1 is the cause of the jumpy odometry. Older version 5.15.1.0 fixed it. However, this still does not explain the difference on Windows (no jumps even with 5.16.0.1 firmware) and Ubuntu.