从零开始做自动驾驶定位(二):轨迹精度评估
一、EVO工具的使用
1.evo简介
evo [1] 是一个很好的测评工具,它可以根据时间戳将轨迹进行对齐,同时可以将不同尺度的轨迹按照你指定的标准轨迹进行拉伸对齐,并可以算出均方差等评定参数,用于测评slam算法性能。支持的格式有:
- “TUM” 轨迹文件;
- “KITTI“ 位姿文件;
- “EuRoC MAV” (.csv groundtruth and TUM trajectory file);
- ROS bagfile with
geometry_msgs/PoseStamped
,geometry_msgs/TransformStamped
,geometry_msgs/PoseWithCovarianceStamped
ornav_msgs/Odometry
topics or TF messages; - 关于具体格式相关,见 [2]。
2.evo安装
evo共有两种安装方式 [1][3]:
- 2.1 二进制快捷安装 :直接安装最新的稳定发行版:
pip install evo --upgrade --no-binary evo
- 2.2 源码编译安装
1)下载evo,也可以在home中直接下载
git clone https://github.com/MichaelGrupp/evo.git
2)进入evo文件夹,编译安装
pip install --editable . --upgrade --no-binary evo
3.evo工具使用
3.1 命令行接口
度量指标(具体原里参见高博十四讲第二版4.4.2小节):
evo_ape
- 绝对位姿误差evo_rpe
- 相对位姿误差
工具:
evo_traj
- 用于分析、绘制或者导出一个或多个轨迹;evo_res
- 用于对比一个或者多个从evo_ape
或者evo_rpe生成的结果文件;
evo_fig
- (experimental) tool for re-opening serialized plots (saved with--serialize_plot
)evo_config
- 用于操作全局设置和配置文件
更多的参数细节详见 [4]。
3.2 具体的工作举例
注意:下面的测试文件在evo的github源码里(详见官网 [1])
1) 多轨迹绘制
cd test/data
evo_traj kitti KITTI_00_ORB.txt KITTI_00_SPTAM.txt --ref=KITTI_00_gt.txt -p --plot_mode=xz
2) 轨迹误差度量
mkdir results
evo_ape kitti KITTI_00_gt.txt KITTI_00_ORB.txt -va --plot --plot_mode xz --save_results results/ORB.zip
evo_ape kitti KITTI_00_gt.txt KITTI_00_SPTAM.txt -va --plot --plot_mode xz --save_results results/SPTAM.zip
3) 多个轨迹误差分析
evo_res results/*.zip -p --save_table results/table.csv
值得一提的是还有另一个比较类似的工具:rpg_trajectory_evaluation,具体的使用参考官网 [5],功能似乎没有evo那么强,不过这个工具对应了论文 [6],该论文详细的阐述了估计误差度量的推导及优缺点(尤其单目),有兴趣的可以看一看。
参考资料:
[1] evo : https://github.com/MichaelGrupp/evo
[2] evo Formats : https://github.com/MichaelGrupp/evo/wiki/Formats
[3] 测评工具evo安装与使用 : https://blog.csdn.net/weixin_44386661/article/details/103080551
[4] evo/Home more detailed documentation and examples : https://github.com/MichaelGrupp/evo/wiki
[5] rpg_trajectory_evaluation : https://github.com/uzh-rpg/rpg_trajectory_evaluation
[6] Z. Zhang and D. Scaramuzza, "A Tutorial on Quantitative Trajectory Evaluation for Visual(-Inertial) Odometry," 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), Madrid, 2018, pp. 7244-7251, doi: 10.1109/IROS.2018.8593941.