ORB-SLAM3 paper address: https://arxiv.org/abs/2007.11898
Code address: https://github.com/UZ-SLAMLab/ORB_SLAM3
Native system: Ubuntu 18.04 LTS
Early environment:GCC 7.5、G++ 7.5、Cmake 3.10.2
1. Installation dependencies
1.Pangolin 0.5 Remember: Version ≤ 0.5
Attached is the github URL: https://github.com/stevenlovegrove/Pangolin
Installation command:
1 #安装依赖
2 sudo apt install libglew-dev
3 sudo apt install cmake
4 sudo apt install libpython2.7-dev
5 #可选依赖见github,我没装所以就不贴出来啦
6 #下载并编译
7 git clone https://github.com/stevenlovegrove/Pangolin.git
8 cd Pangolin
9 mkdir build
10 cd build
11 cmake ..
12 cmake --build .
13 #最后不要忘了安装
14 sudo make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
2.OpenCV 3.2.0
download the official website (https://opencv.org/releases/)
opencv3.2.0 installation package
installation command:
1 #安装依赖
2 sudo apt-get install build-essential
3 sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
4 sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
5 #再加上以下依赖,后面出错了,所以先加上
6 sudo apt-get install libgtk-3-dev
7 sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
8 #进入文件夹编译安装
9 mkdir build
10 cd build
11 cmake -D ENABLE_PRECOMPILED_HEADERS=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
12 sudo make -j8
13 sudo make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
Environment configuration:
1. sudo gedit /etc/ld.so.conf.d/opencv.conf #添加库路径
2. #里面应该是
3. /usr/local/lib #没有则加上
4. sudo gedit ~/.profile #添加环境变量
5. #末尾加上
6. PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
7. export PKG_CONFIG_PATH
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Common error:
Unable to locate packagelibjasper-dev
1 sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
2 sudo apt update
3 sudo apt install libjasper1 libjasper-dev
- 1
- 2
- 3
- 4
3. ROS Melodic
installs the corresponding version of ROS according to the ROS official website (http://wiki.ros.org/melodic/Installation/Ubuntu)
. The ROS Melodic installation command is installed on this machine
:
1 #加链接和钥匙
2 sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
3 sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
4 sudo apt update
5 #安装完整版,其他的见官网
6 sudo apt install ros-melodic-desktop-full
7 #环境配置
8 echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
9 source ~/.bashrc
10 安装依赖
11 sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
12 sudo apt install python-rosdep
13 sudo rosdep init
14 rosdep update
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
Common errors: The main reason sudo rosdep inti、rosdep update
for reporting errors
is because www.rawgithubusercontent.com
this website is blocked. The error is easy to solve. The error solution
sudo rosdep inti
is provided below : 1. Open the file containing the resource download function:rosdep update
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
- 1
2. Add proxy: ( download_rosdep_data
Add the following code in the first line of function try)
url="https://ghproxy.com/"+url
- 1
3. Modify /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
the fileDEFAULT_INDEX_URL
1. sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
2. DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
- 1
- 2
4. Modify the addresses in the remaining 4 files and https://raw.githubusercontent.com/...
add before the addresshttps://ghproxy.com/
1. sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
2. //修改第36行的地址
3. sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py 72行
4. //修改第72行
5. sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
6. //修改第39行
7. sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py
8. //修改第68行、119行
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
5. Solve the error report of the fifth address of Hit
1. sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
2. //在第204行添加如下代码(即在该函数块下的第一行处)
3. gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url
4. //注意,原网址中代理地址的双引号是中文,直接粘贴复制会报字符识别错误
- 1
- 2
- 3
- 4
- Run it again
rosdep update
and find that the problem is perfectly solved!
After successful installation, create and initialize the working directory
1. mkdir -p ~/catkin_ws/src
2. cd ~/catkin_ws/src
3. catkin_init_workspace
4. cd ~/catkin_ws/ #直接$ cd .. 也一样
5. catkin_make
6. #catkin的构建系统的相关文件保存在build目录中,构建后的可执行文件保存在devel目录中
7. #加载与catkin构建系统相关的环境文件
8. $ source ~/catkin_ws/devel/setup.bash
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
In order to build and manage developers' own ROS workspaces, rosinstall needs to be installed.
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
- 1
test:
1. # 第一个终端运行如下命令
2. roscore
3. # 打开第二个终端,这时你会看见一只静止的小海龟
4. rosrun turtlesim turtlesim_node
5. # 如果希望小海龟能够移动,打开第三个终端
6. rosrun turtlesim turtle_teleop_key
- 1
- 2
- 3
- 4
- 5
- 6
4.Eigen 3
installation command:
sudo apt-get install libeigen3-dev
- 1
Common errors: Errors are reported when subsequent calls to eigen are made. fatal error: Eigen/Core: No such file or directory
Because the eigen library is installed in /usr/include/eigen3/Eigen
the path by default, you need to use the following command to map it to /usr/include
the path.
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
- 1
5.Boost 1.72
official website http://www.boost.org/users/download/
download source code
installation command
1. #解压
2. tar -xvf boost_1_72_0.tar.bz2
3. #运行解压后生成的bootstrap.sh文件:
4. cd ./boost_1_72_0
5. ./bootstrap.sh
6. #然后使用b2工具进行安装:
7. sudo ./b2 install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
After the installation is completed, the header files are in /usr/local/include
the directory by default, and the .a and .so files are in /usr/local/lib
the directory.
6.ORB-SLAM3
Place the downloaded ORB-SLAM3 file into the src folder of the ROS workspace and compile the
installation command (non-ROS version) :
1. #注意在ROS工作空间的src文件夹中下载,或者是下载完成后移入工作空间
2. git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git ORB_SLAM3
3. #编译
4. cd ORB_SLAM3
5. chmod +x build.sh
6. ./build.sh
- 1
- 2
- 3
- 4
- 5
- 6
Common Mistakes: recipe for target ‘CMakeFiles/ORB_SLAM3.dir/src/LocalMapping.cc.o‘ failed
Solution:
Add the following code toORB_SLAM3-master/include/CameraModels/KannalaBrandt8.h
namespace cv
{
template<typename _Tp, int m, int n> static inline Matx<_Tp, m, n> operator / (const Matx<_Tp, m, n>& a, float alpha)
{
return Matx<_Tp, m, n>(a, 1.f / alpha, Matx_ScaleOp());
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
Installation command (ROS version) :
1. #添加环境变量
2. gedit ~/.bashrc
3. #加入以下内容,PATH改为自己的地址
4. #export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples/ROS
5. export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/yu/catkin_ws/src/ORB_SLAM3/Examples/ROS
6. #再加个这个吧
7. source ~/catkin_ws/devel/setup.bash
8. #编译
9. chmod +x build_ros.sh
10. ./build_ros.sh
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
7. Download the data set and run the demo official
website . If you do not use ROS to run, download the ASL format. If you use ROS to run, download the ROS bag non-ROS version . Modify the data set address in the ORB-SLAM3/euroc_examples.sh file.(https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets)
1. #!/bin/bash
2. #pathDatasetEuroc='/Datasets/EuRoC' #Example, it is necesary to change it by the dataset path
3. pathDatasetEuroc='/home/yu/Datasets' #Example, it is necesary to change it by the dataset path
- 1
- 2
- 3
In addition, the data set file name needs to be changed to the corresponding name in the euroc_examples.sh file, for example, MH_01_easy is changed to MH01.
Next, run the demo
./euroc_examples.sh
- 1
ROS version
install librealsense (using Intel realsense D400 series cameras)
1. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
2. sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
3. sudo apt-get install librealsense2-dkms
4. sudo apt-get install librealsense2-utils
5. sudo apt-get install librealsense2-dev
- 1
- 2
- 3
- 4
- 5
test:
Realsense-viewer
- 1
Camera driver realsense-ros
sudo apt-get install ros-melodic-realsense2-camera
- 1
After compilation is completed, use the following command to test:
roslaunch realsense2_camera demo_pointcloud.launch
- 1
Modify the corresponding node:
1. 打开 ORB_SLAM3/Examples/ROS/ORB_SLAM3/src/ros_rgbd.cc 文件
2. 修改节点(绿色字体)
3. message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, "/camera/color/image_raw", 1);
4. message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, "/camera/aligned_depth_to_color/image_raw", 1);
5. 回到ORB-SLAM3文件夹路径下运行以下命令
6. ./build_ros.sh
- 1
- 2
- 3
- 4
- 5
- 6
After the camera is calibrated, modify ORB_SLAM3/Examples/ROS/ORB_SLAM3/Asus.yaml
the file
1. cd ~/catkin_ws/src/ORB_SLAM
2. #分别开三个终端, 按顺序每个终端运行一句
3. roscore
4. roslaunch realsense2_camera rs_rgbd.launch
5. rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/D455.yaml
- 1
- 2
- 3
- 4
- 5
reference:
https://blog.csdn.net/qq_36804414/article/details/109241264
https://blog.csdn.net/weixin_43311920/article/details/114796748?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.control
https://zhuanlan.zhihu.com/p/392082731
https://www.jianshu.com/p/4c621a34ba69
https://blog.csdn.net/qq_39247667/article/details/116707889?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.control
https://blog.csdn.net/weixin_48464886/article/details/118970304
https://github.com/UZ-SLAMLab/ORB_SLAM3
https://www.cnblogs.com/dinghongkai/p/11308805.html
https://blog.csdn.net/ByYastal/article/details/111589721?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link