Login  Register

Re: icp_odometry with LOAM crash

Posted by matlabbe on Aug 18, 2021; 8:42pm
URL: http://official-rtab-map-forum.206.s1.nabble.com/icp-odometry-with-LOAM-crash-tp8261p8442.html

Hi,

For LOAM, I tested with current local build on my focal/noetic machine and it also crashes with this error in gdb:
Thread 1 "rtabmap-kitti_d" received signal SIGSEGV, Segmentation fault.
__GI___libc_free (mem=0xaa91) at malloc.c:3102
3102	malloc.c: No such file or directory.
(gdb) bt
#0  __GI___libc_free (mem=0xaa91) at malloc.c:3102
#1  0x00007fffefd424d5 in loam::BasicScanRegistration::extractFeatures(unsigned short const&) ()
    at /home/mathieu/catkin_ws/devel/lib/libloam.so
#2  0x00007fffefd42dc4 in loam::BasicScanRegistration::processScanlines(std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&, std::vector<pcl::PointCloud<pcl::PointXYZI>, std::allocator<pcl::PointCloud<pcl::PointXYZI> > > const&) ()
    at /home/mathieu/catkin_ws/devel/lib/libloam.so
#3  0x00007ffff776a319 in rtabmap::OdometryLOAM::computeTransform(rtabmap::SensorData&, rtabmap::Transform const&, rtabmap::OdometryInfo*) () at /home/mathieu/catkin_ws/devel/lib/librtabmap_core.so.0.20
#4  0x00007ffff773b141 in rtabmap::Odometry::process(rtabmap::SensorData&, rtabmap::Transform const&, rtabmap::OdometryInfo*) () at /home/mathieu/catkin_ws/devel/lib/librtabmap_core.so.0.20
#5  0x00007ffff773ed1b in rtabmap::Odometry::process(rtabmap::SensorData&, rtabmap::OdometryInfo*) ()
    at /home/mathieu/catkin_ws/devel/lib/librtabmap_core.so.0.20
#6  0x0000555555564d3c in main ()

From the kinetic docker image corresponding to the related paper, I could make LOAM working even with latest rtabmap version. Here is the log of rtabmap build with working loam from inside the image `/root/rtabmap_loam/build`:
cmake -DWITH_MSCKF_VIO=OFF -DWITH_LOAM=ON -DWITH_G2O=ON -DWITH_FOVIS=OFF -DWITH_DVO=OFF -DWITH_OKVIS=OFF -DWITH_VISO2=OFF -DWITH_CERES=OFF ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- MOBILE_BUILD=OFF
-- Checking for module 'eigen3'
--   Found eigen3, version 3.2.92
-- Found eigen: /usr/include/eigen3  
-- Checking for module 'libopenni'
--   Found libopenni, version 1.5.4.0
-- Found openni: /usr/lib/libOpenNI.so  
-- Checking for module 'libopenni2'
--   Found libopenni2, version 2.2.0.3
-- Found OpenNI2: /usr/lib/libOpenNI2.so  
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
but not all the files it references.

