razayunus / ManhattanSLAM

A Planar RGB-D SLAM which utilizes Manhattan World structure to provide optimal camera pose trajectory while also providing a sparse reconstruction containing points, lines and planes, and a dense surfel-based reconstruction.
Other
149 stars 40 forks source link

Problem with run on TUM dataset #2

Closed zhuhu00 closed 2 years ago

zhuhu00 commented 2 years ago

./Example/manhattan_slam Vocabulary/ORBvoc.txt Example/TUM1.yaml /media/roma-z/Huge/00-SLAM_DataSets/TUM/rgbd_dataset_freiburg1_xyz/ /media/roma-z/Huge/00-SLAM_DataSets/TUM/rgbd_dataset_freiburg1_xyz/associations.txt

ManhattanSLAM Copyright (C) 2021 Raza Yunus, Technical University of Munich (TUM). This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. See LICENSE.txt.

Loading ORB Vocabulary. This could take a while... Vocabulary loaded!

img_width = 640 img_height = 480 mUndistX size = 0x5584c0465ab0 mUndistY size = 0x5584c0465b10

Camera Parameters:

ORB Extractor Parameters:

Depth Threshold (Close/Far Points): 3.09294

==========test1============13131.2

==========test2============2500

==========test3============13131.2

==========test4============13131.2 Segmentation fault (core dumped)

I find other people also have this issue when running ManhattanSLAM or ORB-SLAM2/3 in TUM dataset, can you give me some solution?

razayunus commented 2 years ago

Hi, can you please use a debugger and post which line gives the segmentation fault? Also, I recently fixed a segmentation fault (fd1db77), so make sure you pulled the latest code.

JunyuanDeng commented 2 years ago

Got the same problem, and i use gdb, it tells me that: Starting program: /home/juneyoung/Programmes/ManhattanSLAM/Example/manhattan_slam Vocabulary/ORBvoc.txt Example/ICL.yaml /media/juneyoung/Samsung_T5/dataset/ICL-NUIM/living_room_traj2_frei_png /media/juneyoung/Samsung_T5/dataset/ICL-NUIM/living_room_traj2_frei_png/associations.txt [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

ManhattanSLAM Copyright (C) 2021 Raza Yunus, Technical University of Munich (TUM). This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. See LICENSE.txt.

Loading ORB Vocabulary. This could take a while... Vocabulary loaded!

[New Thread 0x7fffc2827700 (LWP 192981)] [New Thread 0x7fffc2026700 (LWP 192982)] [New Thread 0x7fffc15be700 (LWP 192983)] [New Thread 0x7fffc0dbd700 (LWP 192984)] [New Thread 0x7fffadfff700 (LWP 192985)] [New Thread 0x7fffad7fe700 (LWP 192986)] [New Thread 0x7fffacffd700 (LWP 192987)] img_width = 640 img_height = 480 mUndistX size = 480 x 640 mUndistY size = 480 x 640

Camera Parameters:

ORB Extractor Parameters:

Depth Threshold (Close/Far Points): 3.32502 [New Thread 0x7fff9ffff700 (LWP 192988)] [New Thread 0x7fff9f7fe700 (LWP 192989)] [New Thread 0x7fff9effd700 (LWP 192990)] [New Thread 0x7fff9c8ef700 (LWP 192991)] [New Thread 0x7fff97fff700 (LWP 192992)] [New Thread 0x7fff977fe700 (LWP 192993)] [New Thread 0x7fff96ffd700 (LWP 192994)] [New Thread 0x7fff967fc700 (LWP 192995)] [New Thread 0x7fff95ffb700 (LWP 192996)] [New Thread 0x7fff957fa700 (LWP 192997)] [New Thread 0x7fff94ff9700 (LWP 192998)] [New Thread 0x7fff73fff700 (LWP 192999)] [New Thread 0x7fff6bfff700 (LWP 193000)] [New Thread 0x7fff737fe700 (LWP 193001)] [New Thread 0x7fff72ffd700 (LWP 193002)] [New Thread 0x7fff727fc700 (LWP 193003)] [New Thread 0x7fff71ffb700 (LWP 193004)] [New Thread 0x7fff717fa700 (LWP 193005)] [New Thread 0x7fff70ff9700 (LWP 193006)] [New Thread 0x7fff6b7fe700 (LWP 193007)] [New Thread 0x7fff6affd700 (LWP 193008)] [New Thread 0x7fff6a7fc700 (LWP 193009)] [Thread 0x7fff6b7fe700 (LWP 193007) exited] [Thread 0x7fff6affd700 (LWP 193008) exited] --Type for more, q to quit, c to continue without paging--c

Thread 30 "manhattan_slam" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff6a7fc700 (LWP 193009)] __GI___libc_free (mem=0x1bf4) at malloc.c:3102 3102 malloc.c: No such file or directory.

