https://github.com/stevenlovegrove/Pangolin
sudo apt-get install cmake
sudo apt-get install git
sudo apt-get install gcc g++
#安装依赖
sudo apt-get install libglew-dev #安装Glew
sudo apt-get install cmake #安装CMake
sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev #安装Boost
#下载、编译、安装Pangolin:
git clone https://github.com/zzx2GH/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOST=1 ..
make
sudo make install
cd Pangolin/examples/HelloPangolin
cmake .
make
./HelloPangolin
安装过程中可能会出现的错误及解决方法:
到Pagolin/src文件夹下,在CMakeList.txt中删去下面这段代码(屏蔽掉ffmpeg的影响):
#find_package(OpenNI QUIET)
#if(BUILD_PANGOLIN_VIDEO AND OPENNI_FOUND)
# set(HAVE_OPENNI 1)
# list(APPEND INTERNAL_INC ${OPENNI_INCLUDE_DIRS} )
# list(APPEND LINK_LIBS ${OPENNI_LIBRARIES} )
# list(APPEND HEADERS ${INCDIR}/video/drivers/openni.h )
# list(APPEND SOURCES video/drivers/openni.cpp)
# message(STATUS "OpenNI Found and Enabled")
#endif()
#find_package(OpenNI2 QUIET)
#if(BUILD_PANGOLIN_VIDEO AND OPENNI2_FOUND)
# set(HAVE_OPENNI2 1)
# if(_LINUX_)
# add_definitions(-Dlinux=1)
# endif()
# list(APPEND INTERNAL_INC ${OPENNI2_INCLUDE_DIRS} )
# list(APPEND LINK_LIBS ${OPENNI2_LIBRARIES} )
# list(APPEND HEADERS ${INCDIR}/video/drivers/openni2.h )
# list(APPEND SOURCES video/drivers/openni2.cpp)
# message(STATUS "OpenNI2 Found and Enabled")
#endif()
#find_package(FFMPEG QUIET)
#if(BUILD_PANGOLIN_VIDEO AND FFMPEG_FOUND)
# set(HAVE_FFMPEG 1)
# list(APPEND INTERNAL_INC ${FFMPEG_INCLUDE_DIRS} )
# list(APPEND LINK_LIBS ${FFMPEG_LIBRARIES} )
# list(APPEND HEADERS ${INCDIR}/video/drivers/ffmpeg.h)
# list(APPEND SOURCES video/drivers/ffmpeg.cpp)
# message(STATUS "ffmpeg Found and Enabled")
#endif()
之后再make
如果报错‘error while loading shared librariesxxx’
解决:
参考:Linux中error while loading shared libraries错误解决办法_齐天大圣~~的博客-CSDN博客_error while
sudo vim /etc/ld.so.conf
添加:/usr/local/lib 后
sudo /sbin/ldconfig -v
sudo apt-get install libeigen3-dev
mkdir orb_slam
cd orb_slam
mkdir src
cd src
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh #编译
注意:如果执行./build.sh 编译时出现如下错误
在对应的头文件中加上
#include
后重新执行./build.sh即可
如需要在ROS环境下运行ORB_SLAM,则需要执行下列三条命令:
cd orb_slam/src/ORB_SLAM2
chmod +x build_ros.sh
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/orb_slam/src/ORB_SLAM2/Examples/ROS
./build_ros.sh
如果出现如下错误:
解决方案:
修改home/orb_slam/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/文件夹下的CMakeLists.txt文件。
在set(LIBS xxxxx 的后面加上下列这一句代码:
-lboost_system
再次执行./build_ros.sh 后成功
(1)下载数据集
Computer Vision Group - Dataset Download
下载后解压并放在 /home/huang/orb_slam 目录下
运行:(在orb_slam/src/ORB_SLAM2目录下打开终端)
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/huang/orb_slam/rgbd_dataset_freiburg1_xyz
ORB-SLAM2 ROS相关的Topic名称在路径ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/中的相关文件中
代码修改
roslaunch zed_wrapper zed.launch
rqt_image_view
可以选择合适的话题
/zed/zed_node/left/image_rect_color
/zed/zed_node/right/image_rect_color
修改~/orb_slam/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src下的ros_stereo.cc的内容,把相应话题修改成如下内容:
message_filters::Subscriber left_sub(nh, "/zed/zed_node/left/image_rect_color", 1);
message_filters::Subscriber right_sub(nh, "/zed/zed_node/right/image_rect_color", 1);
在执行如下命令进行编译:
cd orb_slam/src/ORB_SLAM2
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/orb_slam/src/ORB_SLAM2/Examples/ROS
./build_ros.sh
运行
cd orb_slam/src/ORB_SLAM2
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/orb_slam/src/ORB_SLAM2/Examples/ROS
rosrun ORB_SLAM2 Stereo Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml false
新开终端运行
roslaunch zed_wrapper zed.launch
ros_mono.cc :用于单目相机 ros_rgbd.cc :用于rgb相机 ros_stereo.cc :用于立体相机
ZED相机的节点
左摄像头:
右摄像头