手把手搭建UBUNTU版ORB—SLAM


对于视觉SLAM来说,目前主流的开源框架使用较多的莫过于ORB-SLAM

接下来就从零开始搭建开发环境,在UBUNTU上运行ORB-SLAM需要一些支持包:

1、git

    sudo apt-get install git

2、cmake

   sudo apt-get install cmake

3、Pangolin

sudo apt-get install libglew-dev libpython2.7-dev
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cmake ..
make
sudo make install

4、Opencv   2.4.11

sudo apt-get install build-essential
apt-get install cmake git libgtk2.0-dev pkg-config lib
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 
cd opencv-2.4.11
mkdir build
cd build
sudo cmake .. -D CMAKE_BUILD_TYPE=Release -DCUDA_nppi_LIBRARY=true =DWITH_CUDA=OFF -DBUILD_TIFF=ON
make 
sudo make install

5、Eigen3

  sudo apt-get install libeigen3-dev

6、DBoW2

7、g2o

 

8、ORB_SLAM

   git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2

   cd ORB_SLAM2

   chmod +x build.sh

   ./build.sh

编译中遇到问题:

1、error:linux/videodev.h : no such file or directory

sudo apt-get install libv4l-dev

sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h

2、/home/jim/beantechs/VSLAM/opencv-2.4.11/modules/contrib/src/rgbdodometry.cpp:65:47: fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory
 #  include <unsupported/Eigen/MatrixFunctions>
找到Eigen3的目录,搜索MatrixFunctions,拷贝整个unsupported目录到/home/jim/beantechs/VSLAM/opencv-2.4.11/modules/contrib/src/目录下

 

或是将对应的文件夹复制到/usr/include/下,举例Eigen安装到了/usr/include/eigen3/,则执行:

 

$ cd /usr/include/eigen3/
$ sudo cp -r unsupported/ ..
$ sudo cp -r Eigen/ ..

3、ORB_SLAM2/src/LocalMapping.cc:108:20: error: ‘usleep’ was not declared in this scope
         usleep(3000)

打开相应的代码,在头文件里面添加usleep 的头文件unistd.h

 4、运行脚本:

./Examples/Monocular/mono_euroc Vocabulary/ORBvoc.txt Examples/Monocular/EuRoC.yaml mav0/cam0/data Examples/Monocular/EuRoC_TimeStamps/MH01.txt

 

附:orb-slam2中关键点提取与Opencv原生对比:左为orb-slam2,右:opencv

 

ROS安装

1、sudo apt-get install ros-melodic-desktop-full

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 install rospack-tools

5、sudo rosdep init

6、rosdep update

7、echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc

8、sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

9、roscore

10、rosrun turtlesim turtle_teleop_key

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM