高版本Ubuntu(22.04/20.04)安装ORB-SLAM2并试运行
本文最后更新于:2022年9月12日 晚上
ubuntu 20.04 篇
- install Pangolin, not follow the github guild, follow me
- sudo apt install libgl1-mesa-dev
- sudo apt install libglew-dev
- sudo apt install cmake
- download Pangolin and cd Pangolin
- mkdir build && cd build
- sudo apt install libeigen3-dev
- cmake ..
- cmake –build .
- sudo make install
- install opencv-3.4.6
- sudo apt install build-essential
- sudo apt install libgtk2.0-dev
- sudo apt install libavcodec-dev
- sudo apt install libavformat-dev
- sudo apt install libjpeg.dev (maybe libjpef-dev also working)
- download opencv-3.4.6 source
- cd opencv
- mkdir build && cd build
- cmake ..
- make -j8 (so many warnings, but no error)
- sudo make install
- build ORB-SLAM2 (https://github.com/raulmur/ORB_SLAM2)
- git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
- sudo apt install libcanberra-gtk-module
- cd ORB_SLAM2/
- chmod +x build.sh
- sed -i ‘s/++11/++14/g’ CMakeLists.txt
- add add_definitions(-w) to CMakeLists.txt
- change find_package(Eigen3 3.1.0 REQUIRED) to find_package(Eigen3 3.1.0 REQUIRED NO_MODULE)
- add #include <unistd.h> to LoopClosing.h
- edit LoopClosing.hchange to
1
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
1
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,Eigen::aligned_allocator<std::pair<KeyFrame *const, g2o::Sim3> > > KeyFrameAndPose;
- ./build.sh
- run ORB-SLAM2
- sudo ldconfig
- ./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/conan/slam2/datasets/rgbd_dataset_freiburg1_desk
- install anaconda
- create py27 env
- activate py27 and pip install numpy
- download associate.py and move to datasets, cd datasets path
- python associate.py rgb.txt depth.txt > associations.txt
- ./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/conan/slam2/datasets/rgbd_dataset_freiburg1_desk /home/conan/slam2/datasets/rgbd_dataset_freiburg1_desk/associations.txt
Ubuntu 22.04 篇
- install Pangolin, not follow the github guild, follow me
- sudo apt install libgl1-mesa-dev
- sudo apt install libglew-dev
- sudo apt install cmake
- download Pangolin and cd Pangolin
- mkdir build && cd build
- manual install eigen3(3.3.7), do not use the apt to install eigen3 (like: apt install libeigen3-dev, in 22.04, the version of eigen is 3.4.0, does not fit for plangolin)
- cmake ..
- cmake –build .
- sudo make install
- install opencv-3.4.6
- sudo apt install build-essential
- sudo apt install libgtk2.0-dev
- sudo apt install libavcodec-dev
- sudo apt install libavformat-dev
- sudo apt install libjpeg-dev
- download opencv-3.4.6 source
- cd opencv
- mkdir build && cd build
- cmake ..
- make sure change the gcc version to 9, ubuntu 22.04 default gcc version is 11
- make -j8 (so many warnings, but no error)
- sudo make install
- build ORB-SLAM2 (https://github.com/raulmur/ORB_SLAM2)
- git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
- sudo apt install libcanberra-gtk-module
- cd ORB_SLAM2/
- chmod +x build.sh
- sed -i ‘s/++11/++14/g’ CMakeLists.txt
- add add_definitions(-w) to CMakeLists.txt
- change find_package(Eigen3 3.1.0 REQUIRED) to find_package(Eigen3 3.1.0 REQUIRED NO_MODULE)
- add #include <unistd.h> to LoopClosing.h
- edit LoopClosing.hchange to
1
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,Eigen::aligned_allocator<std::pair<const KeyFrame*, g2o::Sim3> > > KeyFrameAndPose;
1
typedef map<KeyFrame*,g2o::Sim3,std::less<KeyFrame*>,Eigen::aligned_allocator<std::pair<KeyFrame *const, g2o::Sim3> > > KeyFrameAndPose;
- ./build.sh
- run ORB-SLAM2
- sudo ldconfig
- ./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/conan/slam2/datasets/rgbd_dataset_freiburg1_desk
- install anaconda
- create py27 env
- activate py27 and pip install numpy
- download associate.py and move to datasets, cd datasets path
- python associate.py rgb.txt depth.txt > associations.txt
- ./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/conan/slam2/datasets/rgbd_dataset_freiburg1_desk /home/conan/slam2/datasets/rgbd_dataset_freiburg1_desk/associations.txt
高版本Ubuntu(22.04/20.04)安装ORB-SLAM2并试运行
https://cnwjy.site/2022/09/01/高版本Ubuntu-22-04-20-04-安装ORB-SLAM2并试运行/