-- Found libusb-1.0: /usr/include  
-- Checking for module 'flann'
--   Found flann, version 1.8.4
-- Found Flann: /usr/lib/x86_64-linux-gnu/libflann_cpp_s.a  
-- Found qhull: /usr/lib/x86_64-linux-gnu/libqhull.so  
-- Found PCL_COMMON: /usr/lib/x86_64-linux-gnu/libpcl_common.so  
-- Found PCL_OCTREE: /usr/lib/x86_64-linux-gnu/libpcl_octree.so  
-- Found PCL_IO: /usr/lib/x86_64-linux-gnu/libpcl_io.so  
-- Found PCL_KDTREE: /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so  
-- Found PCL_SEARCH: /usr/lib/x86_64-linux-gnu/libpcl_search.so  
-- Found PCL_SURFACE: /usr/lib/x86_64-linux-gnu/libpcl_surface.so  
-- Found PCL_FILTERS: /usr/lib/x86_64-linux-gnu/libpcl_filters.so  
-- Found PCL_FEATURES: /usr/lib/x86_64-linux-gnu/libpcl_features.so  
-- Found PCL_REGISTRATION: /usr/lib/x86_64-linux-gnu/libpcl_registration.so  
-- Found PCL_SAMPLE_CONSENSUS: /usr/lib/x86_64-linux-gnu/libpcl_sample_consensus.so  
-- Found PCL_GEOMETRY: /usr/include/pcl-1.7  
-- Found PCL_SEGMENTATION: /usr/lib/x86_64-linux-gnu/libpcl_segmentation.so  
-- Found PCL_VISUALIZATION: /usr/lib/x86_64-linux-gnu/libpcl_visualization.so  
-- PCL definitions don't contain "-march=native", make sure all libraries using Eigen are also compiled without that flag to avoid some segmentation faults (with gdb referring to some Eigen functions).
-- Found Sqlite3: /usr/include /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp  
-- Found OpenMP: 
-- Found OpenCV: /usr/local/include/opencv;/usr/local/include
-- Found PCL: /usr/include/pcl-1.7;/usr/include/eigen3;/usr/include;/usr/include/ni;/usr/include/openni2;/usr/include/vtk-6.2;/usr/include/x86_64-linux-gnu;/usr/include/freetype2;/usr/include/x86_64-linux-gnu/freetype2;/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent;/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent/include;/usr/lib/openmpi/include;/usr/lib/openmpi/include/openmpi;/usr/include/python2.7;/usr/include/jsoncpp;/usr/include/hdf5/openmpi;/usr/include/libxml2;/usr/include/tcl
-- Found ZLIB: /usr/include
-- VTK_RENDERING_BACKEND=OpenGL
-- Found Freenect: /usr/include
-- Found OpenNI2: /usr/include/openni2
-- Found CSPARSE: /usr/include/suitesparse  
-- Old g2o version detected with c++03 interface (config file: /usr/local/include/g2o/config.h).
-- Found g2o: /usr/local/include;/usr/include/suitesparse;/usr/include/suitesparse
-- GTSAM include directory:  /usr/local/lib/cmake/GTSAM/../../../include;/usr/include/eigen3
-- FlyCapture2_INCLUDE_DIR=FlyCapture2_INCLUDE_DIR-NOTFOUND
-- FlyCapture2_LIBRARY=FlyCapture2_LIBRARY-NOTFOUND
-- Triclops_INCLUDE_DIR=Triclops_INCLUDE_DIR-NOTFOUND
-- Triclops_LIBRARY=Triclops_LIBRARY-NOTFOUND
-- FlyCaptureBridge_LIBRARY=FlyCaptureBridge_LIBRARY-NOTFOUND
-- Found libpointmatcher: /usr/local/include;/usr/include;/usr/include/eigen3;/usr/local/include;/root/libpointmatcher/pointmatcher
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   thread
--   filesystem
--   system
--   program_options
--   date_time
--   chrono
--   atomic
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   thread
--   filesystem
--   system
--   program_options
--   date_time
--   chrono
--   timer
--   atomic
-- Using CATKIN_DEVEL_PREFIX: /root/rtabmap_loam/build/devel
-- Using CMAKE_PREFIX_PATH: /root/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /root/catkin_ws/devel;/opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /root/rtabmap_loam/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found loam_velodyne: /root/catkin_ws/src/loam_velodyne/include;/usr/include/eigen3;/usr/include/pcl-1.7;/usr/include;/usr/include/ni;/usr/include/openni2;/usr/include/vtk-6.2;/usr/include/hdf5/openmpi;/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent;/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent/include;/usr/lib/openmpi/include;/usr/lib/openmpi/include/openmpi;/usr/include/jsoncpp;/usr/include/libxml2;/usr/include/x86_64-linux-gnu;/usr/include/freetype2;/usr/include/x86_64-linux-gnu/freetype2;/usr/include/python2.7;/usr/include/tcl;/opt/ros/kinetic/include;/opt/ros/kinetic/share/xmlrpcpp/cmake/../../../include/xmlrpcpp
-- Found octomap 1.8.1: /opt/ros/kinetic/include
-- Architecture: x86_64
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Found Pthreads
-- --------------------------------------------
-- Info :
--   RTAB-Map Version =     0.20.13
--   CMAKE_VERSION =        3.5.1
--   CMAKE_INSTALL_PREFIX = /usr/local
--   CMAKE_BUILD_TYPE =     Release
--   CMAKE_INSTALL_LIBDIR = lib
--   BUILD_APP =            ON
--   BUILD_TOOLS =          ON
--   BUILD_EXAMPLES =       ON
--   BUILD_SHARED_LIBS =    ON
--   CMAKE_CXX_FLAGS =  -fmessage-length=0  -fopenmp -std=c++14
--   FLANN_KDTREE_MEM_OPT = OFF
--   PCL_DEFINITIONS = -DEIGEN_USE_NEW_STDVECTOR;-DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET;-DFLANN_STATIC;-Dqh_QHpointer
--   PCL_VERSION = 1.7.2
-- 
-- Optional dependencies ('*' affects some default parameters) :
--  *With OpenCV 3.1.0 xfeatures2d = YES, nonfree = YES (License: Non commercial)
--   With Qt 5.5.1            = YES (License: Open Source or Commercial)
--   With VTK 6.2              = YES (License: BSD)
--   With external SQLite3     = YES (License: Public Domain)
--   With ORB OcTree           = YES (License: GPLv3)
--   With SupertPoint          = NO (WITH_TORCH=OFF)
--   With Python3              = NO (WITH_PYTHON=OFF)
--   With Madgwick             = YES (License: GPL)
--   With FastCV               = NO (FastCV not found)
--   With PDAL                 = NO (PDAL not found)
-- 
--  Solvers:
--   With TORO                 = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
--  *With g2o                  = YES (License: BSD)
--  *With GTSAM                = YES (License: BSD)
--  *With Ceres                = NO (WITH_CERES=OFF)
--   With VERTIGO              = YES (License: GPLv3)
--   With cvsba                = NO (cvsba not found)
--  *With libpointmatcher      = YES (License: BSD)
--   With CCCoreLib            = NO (CCCoreLib not found)
-- 
--  Reconstruction Approaches:
--   With OCTOMAP              = YES (License: BSD)
--   With CPUTSDF              = NO (CPUTSDF not found)
--   With OpenChisel           = NO (open_chisel not found)
--   With AliceVision          = NO (WITH_ALICE_VISION=OFF)
-- 
--  Camera Drivers:
--   With Freenect             = YES (License: Apache v2 and/or GPLv2)
--   With OpenNI2              = YES (License: Apache v2)
--   With Freenect2            = NO (libfreenect2 not found)
--   With Kinect for Windows 2 = NO (Kinect for Windows 2 SDK not found)
--   With Kinect for Azure     = NO (Kinect for Azure SDK not found)
--   With dc1394               = NO (dc1394 not found)
--   With FlyCapture2/Triclops = NO (Point Grey SDK not found)
--   With ZED                  = NO (ZED sdk and/or cuda not found)
--   With ZEDOC                = NO (ZED Open Capture not found)
--   With RealSense            = NO (librealsense not found)
--   With RealSense2           = NO (librealsense2 not found)
--   With MyntEyeS             = NO (mynteye s sdk not found)
--   With DepthAI              = NO (depthai-core not found)
-- 
--  Odometry Approaches:
--   With loam_velodyne        = YES (License: BSD)
--   With libfovis             = NO (WITH_FOVIS=OFF)
--   With libviso2             = NO (WITH_VISO2=OFF)
--   With dvo_core             = NO (WITH_DVO=OFF)
--   With okvis                = NO (WITH_OKVIS=OFF)
--   With msckf_vio            = NO (WITH_MSCKF_VIO=OFF)
--   With VINS-Fusion          = NO (VINS-Fusion not found)
--   With OpenVINS             = NO (ov_msckf not found)
--   With ORB_SLAM             = NO (WITH_G2O should be OFF as ORB_SLAM uses its own g2o version)
-- Show all options with: cmake -LA | grep WITH_
-- --------------------------------------------
-- Configuring done
-- Generating done

