Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORB SLAM2 #287

Open
AnGPU opened this issue Jun 13, 2018 · 14 comments
Open

ORB SLAM2 #287

AnGPU opened this issue Jun 13, 2018 · 14 comments

Comments

@AnGPU
Copy link

AnGPU commented Jun 13, 2018

Hi Mathieu
after several attempts following this http://official-rtab-map-forum.206.s1.nabble.com/How-to-use-ORB-SLAM2-library-in-rtabmap-td4230.html I managed to get the orb2 slam to be recognized in the cmake but after continuing the installation, trying to run rtabmap to set the odometry strategy I got this before anything works:
"rtabmap: error while loading shared libraries: libg2o.so: cannot open shared object file: No such file or directory" but it is in the place pointed by the findORB_SLAM2.cmake
I found almost similar situation with another libraries here and try sudo ldconfig but didn't work.
I try to run in gdb with bt as seen in other issues if I could find more information but:
*(gdb) run
Starting program: /usr/local/bin/rtabmap
/usr/local/bin/rtabmap: error while loading shared libraries: libg2o.so: cannot open shared object file: No such file or directory
[Inferior 1 (process 10258) exited with code 0177]
(gdb) bt
No stack.
*
System: ubuntu 16.04 rtabmap: standalone 0.17.2

edit*
next step
changing line 13 in findORB_SLAM2.cmake to: find_library(g2o_LIBRARY NAMES libg2o.so PATHS $ENV{ORB_SLAM2_ROOT_DIR}/Thirdparty/g2o/lib) that library is being recognized but in the make step,
after relink types_sba.h,types_six_dof_expmap.h and linear_solver_eigen.h to the right path in lines 73, 74, 75 respectively in OptimizerG2O.cpp, crash at 6% within building:

[ 6%] Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/OptimizerG2O.cpp.o
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp: In member function ‘virtual bool rtabmap::EdgeSE3Expmap::setMeasurementData(const double*)’:
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:794:24: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
Eigen::Map v(d);
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:794:37: error: template argument 1 is invalid
Eigen::Map v(d);
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:794:42: error: invalid conversion from ‘const double*’ to ‘int’ [-fpermissive]
Eigen::Map v(d);
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:795:32: error: no matching function for call to ‘g2o::SE3Quat::fromVector(int&)’
measurement.fromVector(v);
^
In file included from /usr/local/include/g2o/types/sba/sbacam.h:46:0,
from /usr/local/include/g2o/types/sba/types_sba.h:33,
from /home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:73:
/usr/local/include/g2o/types/slam3d/se3quat.h:145:19: note: candidate: void g2o::SE3Quat::fromVector(const Vector7&)
inline void fromVector(const Vector7& v){
^
/usr/local/include/g2o/types/slam3d/se3quat.h:145:19: note: no known conversion for argument 1 from ‘int’ to ‘const Vector7& {aka const Eigen::Matrix<double, 7, 1, 0, 7, 1>&}’
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp: In member function ‘virtual bool rtabmap::EdgeSE3Expmap::getMeasurementData(double*) const’:
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:801:18: error: ‘Vector7d’ is not a member of ‘g2o’
Eigen::Mapg2o::Vector7d v(d);
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:801:18: error: ‘Vector7d’ is not a member of ‘g2o’
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:801:31: error: template argument 1 is invalid
Eigen::Mapg2o::Vector7d v(d);
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:801:36: error: invalid conversion from ‘double*’ to ‘int’ [-fpermissive]
Eigen::Mapg2o::Vector7d v(d);
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:802:9: error: cannot convert ‘g2o::Vector7 {aka Eigen::Matrix<double, 7, 1, 0, 7, 1>}’ to ‘int’ in assignment
v = measurement.toVector();
^
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp: In member function ‘virtual std::map<int, rtabmap::Transform> rtabmap::OptimizerG2O::optimizeBA(int, const std::map<int, rtabmap::Transform>&, const std::multimap<int, rtabmap::Link>&, const std::map<int, rtabmap::CameraModel>&, std::map<int, cv::Point3
>&, const std::map<int, std::map<int, cv::Point3
> >&, std::set)’:
/home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:907:104: error: no matching function for call to ‘g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::BlockSolver(g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::LinearSolverType
&)’
w g2o::OptimizationAlgorithmLevenberg(new g2o::BlockSolver_6_3(linearSolver)));
^
In file included from /usr/local/include/g2o/core/block_solver.h:199:0,
from /home/antonioguerrero/rtabmap/corelib/src/OptimizerG2O.cpp:43:
/usr/local/include/g2o/core/block_solver.hpp:40:1: note: candidate: g2o::BlockSolver::BlockSolver(std::unique_ptr) [with Traits = g2o::BlockSolverTraits<6, 3>; typename Traits::LinearSolverType = g2o::LinearSolver<Eigen::Matrix<double, 6, 6, 0> >]
BlockSolver::BlockSolver(std::unique_ptr linearSolver
^
/usr/local/include/g2o/core/block_solver.hpp:40:1: note: no known conversion for argument 1 from ‘g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::LinearSolverType* {aka g2o::LinearSolver<Eigen::Matrix<double, 6, 6, 0> >*}’ to ‘std::unique_ptr<g2o::LinearSolver<Eigen::Matrix<double, 6, 6, 0> >, std::default_delete<g2o::LinearSolver<Eigen::Matrix<double, 6, 6, 0> > > >’
corelib/src/CMakeFiles/rtabmap_core.dir/build.make:1027: fallo en las instrucciones para el objetivo 'corelib/src/CMakeFiles/rtabmap_core.dir/OptimizerG2O.cpp.o'

edit2*
to solve problems of OptimizerG2O.cpp from 794 to 802 correct the code this way:
Eigen::Mapg2o::Vector7d -> Eigen::Mapg2o::Vector7
still workin on problem line 907

@AnGPU AnGPU changed the title ORB2 SLAM ORB SLAM2 Jun 14, 2018
@matlabbe
Copy link
Member

Hi,

You should not have to modify the cmake files. When using ORB_SLAM2, you cannot link on g2o installed in /usr/local. When doing "cmake WITH_G2O=OFF WITH_ORB_SLAM2=ON ..", g2o version in ORB_SLAM2 (which is not compatible with g2o version installed by source) will be used instead. On runtime, you should make sure to add the path of g2o library built in ORB_SLAM2 library to LD_LIBRARY_PATH so that libg2o.so can be found:

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

This is what I do in my .bashrc file:
$ export LD_LIBRARY_PATH=/home/mathieu/workspace/ORB_SLAM2/lib:/home/mathieu/workspace/ORB_SLAM2/Thirdparty/g2o/lib:/home/mathieu/workspace/ORB_SLAM2/Thirdparty/DBoW2/lib:$LD_LIBRARY_PATH

cheers,
Mathieu

@AnGPU
Copy link
Author

AnGPU commented Jun 19, 2018

Thanks!
Now it runs but sends an Error message related with this part of the OdometryORBSLAM2.cpp code.
"if(data.imageRaw().empty() ||
data.imageRaw().rows != data.depthOrRightRaw().rows ||
data.imageRaw().cols != data.depthOrRightRaw().cols)
{
UERROR("Not supported input!");
return t;
}"
"[ERROR] (2018-06-19 11:40:53.312) OdometryORBSLAM2.cpp:862::computeTransform() Not supported input!"
Should I open another issue and close this or ask here directly? I supposed it could be a problem from the source but I've never seen this kind of problem working with the configuration of the realsense zr300.

matlabbe added a commit that referenced this issue Jun 19, 2018
…LAM2 with depth and RGB images with same size #287.
@matlabbe
Copy link
Member

In the commit above, I added an option to RealSense driver to scale depth image to RGB size so that both images have the same size, which is required for ORB_SLAM2. The option is in Preferences->Source, then under RealSense group box: "Depth image scaled to RGB image size.". You can give a try.

@AnGPU
Copy link
Author

AnGPU commented Jun 20, 2018

It runs for several seconds and then segmentation fault.
trying with gdb shows this:

Thread 21 "rtabmap" received signal SIGSEGV, Segmentation fault.
[Changing to Thread 0x7fff92003700 (LWP 9958)]
0x00007fffe70a7a15 in ORB_SLAM2::Optimizer::PoseOptimization(ORB_SLAM2::Frame*)
() from /home/antonioguerrero/ORB_SLAM2/lib/libORB_SLAM2.so

@matlabbe
Copy link
Member

You can do "bt" in gdb to get a backtrace. However, the error seems coming from ORB_SLAM2 library. I don't have this error on my system though, I can run it for minutes without crashing. Can you show how did you build ORB_SLAM2 and rtabmap (cmake command lines and cmake status)? Are you using PCL 1.8 as it may be an Eigen problem (PCL 1.8 is built with -march=native)? Can you also show output of ldd rtabmap?

cheers,
Mathieu

@AnGPU
Copy link
Author

AnGPU commented Jun 21, 2018

(gdb) bt
#0 0x00007fffe70a72de in ORB_SLAM2::Optimizer::PoseOptimization(ORB_SLAM2::Frame*) () from /home/antonioguerrero/ORB_SLAM2/lib/libORB_SLAM2.so
#1 0x00007fffe7043eaf in ORB_SLAM2::Tracking::TrackReferenceKeyFrame() ()
from /home/antonioguerrero/ORB_SLAM2/lib/libORB_SLAM2.so
#2 0x00007ffff72b4570 in ORB_SLAM2::Tracker::Track() ()
from /usr/local/lib/librtabmap_core.so.0.17
#3 0x00007ffff72b4eba in ORB_SLAM2::Tracker::GrabImageRGBD(cv::Mat const&, cv::Mat const&, double const&) () from /usr/local/lib/librtabmap_core.so.0.17
#4 0x00007ffff72acdeb in rtabmap::OdometryORBSLAM2::computeTransform(rtabmap::SensorData&, rtabmap::Transform const&, rtabmap::OdometryInfo*) ()
from /usr/local/lib/librtabmap_core.so.0.17
#5 0x00007ffff7278a65 in rtabmap::Odometry::process(rtabmap::SensorData&, rtabmap::Transform const&, rtabmap::OdometryInfo*) ()
from /usr/local/lib/librtabmap_core.so.0.17
#6 0x00007ffff727cd07 in rtabmap::Odometry::process(rtabmap::SensorData&, rtabmap::OdometryInfo*) () from /usr/local/lib/librtabmap_core.so.0.17
#7 0x00007ffff728d168 in rtabmap::OdometryThread::mainLoop() ()
from /usr/local/lib/librtabmap_core.so.0.17
#8 0x00007ffff2697a89 in UThreadC::ThreadMainHandler(UThreadC::Instance*) () from /usr/local/lib/librtabmap_utilite.so.0.17
#9 0x00007ffff0da06ba in start_thread (arg=0x7fff7d2a2700)
at pthread_create.c:333
#10 0x00007ffff12c141d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

RTABMAP
cmake -DWITH_G2O=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
-- Checking for module 'eigen3'
-- Found eigen3, version 3.3.90
-- 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'
-- No package 'libopenni2' found
-- Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
-- 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
-- Checking for module 'libopenni2'
-- No package 'libopenni2' found
-- Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
-- 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).
-- 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: /opt/ros/kinetic/include/opencv-3.3.1-dev;/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv
-- Found PCL: /usr/include/pcl-1.7;/usr/include/eigen3;/usr/include;/usr/include/ni;/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/libxml2;/usr/include/x86_64-linux-gnu;/usr/include/freetype2;/usr/include/x86_64-linux-gnu/freetype2;/usr/include/jsoncpp;/usr/include/python2.7;/usr/include/tcl
-- Found ZLIB: /usr/include
-- Found DC1394: /usr/include/dc1394
-- Found RealSense: /opt/ros/kinetic/include
-- Found RealSenseSlam: /opt/ros/kinetic/include
-- Found RealSense2:
-- Found octomap 1.8.1: /opt/ros/kinetic/include
-- Found ORB_SLAM2: /home/antonioguerrero/ORB_SLAM2/include;/home/antonioguerrero/ORB_SLAM2/Thirdparty/g2o;/home/antonioguerrero/ORB_SLAM2
-- Found Pangolin: /usr/local/lib/cmake/Pangolin/../../../include;/usr/include;/usr/include;/usr/include;/home/antonioguerrero/eigen
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Found Pthreads


