A ROS2 package for ORB SLAM3 V1.0. Focus is on native integration with ROS2 ecosystem. My goal is to provide a "bare-bones" starting point for developers in using ORB SLAM3 framework in their ROS 2 projects. Hence, this package will not use more advanced features of ROS 2 such as rviz, tf and launch files. This project structure is heavily influenced by the excellent ROS1 port of ORB SLAM3 by thien94.
The following softwares must be installed before this package can be installed and used correctly
sudo apt install libeigen3-dev
We install Pangolin system wide and configure the dynamic library path so the necessary .so from Pangolin can be found by ros2 package during run time. More info here https://robotics.stackexchange.com/questions/105973/ros2-port-of-orb-slam3-can-copy-libdow2-so-and-libg2o-so-using-cmake-but-gettin
cd ~/Documents
git clone https://github.com/stevenlovegrove/Pangolin
cd Pangolin
./scripts/install_prerequisites.sh --dry-run recommended [Check what recommended softwares needs to be installed]
./scripts/install_prerequisites.sh recommended [Install recommended dependencies]
cmake -B build
cmake --build build -j4
sudo cmake --install build
Check if /usr/lib/local
is in the LIBRARY PATH
echo $LD_LIBRARY_PATH
If not, then perform the following
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/local
sudo ldconfig
Then open the .bashrc
file in \home
directory and add these lines at the very end
if [[ ":$LD_LIBRARY_PATH:" != *":/usr/local/lib:"* ]]; then
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
fi
Finally, source .bashrc
file
source ~/.bashrc
Ubuntu 22.04 by default comes with >OpenCV 4.2. Check to make sure you have at least 4.2 installed. Run the following in a terminal
python3 -c "import cv2; print(cv2.__version__)"
In a new terminal move to home directory
cd ~
Create the ros2_test
workspace, and download this package as shown below.
mkdir -p ~/ros2_test/src
cd ~/ros2_test/src
git clone https://github.com/Mechazo11/ros2_orb_slam3.git
cd .. [make sure you are in ~/ros2_ws root directory]
For this repo, the name of the workspace must be ros2_test
. You may change it later (marked with "!Change this ...." comments found in pertinent .hpp and .py files.
Source ROS2 Humble tools and run colcon build commands
source /opt/ros/humble/setup.bash
colcon build --symlink-install
Run the builtin example to verify the package is working correctly In one terminal [cpp node]
cd ~\ros2_ws
source install/setup.bash
ros2 run ros2_orb_slam3 mono_node_cpp --ros-args -p node_name_arg:=mono_slam_cpp
In another terminal [python node]
cd ~\ros2_ws
source install/setup.bash
ros2 run ros2_orb_slam3 mono_driver_node.py --ros-args -p settings_name:=EuRoC -p image_seq:=sample_euroc_MH05
Both nodes would perform a handshake and the VSLAM framework would then work as shown in the following video clip
https://github.com/Mechazo11/ros2_orb_slam3/assets/44814419/af9eaa79-da4b-4405-a4d7-e09242ab9660
Thank you for taking the time in checking this project out. I hope it helps you out. If you find this package useful in your project consider citing the original ORB SLAM3 paper and one of my recent papers shown below