遇到的问题:在运行4.4.2中的评估轨迹误差的程序时,出现以下问题:
cannot find trajectory file at ./examples/trajectory.txt
出现问题的代码,是trajectoryError.cpp文件中出现的问题,原代码如下所示:
string trajectory_file = "./examples/trajectory.txt";
解决方法:
此问题主要是因为路径问题,无法正确找到文件所在位置,主要有以下两种:
- 解决方法一:将路径改为绝对路径
改为以下路径:
string trajectory_file = "/home/fighter/slambook2/ch3/examples/trajectory.txt";
(!!!注意:这里的路径,要使用自己文件路径)
- 解决方法二:将路径改为正确的相对路径
将example删除,改为以下路径
string trajectory_file = "./trajectory.txt";
最后,重新编译运行。
建议:最好是改为绝对路径,会避免很多麻烦。