rtabmap icon indicating copy to clipboard operation
rtabmap copied to clipboard

RTABMAP with orbslam3

Open TakahikoHasegawa03 opened this issue 1 year ago • 9 comments

Hi there,

im trying to use ORB_SLAM3 for visual odometry in rtabmap but I’m struggling to set the environment.

i did the following procedure:

  1. Install ORBSLAM3 git clone -b v0.4-beta https://github.com/UZ-SLAMLab/ORB_SLAM3.git cd ORB_SLAM3/ wget https://gist.githubusercontent.com/matlabbe/f5cb281304a1305b2824a6ce19792e13/raw/f8bbc796edc29b9f815cbf3c99a0c3e13e23663d/orbslam3_v4_rtabmap_fix.patch git apply orbslam3_v4_rtabmap_fix.patch ./build.sh

  2. Configure the environment sudo gedit ~/.bashrc export ORB_SLAM_ROOT_DIR=/home/lib/ORB_SLAM3 source ~/.bashrc

  3. Build rtabmap in my work space cd ~/home/ros2_ws/src/rtabmap cd build/ cmake -DWITH_G2O=OFF -DWITH_ORB_SLAM=ON .. make -j4 Make install

  4. Build ros2 rtabmap cd ros2_ws/ Colcon build —packages-select rtabmap rtabmap_ros —cmake-args -DWITH_ORB_SLAM=ON

  5. Source ros2_ws/install/setup.bash

  6. Ros2 run rtabmap_ros rtabmap —version

Then it still shows orbslam being false.

what am I doing wrong?

Thanks in advance

TakahikoHasegawa03 avatar Aug 02 '23 09:08 TakahikoHasegawa03

on step 3, after cmake -DWITH_G2O=OFF -DWITH_ORB_SLAM=ON .., make sure you see in cmake info at the end that WITH_ORB_SLAM is YES. If so maybe the rtabmap_ros is linking on another installed version of rtabmap, make sure rtabmap binaries are not installed.

matlabbe avatar Aug 06 '23 21:08 matlabbe

Ok I have managed to get the environment set up now! but I have a few questions, can I use IMU input to make the odometry VIO?

what’s the launch file for orbslam 3 like?

TakahikoHasegawa03 avatar Aug 06 '23 23:08 TakahikoHasegawa03

When I integrated the first time, I had difficulty to feed correctly the IMU messages to ORB_SLAM3, so the current integration with IMU for ORB_SLAM3 in rtabmap is not finished.

To use under ros, see answer here https://answers.ros.org/question/318721/use-rtab-map-with-orb_slam2-in-ros/

though now it is (if you don't want deprecated warning, and using new package name):

<node pkg="rtabmap_odom" type="rgbd_odometry" name="rgbd_odometry">
   ...
   <param name="Odom/Strategy" value="5"/>
   <param name="OdomORBSLAM/VocPath" value="PATH/TO/ORB_SLAM/Vocabulary/ORBvoc.txt"/>
</node>

matlabbe avatar Aug 07 '23 14:08 matlabbe

Is there any docker file with orbslam integration working?

fbliman avatar Aug 16 '23 13:08 fbliman

There's one with ORB_SLAM2 here: https://github.com/introlab/rtabmap/blob/61dbe51ee3cea7a661d5a7a90c20a828074bd480/docker/jfr2018/latest/Dockerfile#L156-L158

matlabbe avatar Aug 20 '23 21:08 matlabbe

Thanks! I am getting this error almost at the end when applying a patch for opencv 3.2, any idea?

Details
=> ERROR [51/57] RUN cd rtabmap && wget https://gist.githubusercontent.com/matlabbe/ab42b8ea5d5902ffc6177539b  0.5s
------
 > [51/57] RUN cd rtabmap && wget https://gist.githubusercontent.com/matlabbe/ab42b8ea5d5902ffc6177539b98d9d51/raw/87520db7a54bf2673be3fc898578cd6348dd66f0/rtabmap_opencv310_backward_compatibility.patch && git apply --ignore-space-change --ignore-whitespace rtabmap_opencv310_backward_compatibility.patch:
0.265 --2023-08-22 12:59:08--  https://gist.githubusercontent.com/matlabbe/ab42b8ea5d5902ffc6177539b98d9d51/raw/87520db7a54bf2673be3fc898578cd6348dd66f0/rtabmap_opencv310_backward_compatibility.patch
0.266 Resolving gist.githubusercontent.com (gist.githubusercontent.com)... 185.199.108.133, 185.199.110.133, 185.199.109.133, ...
0.311 Connecting to gist.githubusercontent.com (gist.githubusercontent.com)|185.199.108.133|:443... connected.
0.450 HTTP request sent, awaiting response... 200 OK
0.461 Length: 767 [text/plain]
0.461 Saving to: ‘rtabmap_opencv310_backward_compatibility.patch’
0.461 
0.461      0K                                                       100% 30.1M=0s
0.461 
0.461 2023-08-22 12:59:08 (30.1 MB/s) - ‘rtabmap_opencv310_backward_compatibility.patch’ saved [767/767]
0.461 
0.470 error: patch failed: CMakeLists.txt:222
0.470 error: CMakeLists.txt: patch does not apply
------
Dockerfile:234
--------------------
 232 |     
 233 |     # Patch for OpenCV 3.1
 234 | >>> RUN cd rtabmap && wget https://gist.githubusercontent.com/matlabbe/ab42b8ea5d5902ffc6177539b98d9d51/raw/87520db7a54bf2673be3fc898578cd6348dd66f0/rtabmap_opencv310_backward_compatibility.patch && git apply --ignore-space-change --ignore-whitespace rtabmap_opencv310_backward_compatibility.patch
 235 |     
 236 |     # Build RTAB-Map (using standard g2o, then a version for orbslam2, which uses its own g2o version)
--------------------
ERROR: failed to solve: process "/bin/sh -c cd rtabmap && wget https://gist.githubusercontent.com/matlabbe/ab42b8ea5d5902ffc6177539b98d9d51/raw/87520db7a54bf2673be3fc898578cd6348dd66f0/rtabmap_opencv310_backward_compatibility.patch && git apply --ignore-space-change --ignore-whitespace rtabmap_opencv310_backward_compatibility.patch" did not complete successfully: exit code: 1

fbliman avatar Aug 22 '23 13:08 fbliman

You may not have to apply the opencv3.1 patch for opencv 3.2.

matlabbe avatar Aug 27 '23 20:08 matlabbe

Ok I have managed to get the environment set up now! but I have a few questions, can I use IMU input to make the odometry VIO?

what’s the launch file for orbslam 3 like?

Hi,I meet the same trouble as you showed at step 7,how did you solve it?

zsbztdxx avatar Sep 23 '23 09:09 zsbztdxx

Ok I have managed to get the environment set up now! but I have a few questions, can I use IMU input to make the odometry VIO? what’s the launch file for orbslam 3 like?

Hi,I meet the same trouble as you showed at step 7,how did you solve it?

ok,I have solved it,just take rtabmap out of ros workspace,and set RTABMap_DIR in .bashrc

zsbztdxx avatar Sep 27 '23 04:09 zsbztdxx