evo评测VINS-MONO---代码修改、数据格式转换、数据测试
数据格式(data formal):TUM/EuRoC/Kitti数据集
格式转换
修改VINS-mono轨迹保存代码
由于VINS-Mono保存的轨迹格式与EVO所使⽤的格式不同,VISNmono输出的轨迹格式不符合tum数据集和euroc数据集的格式。因此需要对源代码就⾏修改,更改保存轨迹的格式。(如果只有⼀条轨迹也可以直接需要输出的csv⽂件,但是如果要反复评估⼀个算法的话,⽐如运⾏10次求平均值,这样还是修改源代码⽅便⼀点)
修改下列两个⽂件,共计3个地⽅
1.vins_estimator/src/utility/visualization.cpp
2.pose_graph/src/pose_graph.cpp
修改 visualization.cpp
到以下代码段
// write result to file
ofstream foutC(VINS_RESULT_PATH, ios::app);
foutC.setf(ios::fixed, ios::floatfield);
foutC.precision(0);
foutC << Sec()*1e9<<",";
foutC.precision(5);文件格式转换app
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()<<","
sqliteexpertpersonal使用方法<< tmp_Q.z()<<","
<< estimator.Vs[WINDOW_SIZE].x()<<","
<< estimator.Vs[WINDOW_SIZE].y()<<","
<< estimator.Vs[WINDOW_SIZE].z()<<","<< endl;
修改代码为:
// write result to file
ofstream foutC(VINS_RESULT_PATH, ios::app);
foutC.setf(ios::fixed, ios::floatfield);
foutC.precision(9);
marquee boost测评wenfoutC << Sec()<<" ";
foutC.precision(5);
foutC << estimator.Ps[WINDOW_SIZE].x()<<" "
<< estimator.Ps[WINDOW_SIZE].y()<<" "
<< estimator.Ps[WINDOW_SIZE].z()<<" "
<< tmp_Q.x()<<" "
<< tmp_Q.y()<<" "
<< tmp_Q.z()<<" "
<< tmp_Q.w()<< endl;
//<< estimator.Vs[WINDOW_SIZE].x() << ","
//<< estimator.Vs[WINDOW_SIZE].y() << ","
//<< estimator.Vs[WINDOW_SIZE].z() << "," << endl;
foutC.close();
修改 pose_graph.cpp
1) 在路径 /pose_graph/src/pose_graph.cpp 在函数 addKeyFrame() 中 到以下代码段
{
ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
loop_path_file.setf(ios::fixed, ios::floatfield);
loop_path_file.precision(0);
loop_path_file << cur_kf->time_stamp *1e9<<",";
loop_path_file.precision(5);
loop_path_file  << P.x()<<","
<< P.y()<<","
want什么意思啊<< P.z()<<","
<< Q.w()<<","
<< Q.x()<<","
<< Q.y()<<","
<< Q.z()<<","
<< endl;
loop_path_file.close();
}
修改为:
if(SAVE_LOOP_PATH)
{
ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
loop_path_file.setf(ios::fixed, ios::floatfield);
loop_path_file.precision(9);
loop_path_file << cur_kf->time_stamp  <<" ";
loop_path_file.precision(5);
loop_path_file  << P.x()<<" "
<< P.y()<<" "
<< P.z()<<" "
<< Q.x()<<" "
<< Q.y()<<" "
<< Q.z()<<" "
<< Q.w()<< endl;
loop_path_file.close();
}
2) 在路径 /pose_graph/src/pose_graph.cpp 在函数 updatePath() 中 到以下代码段
if(SAVE_LOOP_PATH)
{
ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
throw什么意思中文
loop_path_file.setf(ios::fixed, ios::floatfield);
loop_path_file.precision(0);
loop_path_file <<(*it)->time_stamp *1e9<<",";
loop_path_file.precision(5);
loop_path_file  << P.x()<<","
<< P.y()<<","
<< P.z()<<","
<< Q.w()<<","
<< Q.x()<<","
<< Q.y()<<","
<< Q.z()<<","
<< endl;
loop_path_file.close();
}
修改为:
{
ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
loop_path_file.setf(ios::fixed, ios::floatfield);
loop_path_file.precision(9);
loop_path_file <<(*it)->time_stamp <<" ";
loop_path_file.precision(5);
loop_path_file  << P.x()<<" "
<< P.y()<<" "
<< P.z()<<" "
<< Q.x()<<" "
<< Q.y()<<" "
<< Q.z()<<" "
<< Q.w()<< endl;
loop_path_file.close();
}
修改VINS-mono运⾏参数
在路径 VINS-Mono/config/euroc 下有配置⽂件 euroc_config.yaml
output_path:设置轨迹保存位置
pose_graph_save_path 设置位姿图保存位置
loop_closure: 0 表⽰不使⽤回环 1表⽰使⽤回环
estimate_td: 0表⽰不估计传感器之间的延时 1表⽰启动
运⾏代码获得轨迹信息
18岁女rapperdisssubs修改、设置完成之后,vins_mono代码重新编译catkin_make
打开四个终端分别运⾏以下命令:
roscore
roslaunch vins_estimator euroc.launch
roslaunch vins_estimator vins_rviz.launch
rosbag play MH_01_easy.bag
本⽂以VINS为例⼦介绍如何使⽤evo评估其在Euroc数据集上的效果。数据集⽹站:The EuRoC MAV Dataset。数据集采⽤
MH_01_easy.bag。
euroc的评估⽀持 .csv的groudtruth 和 tum 格式的轨迹⽂件. 虽然我们使⽤的是euroc数据集,但evo只⽀持tum格式的绘制,它提供了euroc格式转tum格式的⼯具。 ⾸先我们打开数据集的state_groundtruth_estimate0/⽂件夹,会发现有⼀个⽂件: data.csv。这是⼀个euroc格式的⽂件,我们⾸先要把他转成tum格式。输⼊以下命令:
evo_traj euroc data.csv --save_as_tum
⽣成data.tum
evo评测
单条轨迹
⾸先设置回环(loop_closure: 1),重载地图(load_previous_pose_graph: 0),快速定位(fast_relocalization: 0)。
经过我们上⾯的修改,该⽂件是符合tum格式的轨迹输出以及数据集提供的真值state_groundtruth_estimate0/data.csv(由下载的zip格式的数据解压得到)。
使⽤evo_traj 显⽰轨迹
⾸先我们可以使⽤ evo_traj将轨迹画出来。
~/vins-mono/output_pose_graph$ evo_traj tum vins_result_no_loop.csv -p --plot_mode=xyz

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。