Then log of kitti benchmark script using the modified docker above with latest rtabmap version:
./run_kitti_datasets.sh test_loam 7 1 07
[ WARN] (2021-08-18 20:14:19.642) Parameters.cpp:1112::parseArguments() Parameter migration from "OdomORBSLAM2/VocPath" to "OdomORBSLAM/VocPath" (value=/root/ORBvoc.txt).
[ WARN] (2021-08-18 20:14:19.642) Parameters.cpp:1112::parseArguments() Parameter migration from "OdomORBSLAM2/ThDepth" to "OdomORBSLAM/ThDepth" (value=40).
[ WARN] (2021-08-18 20:14:19.642) Parameters.cpp:1112::parseArguments() Parameter migration from "OdomORBSLAM2/Fps" to "OdomORBSLAM/Fps" (value=10).
[ WARN] (2021-08-18 20:14:19.642) Parameters.cpp:1112::parseArguments() Parameter migration from "OdomORBSLAM2/MaxFeatures" to "OdomORBSLAM/MaxFeatures" (value=2000).
[ WARN] (2021-08-18 20:14:19.642) Parameters.cpp:1112::parseArguments() Parameter migration from "Icp/PM" to "Icp/Strategy" (value=true).
[ WARN] (2021-08-18 20:14:19.642) Parameters.cpp:1112::parseArguments() Parameter migration from "Icp/PMOutlierRatio" to "Icp/OutlierRatio" (value=0.7).
Paths:
   Sequence number:  07
   Sequence path:    /root/datasets/kitti/dataset/sequences/07
   Output:           /root/results/kitti/07
   Output name:      test_loam
   left images:      /root/datasets/kitti/dataset/sequences/07/image_0
   right images:     /root/datasets/kitti/dataset/sequences/07/image_1
   calib.txt:        /root/datasets/kitti/dataset/sequences/07/calib.txt
   times.txt:        /root/datasets/kitti/dataset/sequences/07/times.txt
   Ground Truth:      /root/datasets/kitti/devkit/cpp/data/odometry/poses/07.txt
   Exposure Compensation: false
   Disparity:         false
   Scan:               /root/datasets/kitti/dataset/sequences/07/velodyne
   Scan only:          false
   Scan step:          1
   Scan voxel:         0.000000m
   Scan normal k:      0
   Scan normal radius: 0.000000
Saved calibration "test_loam_calib" to "/root/results/kitti/07"
Parameters:
   FAST/Threshold=12
   GFTT/MinDistance=7
   GFTT/QualityLevel=0.01
   Icp/CorrespondenceRatio=0.01
   Icp/Epsilon=0.0001
   Icp/Iterations=10
   Icp/MaxCorrespondenceDistance=1.5
   Icp/MaxTranslation=2
   Icp/OutlierRatio=0.7
   Icp/PMMatcherEpsilon=1
   Icp/PMMatcherKnn=3
   Icp/PointToPlane=false
   Icp/Strategy=true
   Kp/FlannRebalancingFactor=1.0
   Kp/MaxFeatures=750
   Mem/BinDataKept=true
   Mem/LaserScanVoxelSize=0.5
   Mem/STMSize=30
   Mem/UseOdomFeatures=false
   Odom/ScanKeyFrameThr=0.8
   Odom/Strategy=7
   OdomF2M/MaxSize=3000
   OdomF2M/ScanMaxSize=10000
   OdomF2M/ScanSubtractRadius=0.5
   OdomORBSLAM/Fps=10
   OdomORBSLAM/MaxFeatures=2000
   OdomORBSLAM/ThDepth=40
   OdomORBSLAM/VocPath=/root/ORBvoc.txt
   OdomViso2/MatchNmsN=7
   OdomViso2/MatchRadius=300
   RGBD/AngularUpdate=0
   RGBD/LinearUpdate=0
   RGBD/ProximityBySpace=false
   Reg/Strategy=1
   Rtabmap/CreateIntermediateNodes=true
   Rtabmap/DetectionRate=2
   Rtabmap/PublishRAMUsage=true
   Rtabmap/WorkingDirectory=/root/results/kitti/07
   Vis/CorGuessWinSize=20
   Vis/CorNNDR=0.6
   Vis/MaxFeatures=1500
RTAB-Map version: 0.20.13
Processing 1101 images...
..........Iteration 1101/1101: speed=0km/h camera=10ms, odom(quality=0.000000, kfs=0)=365ms, slam=197ms, rmse=0.387183m *
Total time=318.698992s
Saving trajectory ...
Saving /root/results/kitti/07/test_loam_poses.txt... done!
Ground truth comparison:
   KITTI t_err = 0.645350 %
   KITTI r_err = 0.004496 deg/m
   translational_rmse=   0.388508 m
   rotational_rmse=      0.596562 deg
Saving rtabmap database (with all statistics) to "/root/results/kitti/07/test_loam.db"
Do:
 $ rtabmap-databaseViewer /root/results/kitti/07/test_loam.db

$ rtabmap-report results/kitti/07/test_loam.db 
Database: results/kitti/07/test_loam.db
   test_loam.db (1101, s=1.000):	error lin=0.388m (max=1.571m, odom=1.605m) ang=0.6deg, slam: avg=89ms (max=299ms) loops=14, odom: avg=253ms (max=373ms), camera: avg=16ms, map=2289MB

I tried again on my ubuntu focal/noetic computer with exactly the same cmake options and I still have a creash on start. Not sure where the problem is coming from (Xenial versus Focal?).

To increase speed, another parameter could the number of ICP iterations: Icp/Iterations (default 30). I remember I set it to 10 for some 3D lidar demos.

cheers,
Mathieu