I change the file Frame.cc (from line100) to: thread threadPoints(&ORB_SLAM2::Frame::ExtractORB, this, imGray); cout<<6<<endl; thread threadLines(&ORB_SLAM2::Frame::ExtractLSD, this, imGray); cout<<7<<endl; thread threadPlanes(&ORB_SLAM2::Frame::ExtractPlanes, this, imRGB, imDepth, K, depthMapFactor); cout<<8<<endl; threadPoints.join(); cout<<9<<endl; threadLines.join(); cout<<10<<endl; threadPlanes.join();

And the output become Depth Threshold (Close/Far Points): 3.32502 6 7 8 9 Segmentation fault (core dumped)

So I think the problem is: thread threadLines(&ORB_SLAM2::Frame::ExtractLSD, this, imGray);

razayunus commented 2 years ago

@Rotatingpencil can you please use backtrace in gdb to see which line in the source produces the segmentation fault? It would be nice if you post your library versions as well. Thanks.

JunyuanDeng commented 2 years ago

@Rotatingpencil can you please use backtrace in gdb to see which line in the source produces the segmentation fault? It would be nice if you post your library versions as well. Thanks.

I have tried with OpenCV version 3.3.0, Eigen version 3.3.9 and used "flag -std=c++14". When I use ./build.sh, it present: Configuring and building ManhattanSLAM ... -- The C compiler identification is GNU 10.3.0 -- The CXX compiler identification is GNU 10.3.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 Build type: Release -- Performing Test COMPILER_SUPPORTS_CXX11 -- Performing Test COMPILER_SUPPORTS_CXX11 - Success -- Performing Test COMPILER_SUPPORTS_CXX0X -- Performing Test COMPILER_SUPPORTS_CXX0X - Success -- Using flag -std=c++14. -- Found OpenCV: /usr/local/opencv330_extra (found version "3.3.0") -- Found Eigen3: /usr/local/include/eigen3 (Required is at least version "3.1.0") -- Checking for module 'eigen3' -- Found eigen3, version 3.3.9 -- Found Eigen: /usr/include/eigen3 (Required is at least version "3.1") -- Eigen found (include: /usr/include/eigen3, version: 3.3.7) -- Found Boost: /usr/include (found suitable version "1.71.0", minimum required is "1.55.0") found components: system filesystem date_time iostreams regex -- Checking for module 'flann' -- Found flann, version 1.9.1 -- Found FLANN: /usr/lib/x86_64-linux-gnu/libflann_cpp.so
-- The imported target "vtkParseOGLExt" references the file "/usr/bin/vtkParseOGLExt-7.1" but this file does not exist. Possible reasons include:

-- 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 imported target "vtk" references the file "/usr/bin/vtk" but this file does not exist. Possible reasons include:

-- The imported target "pvtk" references the file "/usr/bin/pvtk" but this file does not exist. Possible reasons include:

