其他错误参见:盘点Ubuntu20.04实操《视觉SLAM十四讲》时遇到的问题及解决方案_AndyVictory的博客-CSDN博客
一、Sophus的基本使用方法(P86)
1、运行时报fmt相关的错误,修改CmakeList.txt文件中的代码如下:
cmake_minimum_required( VERSION 2.8 )
project( useSophus )
# 为使用 sophus,您需要使用find_package命令找到它
find_package( Sophus REQUIRED )
include_directories( ${Sophus_INCLUDE_DIRS} )
include_directories( "/usr/include/eigen3/" )
add_executable( useSophus useSophus.cpp )
target_link_libraries( useSophus ${Sophus_LIBRARIES} fmt)
2、结果如下:
二、评估轨迹误差(P90):
1、 出现报错:找不到文件estimated.txt和groundtruth.txt,是因为当前执行目录是build文件夹,自然找不到这两个文件。
将trajectoryError.cpp文件打开,找到这两行代码(应该是第10和11行):
string groundtruth_file = "./example/groundtruth.txt";
string estimated_file = "./example/estimated.txt";
修改为
string groundtruth_file = "../../example/groundtruth.txt";
string estimated_file = "../../example/estimated.txt";
这样就能在build的上一级目录找到这两个文件了。
2、如果你是Ubuntu20.04版本(18版本不用修改此处):
将example文件夹下的CMakeList.txt文件打开,将代码option(USE_UBUNTU_20 "Set to ON if you are using Ubuntu 20.04" OFF)替换为:
option(USE_UBUNTU_20 "Set to ON if you are using Ubuntu 20.04" ON)
3、运行结果如下: