How to use ORB_SLAM2 library in rtabmap?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use ORB_SLAM2 library in rtabmap?

Mosquito
I find the OdometryORBSLAM2.cpp file and FindORB_SLAM2.cmake file in the project.
I want to use ORBSLAM2’s lib in the rtabmap,but when I build the project using "$cmake ..",it shows as follow:

-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- checking for module 'openni-dev'
--   package 'openni-dev' not found
-- Found OpenMP
-- Found OpenCV: /usr/include/opencv;/usr/include
-- Found PCL: /usr/include/pcl-1.7;/usr/include/eigen3;/usr/include;/usr/include/ni;/usr/include/vtk-5.8
-- Found ZLIB: /usr/include
-- Found Freenect: /usr/include
CMake Warning at cmake_modules/FindKinectSDK2.cmake:71 (message):
  Directory "" not found.
Call Stack (most recent call first):
  cmake_modules/FindKinectSDK2.cmake:119 (check_dir)
  CMakeLists.txt:270 (FIND_PACKAGE)


-- KinectSDK2_FOUND : FALSE
-- Found OpenNI2: /usr/include/openni2
-- Found DC1394: /usr/include/dc1394
-- Found g2o: /opt/ros/indigo/include;/usr/include/suitesparse;/usr/include/suitesparse
-- Found RealSense: /opt/ros/indigo/include
-- Found octomap: /usr/local/include
-- Found Pthreads
-- --------------------------------------------
-- Info :
--   Version : 0.15.0
--   CMAKE_INSTALL_PREFIX = /usr/local
--   CMAKE_BUILD_TYPE =     Debug
--   CMAKE_INSTALL_LIBDIR = lib
--   BUILD_APP =            ON
--   BUILD_TOOLS =          ON
--   BUILD_EXAMPLES =       ON
--   BUILD_SHARED_LIBS =    ON
--   CMAKE_CXX_FLAGS =  -fmessage-length=0  -Wno-deprecated -fopenmp -std=c++11
--   With OpenCV 2 nonfree module (SIFT/SURF) = NO (not found, License: BSD)
--   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 dc1394               = YES (License: LGPL)
--   With FlyCapture2/Triclops = NO (Point Grey SDK not found)
--   With TORO                 = YES (License: Creative Commons [Attribution-NonCommercial-ShareAlike])
--   With g2o                  = YES (License: BSD)
--   With GTSAM                = NO (GTSAM not found)
--   With VERTIGO              = YES (License: GPLv3)
--   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        = NO (WITH_REALSENSE_SLAM=OFF)
--   With OCTOMAP              = YES (License: BSD)
--   With CPUTSDF              = NO (CPUTSDF not found)
--   With libfovis             = NO (libfovis not found)
--   With libviso2             = NO (libviso2 not found)
--   With dvo_core             = NO (dvo_core not found)
--   With ORB_SLAM2            = NO (WITH_G2O should be OFF as ORB_SLAM2 uses its own g2o version)
--   With Qt4                  = YES (License: Open Source or Commercial)
-- --------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/minipc/rtabmapDebug/build
   

   I have built and run the ORB_SLAM2 project in the home directory. I also tried to install the ORB_SLAM2 in "/usr/local",but failed....
  Can you tell me how to use the ORB_SLAM2 in rtabmap ? THANKS A LOT!!!


Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

matlabbe
Administrator
Hi,

As it is said, set WITH_G2O to off on cmake:
$ cmake -DWITH_G2O=OFF ..

Then to make cmake find ORB_SLAM2, look in findORB_SLAM2.cmake: you have to set an environment variable called ORB_SLAM2_ROOT_DIR that points to root directory of ORB SLAM2 source directory.

Note that ORB_SLAM2 integration is still experimental. To use it, set odometry strategy to ORB_SLAM2 (or Odom/Strategy to 5).

Cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

Mosquito
Thank you Mathieu for your reply!!!!!!
With your help,I have succeed run rtabmap with ORBSLAM2 after several attempts.
I write  my steps down and hope to help more peoples.It is as follow:
1.add "export ORB_SLAM2_ROOT_DIR=/home/minipc/ORB_SLAM2-master " in /home/minipc/ .zshrc file.
2.change 218th row in /tools/RgbdDataset/main.cpp :
change :OdometryF2M odom(parameters); to OdometryORBSLAM2 odom(parameters);
3. cmake -DWITH_G2O=OFF ..
4.make
5 ./rtabmap-rgbd_dataset --OdomORBSLAM2/VocPath "/home/minipc/ORB_SLAM2-master/Vocabulary/ORBvoc.txt" /home/minipc/ORBSLAM2_Octomap2/dataset/rgbd_dataset_freiburg1_desk

Thank you again!
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

Mosquito
This post was updated on .
In reply to this post by matlabbe
Hi,Mathieu:
After I  run :
$./rtabmap-rgbd_dataset --OdomORBSLAM2/VocPath "/home/minipc/ORB_SLAM2-master/Vocabulary/ORBvoc.txt" /home/minipc/ORBSLAM2_Octomap2/dataset/rgbd_dataset_freiburg1_desk  
I get "rtabmap.db",then I run :$rtabmap.I load the rtabmap.db in the rtabmap, then i select to export the trajectory.As follows:

I get pose.txt.Finally, I run :$python evaluate_ate.py groundtruth.txt pose.txt --plot error.png  . I get the graph as follows:
 

In the graph,the estimate poses is very sparse. In the 'rgbd_dataset_freiburg1_desk'  dataset ,It has 573 frames,but the rtabmap finally only get 20 frames' pose.
Can you tell me how to get more frame's pose? Thank you very much!
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

matlabbe
Administrator
Hi,

When starting rtabmap-rgbd_dataset, you can add "--Rtabmap/DetectionRate 2" to update the map at 2 Hz instead of 1 Hz (so there will be two times more nodes). You can also set "--Rtabmap/CreateIntermediateNodes true" to add all odometry poses (in this case, the graph would be the same size than the number of input images).

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

Mosquito
It works! Thank you very much !
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

vkpankov
In reply to this post by Mosquito
Hi,
How to use ORB SLAM2 with RTABMAP in ROS?
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

matlabbe
Administrator
Hi,

If rtabmap is built with ORB-SLAM2 like above, you can set "Odom/Strategy" parameter to 5 for the rgbd_odometry or stereo_odometry node. You will also need to set "OdomORBSLAM2/VocPath" to path of the vocabulary in ORB-SLAM2 project.

Cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to use ORB_SLAM2 library in rtabmap?

lokes_bisht
In reply to this post by vkpankov
Hey, did you get good results after this ? How much improvement did you notice ?