本文共 2697 字,大约阅读时间需要 8 分钟。
maplab是一个开源的VI-SLAM(视觉惯性-即时定位与地图构建)框架。它由著名的ETH Zurich, Autonomous Systems Lab(苏黎世联邦理工学院自动系统实验室)开发,包含了视觉SLAM相关的多种算法与工具:在线VIO(视觉惯性里程计),进行在线位姿估计并创建地图;在线VI-Localization(视觉惯性定位),进行基于地图的全局无漂移视觉定位;地图管理,用于修改和维护地图,包括地图合并,稀疏化,地点识别和可视化。
接下来我会根据maplab的wiki实现其功能,并尽可能的剖析其理论,首先带来maplab的安装。参考:。
如果已经安装ROS,执行以下命令即可。
sudo apt install ros-indigo-tf2-* ros-indigo-camera-info-manager*
如果没有安装ROS,则根据自己的系统和ROS版本操作:
# Install ROS export UBUNTU_VERSION=xenial #(Ubuntu 16.04: xenial, Ubuntu 14.04: trusty, Ubuntu 18.04: bionic)export ROS_VERSION=kinetic #(Ubuntu 16.04: kinetic, Ubuntu 14.04: indigo, Ubuntu 18.04: melodic)# NOTE: Follow the official ROS installation instructions for melodic.sudo apt install software-properties-commonsudo add-apt-repository "deb http://packages.ros.org/ros/ubuntu $UBUNTU_VERSION main"wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -sudo apt updatesudo apt install ros-$ROS_VERSION-desktop-full "ros-$ROS_VERSION-tf2-*" "ros-$ROS_VERSION-camera-info-manager*" --yes
# Install framework dependencies.# NOTE: clang-format-3.8 is not available anymore on bionic, install a newer version.sudo apt install autotools-dev ccache doxygen dh-autoreconf git liblapack-dev libblas-dev libgtest-dev libreadline-dev libssh2-1-dev pylint clang-format-3.8 python-autopep8 python-catkin-tools python-pip python-git python-setuptools python-termcolor python-wstool libatlas3-base --yessudo pip install requests
如果已经安装ROS,可跳过。
sudo rosdep initrosdep updateecho ". /opt/ros/$ROS_VERSION/setup.bash" >> ~/.bashrcsource ~/.bashrc
1.创建工作空间
export ROS_VERSION=kinetic #(Ubuntu 16.04: kinetic, Ubuntu 14.04: indigo)export CATKIN_WS=~/maplab_wsmkdir -p $CATKIN_WS/srccd $CATKIN_WScatkin initcatkin config --merge-devel # Necessary for catkin_tools >= 0.4.catkin config --extend /opt/ros/$ROS_VERSIONcatkin config --cmake-args -DCMAKE_BUILD_TYPE=Releasecd src
2.下载maplab和maplab_dependencies
git clone https://github.com/ethz-asl/maplab.git --recursivegit clone https://github.com/ethz-asl/maplab_dependencies --recursive
3.编译maplab
cd $CATKIN_WScatkin build maplab
在这里一般会遇到问题,大多是由于网络问题导致无法下载文件。
但是我用的ipv6,下载没有问题。 如果下载有问题,最简单的方法就是科学上网,或者参考其他博客提供的方法。遇到的错误~/maplab_ws/build/opencv3_catkin/opencv3_src/cmake/OpenCVCompilerOptions.cmake
和/usr/local/libcmake/Ceres/CeresConfig.cmake
报以下错误: A duplicate ELSE command was found inside an IF block.
~/maplab_ws/build/opencv3_catkin/opencv3_src/cmake/OpenCVFindIPP.cmake
也报一个错误,不过我没记住。
终端输出以下内容才表明编译成功:
[build] Abandoned: None.
[build] Failed: None.
编译成功的终端截图如下: