【视觉SLAM 14讲】搭建VO 0.2 (VMware Ubuntu18.04)

一、安装依赖:

关于这篇文章的所有依赖库我全部放到网盘上了,或者你也可以去网上下对应的版本,

链接:https://pan.baidu.com/s/1yEfF0MAeIh2JU46ZyCXmWg?pwd=t5ix
提取码:t5ix

在安装依赖前请确保你的Ubuntu系统有cmake、python2等环境。

① fmt安装:

在网盘中下载好依赖传入虚拟机指定目录

使用unzip fmt-master.zip 解压

编译:

cd fmt-master
mkdir build
cd build
cmake ..
make
sudo make install

② Sophus安装:

在网盘中下载好依赖传入虚拟机指定目录

使用tar -zxvf Sophus.tar.gz 解压

编译:

cd Sophus
mkdir build
cd build
cmake ..
make
sudo make install

③ g2o优化库安装:

在网盘中下载好依赖传入虚拟机指定目录

使用unzip g2o-20230223_git.zip 解压

cd g2o-20230223_git
mkdir build
cd build
cmake ..
make
sudo make install

二、TUM数据集下载

数据集下载主页:https://cvg.cit.tum.de/data/datasets

image-20231025142915409

image-20231025142958164

image-20231025143053485

下载上传到虚拟机指定目录:

解压tar -zxvf rgbd_dataset_freiburg1_xyz.tgz

进入文件夹在这里下载 associate.py 文件(这里的py文件是将rgbdata.txt 和depthdata.txt 转换成生成的associate.txt是rgb在前depth在后的形式)

放到解压后的数据集文件中执行

python associate.py rgb.txt depth.txt > associate.txt

image-20231025144517565

三、编译工程

进入/home/zqh/slambook-master/project/0.2

修改config 文件夹中 yaml配置文件的数据集目录:

image-20231025144555959

编译:

在/home/zqh/slambook-master/project/0.2下执行

mkdir build
cd build
cmake ..
make

报错:

CMakeFiles/run_vo.dir/run_vo.cpp.o: In function `main':
run_vo.cpp:(.text.startup+0xf23): undefined reference to `Sophus::SE3::inverse() const'
run_vo.cpp:(.text.startup+0xf62): undefined reference to `Sophus::SO3::matrix() const'
run_vo.cpp:(.text.startup+0xf81): undefined reference to `Sophus::SO3::matrix() const'
run_vo.cpp:(.text.startup+0xfa0): undefined reference to `Sophus::SO3::matrix() const'
run_vo.cpp:(.text.startup+0xfbf): undefined reference to `Sophus::SO3::matrix() const'
run_vo.cpp:(.text.startup+0xfde): undefined reference to `Sophus::SO3::matrix() const'
CMakeFiles/run_vo.dir/run_vo.cpp.o:run_vo.cpp:(.text.startup+0xffd): more undefined references to `Sophus::SO3::matrix() const' follow
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator=(Sophus::SE3 const&)'
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3()'
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::log() const'
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3(Sophus::SE3 const&)'
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator*(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&) const'
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::SE3(Sophus::SO3 const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
../../lib/libmyslam.so: undefined reference to `Sophus::SO3::SO3(double, double, double)'
../../lib/libmyslam.so: undefined reference to `Sophus::SE3::operator*(Sophus::SE3 const&) const'
collect2: error: ld returned 1 exit status
test/CMakeFiles/run_vo.dir/build.make:136: recipe for target '../bin/run_vo' failed
make[2]: *** [../bin/run_vo] Error 1
CMakeFiles/Makefile2:140: recipe for target 'test/CMakeFiles/run_vo.dir/all' failed
make[1]: *** [test/CMakeFiles/run_vo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

CMakeLists.txt中的Sophus

# Sophus
find_package( Sophus REQUIRED )
include_directories( ${Sophus_INCLUDE_DIRS} )

原因分析:
安装Sophus时,有个lib文件“libSophus.so”会出现在/usr/local/lib/libSophus.so 时,libSophus.so 应该被链接到 Sophus_LIBRARIES, cmake没链接上。

应该更改为:

# Sophus
find_package( Sophus REQUIRED )
set(Sophus_LIBRARIES libSophus.so)
include_directories( ${Sophus_INCLUDE_DIRS} )

编译通过

返回到/home/zqh/slambook-master/project/0.2 执行:

bin/run_vo config/default.yaml

出现错误:

2

将CMakeLists.txt中的Sophus改为:

# Sophus
find_package( Sophus REQUIRED )
set(Sophus_LIBRARIES /usr/local/lib/libSophus.so)
include_directories( ${Sophus_INCLUDE_DIRS} )

再次执行:

bin/run_vo config/default.yaml

image-20231025144913707

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值