记录遇到的一些问题
1.使用build.sh编译不通过,原因是build.sh为windows下的CRLF,通过vscode改为LR就行
2.编译通过,运行mono_euroc示例时报错
.pnged to load image at.(图片路径).........
因为我用的虚拟机,所以我是在windows下执行生成的txt文件或下载后打开的txt文件,里面的换行是"\n\r",这是不符合在linux系统的规则的,
解决方法1:
sudo apt-get install tofrodos
todos Hello.txt (即unix2dos Hello.txt)
fromdos Hello.txt (即dos2unix Hello.txt)
转换格式就可以了。orbslam3的euroc例程是timestamp和图片名字一样,所以直接读timestamp的时间戳。这里
todos /path/to/timestamps文件
在github上另一个解决办法:
mono_euroc.cc中LoadImages函数中vstrImages.push_back(strImagePath + "/" + ss.str().+ ".png")
改成
vstrImages.push_back(strImagePath + "/" + ss.str().substr(0, ss.str().size()-1) + ".png");
重新编译
3.开始运行后输出New Map created with 271 points就没反应了,
这是因为
mono_euroc.cc中最后一个参数为是否可视化,改为true就可以了,然后重新编译。
//Create SLAM system. It initializes all system threads and gets ready to process frames.
ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR, false);
4.[ERROR] found no matching timestamps between reference and a.txt with max. time diff 0.01 (s) and time offset 0.0 (s)
在评估测试结果时,orbslam3自带的评估python代码有问题,就直接用evo工具评估。euroc真值在
/EuRoC/MH01/mav0/state_groundtruth_estimate0/data.csv
先用evo工具 转为tum格式。再进行评估,但是报错,原因是时间戳没对齐。搜索了一下,其他人也遇到了和我一样的问题,如这位同学
真值是10的9次方数量级,结果跑出来的数据是10的18次方数量级。
原因是euroc的时间戳单位是纳秒,而tum数据集时间戳单位是秒。例程保存的格式是euroc,单位纳秒,所以两者差了1e9倍。
我用evo_traj 转换轨迹为tum格式失败,所以直接改orbslam代码,让代码保存秒时间戳
解决办法:
system.cc中
void System::SaveTrajectoryEuRoC(const string &filename, Map* pMap)函数
f << setprecision(6) << 1e9*(*lT) << " " << setprecision(9) << twc(0) << " " << twc(1) << " " << twc(2) << " " << q.x() << " " << q.y() << " " << q.z() << " " << q.w() << endl;
改成
f << setprecision(6) << 1*(*lT) << " " << setprecision(9) << twc(0) << " " << twc(1) << " " << twc(2) << " " << q.x() << " " << q.y() << " " << q.z() << " " << q.w() << endl;
代码里前边读取时间戳的时候乘以了1e-9,已经转换为了秒,所以输出的时候不乘以1e9,轨迹以秒为单位保存,这样就和已经转换为tum数据集格式的真值时间戳符合了。
evo_traj tum f_dataset-MH01_mono.txt --ref=data.tum -p -s --correct_scale -a --align
出来结果是对的