进入工程目录
按照官网安装ROS版本:前提是已经安装了ROS
1 cd ORB_SLAM2 2 chmod +x build.sh 3 ./build.sh
我们看一下build.sh里面的内容
1 echo "Building ROS nodes" 2 3 cd Examples/ROS/ORB_SLAM2 4 mkdir build 5 cd build 6 cmake .. -DROS_BUILD_TYPE=Release 7 make -j
得到如下,编译成功
1 [ 87%] Linking CXX executable ../Examples/Monocular/mono_tum 2 [ 90%] Linking CXX executable ../Examples/RGB-D/rgbd_tum 3 [ 87%] Linking CXX executable ../Examples/Stereo/stereo_kitti 4 [ 93%] Linking CXX executable ../Examples/Monocular/mono_kitti 5 [ 93%] Built target stereo_kitti 6 [ 93%] Built target rgbd_tum 7 [ 93%] Built target mono_tum 8 [ 96%] Linking CXX executable ../Examples/Stereo/stereo_euroc 9 [100%] Linking CXX executable ../Examples/Monocular/mono_euroc 10 [100%] Built target mono_kitti 11 [100%] Built target stereo_euroc 12 [100%] Built target mono_euroc
//若第一次编译,可能得到以下错误 CMake Error at CMakeLists.txt:40 (find_package): By not providing "FindPangolin.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Pangolin", but CMake did not find one. Could not find a package configuration file provided by "Pangolin" with any of the following names: PangolinConfig.cmake pangolin-config.cmake Add the installation prefix of "Pangolin" to CMAKE_PREFIX_PATH or set "Pangolin_DIR" to a directory containing one of the above files. If "Pangolin" provides a separate development package or SDK, be sure it has been installed. -- Configuring incomplete, errors occurred! See also "/home/leonsun/backup/orb_slam2/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log". //没有安装Pangolin
1 //到home目录 2 mkdir Software 3 cd Software 4 //下载Pangolin并且编译 5 git https://github.com/stevenlovegrove/Pangolin.git 6 //右键提取到此处解压Pangolin文件 7 cd Pangolin 8 mkdir build 9 cd build 10 cmake ..
得到以下错误
1 -- The C compiler identification is GNU 5.4.0 2 -- The CXX compiler identification is GNU 5.4.0 3 -- Check for working C compiler: /usr/bin/cc 4 -- Check for working C compiler: /usr/bin/cc -- works 5 -- Detecting C compiler ABI info 6 -- Detecting C compiler ABI info - done 7 -- Detecting C compile features 8 -- Detecting C compile features - done 9 -- Check for working CXX compiler: /usr/bin/c++ 10 -- Check for working CXX compiler: /usr/bin/c++ -- works 11 -- Detecting CXX compiler ABI info 12 -- Detecting CXX compiler ABI info - done 13 -- Detecting CXX compile features 14 -- Detecting CXX compile features - done 15 Build type not set (defaults to release) 16 -DCMAKE_BUILD_TYPE=Debug for debug 17 CMake Error at CMakeModules/FindGLEW.cmake:51 (MESSAGE): 18 Could not find GLEW 19 Call Stack (most recent call first): 20 src/CMakeLists.txt:122 (find_package)
没有安装GLEW,利用apt-get进行安装
1 sudo apt-get install libglew-dev
重新编译Pangolin,成功。然后按照上部分提供的官网教程进行编译。