-- Checking for module 'libusb-1.0' -- Found libusb-1.0, version 1.0.23 -- Found USB_10: /usr/lib/x86_64-linux-gnu/libusb-1.0.so
-- Found OpenNI: /usr/lib/libOpenNI.so
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so) -- Found OpenNI2: /usr/lib/libOpenNI2.so
-- OpenNI2 found (include: /usr/include/openni2, lib: /usr/lib/libOpenNI2.so) WARNING io features related to pcap will be disabled WARNING io features related to png will be disabled -- Found libusb-1.0: /usr/include
WARNING io features related to libusb-1.0 will be disabled -- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so) -- OpenNI2 found (include: /usr/include/openni2, lib: /usr/lib/libOpenNI2.so) -- Found Qhull: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so
-- QHULL found (include: /usr/include, lib: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so) -- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so) -- looking for PCL_COMMON -- Found PCL_COMMON: /usr/lib/x86_64-linux-gnu/libpcl_common.so
-- looking for PCL_KDTREE -- Found PCL_KDTREE: /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so
-- looking for PCL_OCTREE -- Found PCL_OCTREE: /usr/lib/x86_64-linux-gnu/libpcl_octree.so
-- looking for PCL_SEARCH -- Found PCL_SEARCH: /usr/lib/x86_64-linux-gnu/libpcl_search.so
-- looking for PCL_SAMPLE_CONSENSUS -- Found PCL_SAMPLE_CONSENSUS: /usr/lib/x86_64-linux-gnu/libpcl_sample_consensus.so
-- looking for PCL_FILTERS -- Found PCL_FILTERS: /usr/lib/x86_64-linux-gnu/libpcl_filters.so
-- looking for PCL_2D -- Found PCL_2D: /usr/include/pcl-1.10
-- looking for PCL_GEOMETRY -- Found PCL_GEOMETRY: /usr/include/pcl-1.10
-- looking for PCL_IO -- Found PCL_IO: /usr/lib/x86_64-linux-gnu/libpcl_io.so
-- looking for PCL_FEATURES -- Found PCL_FEATURES: /usr/lib/x86_64-linux-gnu/libpcl_features.so
-- looking for PCL_ML -- Found PCL_ML: /usr/lib/x86_64-linux-gnu/libpcl_ml.so
-- looking for PCL_SEGMENTATION -- Found PCL_SEGMENTATION: /usr/lib/x86_64-linux-gnu/libpcl_segmentation.so
-- looking for PCL_VISUALIZATION -- Found PCL_VISUALIZATION: /usr/lib/x86_64-linux-gnu/libpcl_visualization.so
-- looking for PCL_SURFACE -- Found PCL_SURFACE: /usr/lib/x86_64-linux-gnu/libpcl_surface.so
-- looking for PCL_REGISTRATION -- Found PCL_REGISTRATION: /usr/lib/x86_64-linux-gnu/libpcl_registration.so
-- looking for PCL_KEYPOINTS -- Found PCL_KEYPOINTS: /usr/lib/x86_64-linux-gnu/libpcl_keypoints.so
-- looking for PCL_TRACKING -- Found PCL_TRACKING: /usr/lib/x86_64-linux-gnu/libpcl_tracking.so
-- looking for PCL_RECOGNITION -- Found PCL_RECOGNITION: /usr/lib/x86_64-linux-gnu/libpcl_recognition.so
-- looking for PCL_STEREO -- Found PCL_STEREO: /usr/lib/x86_64-linux-gnu/libpcl_stereo.so
-- looking for PCL_APPS -- Found PCL_APPS: /usr/lib/x86_64-linux-gnu/libpcl_apps.so
-- looking for PCL_IN_HAND_SCANNER -- Found PCL_IN_HAND_SCANNER: /usr/include/pcl-1.10
-- looking for PCL_POINT_CLOUD_EDITOR -- Found PCL_POINT_CLOUD_EDITOR: /usr/include/pcl-1.10
-- looking for PCL_OUTOFCORE -- Found PCL_OUTOFCORE: /usr/lib/x86_64-linux-gnu/libpcl_outofcore.so
-- looking for PCL_PEOPLE -- Found PCL_PEOPLE: /usr/lib/x86_64-linux-gnu/libpcl_people.so
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_apps;pcl_outofcore;pcl_people;/usr/lib/x86_64-linux-gnu/libboost_system.so;/usr/lib/x86_64-linux-gnu/libboost_filesystem.so;/usr/lib/x86_64-linux-gnu/libboost_date_time.so;/usr/lib/x86_64-linux-gnu/libboost_iostreams.so;/usr/lib/x86_64-linux-gnu/libboost_regex.so;optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so;/usr/lib/libOpenNI.so;/usr/lib/libOpenNI2.so;vtkChartsCore;vtkCommonColor;vtkCommonCore;vtksys;vtkCommonDataModel;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonExecutionModel;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersCore;vtkInfovisCore;vtkFiltersExtraction;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;/usr/lib/x86_64-linux-gnu/libfreetype.so;/usr/lib/x86_64-linux-gnu/libz.so;vtkFiltersModeling;vtkImagingSources;vtkInteractionStyle;vtkInteractionWidgets;vtkFiltersHybrid;vtkImagingColor;vtkImagingGeneral;vtkImagingHybrid;vtkIOImage;vtkDICOMParser;vtkmetaio;/usr/lib/x86_64-linux-gnu/libjpeg.so;/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libtiff.so;vtkRenderingAnnotation;vtkRenderingVolume;vtkIOXML;vtkIOCore;vtkIOXMLParser;/usr/lib/x86_64-linux-gnu/libexpat.so;vtkIOGeometry;vtkIOLegacy;vtkIOPLY;vtkRenderingLOD;vtkViewsContext2D;vtkViewsCore;vtkRenderingContextOpenGL2;vtkRenderingOpenGL2;FLANN::FLANN (Required is at least version "1.7") -- Configuring done -- Generating done -- Build files have been written to: /home/juneyoung/Programmes/ManhattanSLAM/build