-- Info :
-- Version : 0.17.3
-- 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++11
-- PCL_DEFINITIONS = -DEIGEN_USE_NEW_STDVECTOR;-DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET;-DFLANN_STATIC;-Dqh_QHpointer
-- With OpenCV 3 xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = YES (License: Non commercial)
-- With Freenect = NO (libfreenect not found)
-- With OpenNI2 = NO (OpenNI2 not found)
-- With Freenect2 = NO (libfreenect2 not found)
-- With Kinect for Windows 2 = NO (Kinect for Windows 2 SDK not found)
-- With dc1394 = YES (License: LGPL)
-- With FlyCapture2/Triclops = NO (Point Grey SDK not found)
-- With TORO = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
-- With g2o = NO (WITH_G2O=OFF)
-- With GTSAM = NO (GTSAM not found)
-- With VERTIGO = NO (GTSAM or g2o required)
-- With cvsba = NO (cvsba not found)
-- With libpointmatcher = NO (libpointmatcher not found)
-- With ZED = NO (ZED sdk not found)
-- With RealSense = YES (License: Apache-2)
-- With RealSenseSlam = YES
-- With RealSense2 = YES (License: Apache-2)
-- With OCTOMAP = YES (License: BSD)
-- With CPUTSDF = NO (CPUTSDF not found)
-- With OpenChisel = NO (open_chisel not found)
-- With libfovis = NO (libfovis not found)
-- With libviso2 = NO (libviso2 not found)
-- With dvo_core = NO (dvo_core not found)
-- With okvis = NO (okvis not found)
-- With ORB_SLAM2 = YES (License: GPLv3)
-- With Qt5 = YES (License: Open Source or Commercial)


-- Configuring done
-- Generating done

For ORBSLAM2 I applied this changes from the usual installation to reduce significantly the reading of the vocabulary in embedded platforms raulmur/ORB_SLAM2#21
I'm using the library which comes with ros kinetic -> libpcl1.7
ldd: ./rtabmap: it's not a regular file (translation from spanish warn)

@matlabbe
Copy link
Member

matlabbe commented Jun 28, 2018

I just checked the differences in my clone of ORB_SLAM2 code, and I removed -march=native flags (as PCL on Ubuntu 16.04 is not built with this flag):

~/workspace/ORB_SLAM2$ git diff Thirdparty/g2o/CMakeLists.txt
diff --git a/Thirdparty/g2o/CMakeLists.txt b/Thirdparty/g2o/CMakeLists.txt
index 620e688..ba8396c 100644
--- a/Thirdparty/g2o/CMakeLists.txt
+++ b/Thirdparty/g2o/CMakeLists.txt
@@ -54,8 +54,8 @@ IF(OPENMP_FOUND AND G2O_USE_OPENMP)
 ENDIF(OPENMP_FOUND AND G2O_USE_OPENMP)
 
 # Compiler specific options for gcc
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=native") 
-SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march=native") 
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ") 
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") 
 
 # activate warnings !!!
 SET(g2o_C_FLAGS "${g2o_C_FLAGS} -Wall -W")



~/workspace/ORB_SLAM2$ git diff Thirdparty/DBoW2/CMakeLists.txt
diff --git a/Thirdparty/DBoW2/CMakeLists.txt b/Thirdparty/DBoW2/CMakeLists.txt
index 0eb5126..db34af2 100644
--- a/Thirdparty/DBoW2/CMakeLists.txt
+++ b/Thirdparty/DBoW2/CMakeLists.txt
@@ -1,8 +1,8 @@
 cmake_minimum_required(VERSION 2.8)
 project(DBoW2)
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall  -O3 -march=native ")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall  -O3 -march=native")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall ")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ")
 
 set(HDRS_DBOW2
   DBoW2/BowVector.h


~/workspace/ORB_SLAM2$ git diff CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08a8af4..8190289 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,8 +7,8 @@ ENDIF()
 
 MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})
 
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall  -O3 -march=native ")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall   -O3 -march=native")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall  ")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall   ")
 
 # Check C++11 or C++0x support
 include(CheckCXXCompilerFlag)

You may give a try.

@AnGPU
Copy link
Author

AnGPU commented Jul 4, 2018

Thanks
That seemed to be the problem and now I can run it perfectly.

@AnGPU AnGPU closed this as completed Jul 4, 2018
@AnGPU AnGPU reopened this Jul 16, 2018
@AnGPU
Copy link
Author

AnGPU commented Jul 16, 2018

Hi Mathieu
I'm sorry to have to reopen this thread but trying to reinstall the orb slam2 function, after searching every file from rtabmap and removing it, I can't because of this errors at the end of the make -j4

img_20180716_195610

in the process modifying the files from the comitt with this steps
git clone https://github.com/introlab/rtabmap.git rtabmap
cd rtabmap/build

replacing the files:
corelib/include/rtabmap/core/CameraRGBD.h
corelib/src/CameraRGBD.cpp
corelib/src/OdometryORBSLAM2.cpp
guilib/src/PreferencesDialog.cpp
guilib/src/ui/preferencesDialog.ui

