MIT Kimera-VIO-ROS 安装

前言

我安装Kimera-VIO-ROS的时间是2023.10.28。由于已经离Kimera发布过去两年,所以遇到版本不同步问题,Kimera-VIO,Kimera-VIO-ROS,GTSAM的版本需要精心挑选。

Kimera-VIO在2021.07.01之后没有更新,git commit版本为641576f
Kimera-VIO-ROS在2021.07.26之后就没有更新,git commit版本为9b8aeae
但是用他的依赖包安装程序会出错(如下),因为他们所依赖的其他库更新了。

wstool merge Kimera-VIO-ROS/install/kimera_vio_ros_ssh.rosinstall
  • GTSAM
    由于GTSAM不断更新.
    对于zph台式机,我最初选择了2021.12.21的GTSAM4.1.1tag ,git commit版本是69a3a75,是可以编译通过的.
    GTSAM发现在wzy台式机上是2022.06.01的git commit 12aed1f,是可以编译通过的.

    但是更新版本的GTSAM就不行了(比如4.2,4.3不行)。因为GTSAM后面大部分函数的指针都变成了std::shared_ptr.而Kimera依旧用大量使用了boost::shared_ptr

  • Kimera-RPGO
    zph台式机选择Kimera-RPGO选择master分支 git commit版本是2023.07.25的9e1bf93
    wzy台式机选择Kimera-RPGO选择master分支 git commit版本是2022.04.28的 19436dcf
    说明Kimera-RPGO变换不大,都适用.

Github官方版本讨论

对于版本的讨论建议参考[TIP] A successful installation of Kimera-VIO-ROS Guide


正确安装方式

# Setup catkin workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin init
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release -DGTSAM_TANGENT_PREINTEGRATION=OFF

catkin config --merge-devel

# Add workspace to bashrc for automatic sourcing of workspace.
echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc

# 如果是自己新建的目录,举个例子,在~/.zshrc中
source ~/ros_ws/kimera_ws/devel/setup.zsh
export ROS_PACKAGE_PATH=/opt/ros/melodic:$HOME/ros_ws/kimera_ws/src
export LD_LIBRARY_PATH=/usr/local/lib:usr/lib:/home/zph/ros_ws/kimera_ws/devel/lib
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/home/zph/ros_ws/kimera_ws/devel

# Clone repo
cd ~/catkin_ws/src
# For ssh:
# 需要下载三角mesh所用的插件
git clone https://github.com/ToniRV/mesh_rviz_plugins.git

# 下载主文件
git clone git@github.com:MIT-SPARK/Kimera-VIO-ROS.git
git checkout 9b8aeae
# For https:
# git clone https://github.com/MIT-SPARK/Kimera-VIO-ROS.git

# Install dependencies from rosinstall file using wstool
wstool init # Use unless wstool is already initialized

# For ssh:
wstool merge Kimera-VIO-ROS/install/kimera_vio_ros_ssh.rosinstall
# For https
# wstool merge Kimera-VIO-ROS/install/kimera_vio_ros_https.rosinstall

# download and update repos:
wstool update

# 需要 git checkout 合适版本
rm -rf gtsam #删除最新版本
# zph环境
git clone -b 4.1.1 https://github.com/borglab/gtsam.git
# wzy环境
git clone -b develop https://github.com/borglab/gtsam.git 
git checkout 12aed1f

# 进入Kimera-RPGO目录
cd Kimera-RPGO
git checkout 9e1bf93

# 进入Kimera-VIO目录
cd Kimera-VIO
git checkout 641576f

# 进入Kimera-VIO-ROS目录
cd Kimera-VIO-ROS
git checkout 9b8aeae

# Compile code
catkin build

# Optionally install all dependencies that you might have missed:
# Some packages may report errors, this is expected
# rosdep install --from-paths . --ignore-src -r -y

优秀博文解读Kimera

知乎 MIT最近推出的:Kimera-实时度量语义SLAM开源系统

Bug1

为防止Pangolin报错,需要在Kimera-VIO中CmakeLists.txt添加

if(NOT CMAKE_CXX_STANDARD) 
  set(CMAKE_CXX_STANDARD 17) 
  set(CMAKE_CXX_STANDARD_REQUIRED ON) 
endif()

Bug2

注意GTSAM在4.1.1中使用了quaternion()函数,但在未来版本4.2或者4.3中使用toQuaternion()代替,因为之前的4.1.1有歧义。所以目前Kimera使用了带歧义的GTSAM。自己改写时需要注意。见Fix / Move Rot3::quaternion to deprecated block #1219

Bug3

我电脑Ubuntu里自带tbb不是4.0版本以上的,而最新的GTSAM对TBB有了要求,在gtsam/cmake/HandleTBB.cmake文件中

if (GTSAM_WITH_TBB)
    # Find TBB
    find_package(TBB 4.4 COMPONENTS tbb tbbmalloc)

    # Set up variables if we're using TBB
    if(TBB_FOUND)
        set(GTSAM_USE_TBB 1)  # This will go into config.h

        if ((${TBB_VERSION_MAJOR} GREATER 2020) OR (${TBB_VERSION_MAJOR} EQUAL 2020))
            set(TBB_GREATER_EQUAL_2020 1)
        else()
            set(TBB_GREATER_EQUAL_2020 0)
        endif()
        # all definitions and link requisites will go via imported targets:
        # tbb & tbbmalloc
        list(APPEND GTSAM_ADDITIONAL_LIBRARIES TBB::tbb TBB::tbbmalloc)
    else()
        set(GTSAM_USE_TBB 0)  # This will go into config.h
    endif()

    ###############################################################################
    # Prohibit Timing build mode in combination with TBB
    if(GTSAM_USE_TBB AND (CMAKE_BUILD_TYPE  STREQUAL "Timing"))
        message(FATAL_ERROR "Timing build mode cannot be used together with TBB. Use a sampling profiler such as Instruments or Intel VTune Amplifier instead.")
    endif()

endif()

但是我不计划用新的TBB,因为之前的OpenCV4.6也是基于旧的TBB编译的,重新安装新的TBB会破坏原有环境。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值