运行GVINS-OpenDatasets的sports_field.bag文件
轨迹生成了bag文件,使用python文件转换成txt格式便于进行评估
我使用的是
import rosbag
from geometry_msgs.msg import PoseWithCovariance
def bag_to_tum(bag_file, topic_name, output_file):
with open(output_file, 'w') as f:
bag = rosbag.Bag(bag_file)
for topic, msg, t in bag.read_messages(topics=[topic_name]):
pose = msg.pose.pose
timestamp = msg.header.stamp.to_sec()
line = "{} {} {} {} {} {} {} {}\n".format(timestamp, pose.position.x, pose.position.y, pose.position.z, pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w)
f.write(line)
bag.close()
//我的名称是这样的,可以自行修改
bag_file = 'ingvio_m.bag'
topic_name = '/ingvio_estimator/pose_w'
output_file = 'output.txt'
bag_to_tum(bag_file, topic_name, output_file)
转换以后使用evo进行评估
运行,只展示了monocular情况下的轨迹评估
evo_ape tum sports_field_rtk_result.tum output.txt -va --plot_mode=xyz -p
evo_rpe tum sports_field_rtk_result.tum output.txt -va --plot_mode=xyz -p