完美实现使用evo评估VINS-Mono

    过眼春光久已空,晒丝捣麦又匆匆。——(宋)陆游《夏日》

    EVO工具用于评估SLAM算法在现有数据集上的效果。源码在 https://github.com/MichaelGrupp/evo。目前支持 TUM KITTI Euroc 等格式。evo工具提供了3种误差评估方式:

  • evo_ape -absoulte pose error
  • evo_rpe -relative pose error
  • evo_rpe -for-each -sub-sequence-wise averaged pose error

    4种工具:

  • evo_traj - tool for analyzing, plotting or exporting one or more trajectories
  • evo_res - tool for comparing one or multiple result files from evo_ape or evo_rpe
  • evo_fig - (experimental) tool for re-opening serialized plots (saved with –serialize_plot)
  • evo_config - tool for global settings and config file manipulation

    本文以VINS为例子介绍如何使用evo评估其在Euroc数据集上的效果。数据集网站:The EuRoC MAV Dataset。数据集采用MH_01_easy.bag。

    euroc的评估支持 .csv的groudtruth 和 tum 格式的轨迹文件. 首先修改vins源码. 打开 visulization.cpp, 找到 写文件部分代码,并修改为:

        // write result with tum format, for evo tools
        ofstream foutC(VINS_RESULT_PATH, ios::app);
        foutC.setf(ios::fixed, ios::floatfield);
        foutC.precision(10);
        foutC << header.stamp.toSec()<< " ";
        foutC.precision(5);
        foutC << estimator.Ps[WINDOW_SIZE].x() << " "
              << estimator.Ps[WINDOW_SIZE].y() << " "
              << estimator.Ps[WINDOW_SIZE].z() << " "
              << tmp_Q.w() << " "
              << tmp_Q.x() << " "
              << tmp_Q.y() << " "
              << tmp_Q.z() << endl;
        foutC.close();

    现在我们有了 tum格式的轨迹输出以及数据集提供的真值state_groundtruth_estimate0/data.csv(由下载的zip格式的数据解压得到)。首先我们可以使用 evo_traj将轨迹画出来。

evo_traj tum vins_result_no_loop.csv -p --plot_mode=xyz

    而带有回环检测的可能报错:[ERROR] TUM trajectory files must have 8 entries per row and no trailing delimiter at the end of the rows (space),原因可能是数据中有逗号,需要将逗号换成空格,并且行末不能有。解决方法,使用Excel打开文件另存为TXT格式,再使用替换将所有逗号变为空格即可。

    使用evo_ape确定轨迹误差。

evo_ape euroc data.csv vins_result_no_loop.csv -va --plot --save_results result_vins.zip

    对于带有回环检测的数据可能报错:[ERROR] found no matching timestamps between data.csv and vins_result_loop.csv with max. time diff 0.01 (s) and time offset 0.0 (s)。时间戳错误,解决方法,使用文本编辑器打开,将第一列中的“E+018”改为“E+009”。

    最终的结果会保存在 result_vins.zip中:

{"std": 0.02860583962864544, "rmse": 0.08262275867937034, "sse": 6.969877177077047, "max": 0.15694899033138723, "min": 0.022182102135421995, "median": 0.07525605040255529, "mean": 0.07751274857034607}

    总之,evo是一个很不错的工具。

参考:

1、使用evo评估VINS-MONO

原创文章 19 获赞 34 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_38141453/article/details/105954396