《视觉SLAM十四讲》备忘录

前言

前四章实践过程中比较重要的内容。


一、从Pangolin库的使用过程中了解其具体使用方法及cmake的命令编译方式:

  1. 使用Pangolin:
    在工程的CMakeList.txt下添加以下语句:
    find_package(Pangolin)
    target_link_libraries(<工程名>, ${Pangolin_LIBRARIES})
  2. 命令使用cmake进行编译:(参考Pangolin的README.md)
    创建build文件夹,在里面进行操作:
    cd <工程根目录>
    mkdir build
    cd build
    cmake …
    cmake --build .
  3. 确认库(libxx-dev)是否已安装://(参考书中P48页)
    sudo updatedb //更新/var/lib/slocate.db数据库文件
    locate <库名xx> //locate命令将从slocate.db文件中进行搜索

二、Sophus库的使用:

  1. 安装Sophus(及其依赖的fmt):
    此处将从github clone最新的版本下来;因为比书中使用的更新,所以要额外安装fmt(虽然是可选的依赖,但我没处理好,那就直接装上好了)。
    安装最新的Sophus:
git clone https://github.com/strasdat/Sophus.git
mkdir build
cd build
cmake ..
make
sudo make install

安装最新的fmt:

git clone https://github.com/fmtlib/fmt.git
mkdir build
cd build
cmake ..
make
sudo make install

检查是否正常安装:

cwq@ubuntu:~/2_slambook2_mycode$ ls /usr/local/include/sophus/
average.hpp              rotation_matrix.hpp  sim3.hpp
common.hpp               rxso2.hpp            sim_details.hpp
geometry.hpp             rxso3.hpp            so2.hpp
interpolate_details.hpp  se2.hpp              so3.hpp
interpolate.hpp          se3.hpp              types.hpp
num_diff.hpp             sim2.hpp             velocities.hpp
cwq@ubuntu:~/2_slambook2_mycode$
cwq@ubuntu:~/2_slambook2_mycode$ fmt --version
fmt (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Ross Paterson.
  1. 因为依赖了fmt库,所以CMakeList.txt中要加上几个相关语句。完整内容如下:
# indicating required CMAKE required lowest version
cmake_minimum_required( VERSION 2.8 )
set(CMAKE_BUILD_TYPE "Debug")
project(ch4_useSophus)
find_package( Sophus REQUIRED ) #if found, xx_INCLUDE_DIRS and xx_LIBRARIES can be used below
include_directories( "/usr/include/eigen3" )
include_directories(${Sophus_INCLUDE_DIRS})
add_executable(ch4_useSophus ch4_useSophus.cpp)
target_link_libraries(ch4_useSophus ${Sophus_LIBRARIES})
find_package( fmt )
target_link_libraries(ch4_useSophus PRIVATE fmt::fmt-header-only)
#add_subdirectory(fmt EXCLUDE_FROM_ALL) #not necessary, unless target_link_libraries() doesn't use PRIVATE
#target_link_libraries(ch4_useSophus fmt-header-only)

(其中ch4_useSophus是我的文件名和工程名,需要按实际环境修改。)
(如果编译还有问题可以查阅fmt的官方文档:https://fmt.dev/latest/usage.html#usage-with-cmake)

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值