When I use backtrace, it show: (gdb) backtrace

0 __GI___libc_free (mem=0x1bf4) at malloc.c:3102

1 0x00007ffff7f60c61 in boost::detail::sp_counted_impl_p<pcl::PointCloud >::dispose() ()

at /home/juneyoung/Programmes/ManhattanSLAM/lib/libManhattanSLAM.so

2 0x00007ffff7ec52da in boost::detail::sp_counted_base::release() ()

at /home/juneyoung/Programmes/ManhattanSLAM/lib/libManhattanSLAM.so

3 0x00007ffff7f5dab7 in ORB_SLAM2::Frame::ExtractPlanes(cv::Mat const&, cv::Mat const&, cv::Mat const&, float const&) ()

at /home/juneyoung/Programmes/ManhattanSLAM/lib/libManhattanSLAM.so

4 0x00007ffff5c4ede4 in () at /lib/x86_64-linux-gnu/libstdc++.so.6

5 0x00007ffff0ff3609 in start_thread (arg=)

at pthread_create.c:477

6 0x00007ffff5a8d293 in clone ()

at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
razayunus commented 2 years ago

@Rotatingpencil I tried to run with PCL 1.10, it gives an error while creating a point cloud in ExtractPlanes. I suspect it is this issue in PCL: https://github.com/PointCloudLibrary/pcl/issues/4859. In the meanwhile, you can use PCL 1.7.2. It should work with that.

RigerLee commented 2 years ago

Try removing "-march=native" from CMakeLists.txt under "ManhattanSLAM/" and "ManhattanSLAM/Thirdparty/g2o/".

JunyuanDeng commented 2 years ago

Try removing "-march=native" from CMakeLists.txt under "ManhattanSLAM/" and "ManhattanSLAM/Thirdparty/g2o/".

Great! It works now! Thank you!