KITTI榜单上开源的视觉SLAM算法中目前性能最好的是OV2SLAM(双目DSO TUM没开源,地平线在github开源了一个),所以想研究一下ov2slam,这里记录一下配置过程中的采坑记录。
1.必要的准备
ROS-melodic,网上有很多教程,这里就不再赘述了
ROS安装完成后
sudo apt install ros-pcl-msgs
其他的一些第三方库在ov2slam源码中自带,无需额外下载。相较于ORB-SLAM系列,把DBoW改成了iBoW-LCD。OpenGV可以选装。
2.配置
2.1下载
cd ~/catkin_ws/src/
git clone https://github.com/ov2slam/ov2slam.git
2.2 编译第三方库
cd ~/catkin_ws/src/ov2slam
chmod +x build_thirdparty.sh
./build_thirdparty.sh
2.3 编译ov2slam
rosdep install ov2slam
cd ~/catkin_ws/src/ov2slam
catkin build --this
source ~/catkin_ws/devel/setup.bash
这里遇到了问题,出现以下报错:
CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:110 (message): Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir, which is not found. It does neither exist as an absolute directory nor in '${{prefix}}//usr/include/opencv'.
问题的解决需要下载cv_bridge,一定要选好对应的版本!!! 18.04对应的是melodic,在branch中一定要选择melodic,否则会很麻烦,我就是一不小心选错了,以下是造成的结果。
CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
Unable to find the requested Boost libraries.
Boost version: 1.65.1
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_python37
然后我就去把boost更新了,更新到了1.68,为此还卸载了很多ros相关的包,更新以后还得重新装回来,巨麻烦。更新完boost以后还是有问题,catkin_make报错:
undefined reference to `boost::re_detail_106800::perl_matcher
在网上查了好久没有找到一模一样的,在StackOverflow上找到一个类似的,解决方案如下:
sudo find / -name libboost_regex.*
找到你对应版本的boost,我这里是1.68.0
sudo cp /usr/local/lib/libboost_regex.so.1.68.0 /usr/lib/x86_64-linux-gnu/
cd /usr/lib/x86_64-linux-gnu/
sudo ln -fs libboost_regex.so.1.68.0 libboost_regex.so
至此,没有再报错,安装ov2slam完成。
此外,如果用–pkg方式编译
cd ~/catkin_ws/
catkin_make --pkg ov2slam
source ~/catkin_ws/devel/setup.bash
发现无法生成ov2slam_node节点,还是得用catkin_make