cmake -DWITH_G2O=OFF ..
make -j4
sudo make install

@matlabbe
Copy link
Member

It is strange, these functions should be in PreferencesDialog.cpp:

int PreferencesDialog::getKpMaxFeatures() const
{
return _ui->surf_spinBox_wordsPerImageTarget->value();
}

bool PreferencesDialog::isWordsCountGraphView() const
{
return _ui->radioButton_wordsGraphView->isChecked();
}

@AnGPU
Copy link
Author

AnGPU commented Jul 17, 2018

I don't know. I don't remember to change more than what was made in the commit and don't open it again after that.
Anyway I copy the file again from here and now it works. Thanks for pointing the file, I didn't know where to look for.

@AnGPU
Copy link
Author

AnGPU commented Jul 20, 2018

I'm working in the way to add the commit raulmur/ORB_SLAM2#21 to reduce significantly the time of vocabulary reading within a binary file instead of the txt one which is determining to test this into a embedded system. So I will let this issue open if theres's no inconvenience.

@shenlan1994
Copy link

I tried to compile rtab-map with orb-slam2, but a segmentation fault occurred. The gdb debugging information is as follows:
Thread 35 "rtabmap" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff48898700 (LWP 23066)]
0x00007ffff71c4430 in g2o::BaseBinaryEdge<6, g2o::SE3Quat, g2o::VertexSE3Expmap, g2o::VertexSE3Expmap>::linearizeOplus() ()
from /home/tao/Documents/RTAB-Map/rtabmap/bin/librtabmap_core.so.0.19
(gdb) BT
#0 0x00007ffff71c4430 in g2o::BaseBinaryEdge<6, g2o::SE3Quat, g2o::VertexSE3Expmap, g2o::VertexSE3Expmap>::linearizeOplus() ()
from /home/tao/Documents/RTAB-Map/rtabmap/bin/librtabmap_core.so.0.19
#1 0x00007ffff71c340c in g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::buildSystem()
() from /home/tao/Documents/RTAB-Map/rtabmap/bin/librtabmap_core.so.0.19
#2 0x00007fffea747068 in g2o::OptimizationAlgorithmLevenberg::solve(int, bool) ()
from /home/tao/slam/ORB_SLAM2/Thirdparty/g2o/lib/libg2o.so
#3 0x00007fffea73e3e7 in g2o::SparseOptimizer::optimize(int, bool) ()
from /home/tao/slam/ORB_SLAM2/Thirdparty/g2o/lib/libg2o.so
#4 0x00007ffff71bafa8 in rtabmap::OptimizerG2O::optimizeBA(int, std::map<int, rtabmap::Transform, std::less, std::allocator<std::pair<int const, rtabmap::Transform> > > const&, std::multimap<int, rtabmap::Link, std::less, std::allocator<std::pair<int const, rtabmap::Link> > > const&, std::map<int, rtabmap::CameraModel, std::less, std::allocator<std::pair<int const, rtabmap::CameraModel> > > const&, std::map<int, cv::Point3_, std::less, std::allocator<std::pair<int const, cv::Point3_ > > >&, std::map<int, std::map<int, rtabmap::FeatureBA, std::less, std::allocator<std::pair<int const, rtabmap::FeatureBA> > >, std::less, std::allocator<std::pair<int const, std::map<int, rtabmap::FeatureBA, std::less, std::allocator<std::pair<int const, rtabmap::FeatureBA> > > > > > const&, std::set<int, std::less, std::allocator >) ()
from /home/tao/Documents/RTAB-Map/rtabmap/bin/librtabmap_core.so.0.19
#5 0x00007ffff7272290 in rtabmap::OdometryF2M::computeTransform(rtabmap::SensorData&, rtabmap::Transform const&, rtabmap::OdometryInfo
) ()
from /home/tao/Documents/RTAB-Map/rtabmap/bin/librtabmap_core.so.0.19

I don't know where to find the problem

@matlabbe
Copy link
Member

matlabbe commented Dec 13, 2019

There is a patch here to make ORB_SLAM2 without -mach=native flag. Your error maybe related to this flag, as g2o is using Eigen.

https://gist.githubusercontent.com/matlabbe/c10403c5d44af85cc3585c0e1c601a60/raw/48adf04098960d86ddf225f1a8c68af87bfcf56e/orbslam2_f2e6f51_marchnative_disabled.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants