9 print "Usage: {} <bag_name> <parent frame> <child frame>".format(os.path.basename(sys.argv[0]))
10 print "Output file: bag_name.csv - each line: <stamp> <yaw angle>" 13 input_bag_name = sys.argv[1]
14 parent_frame = sys.argv[2]
15 child_frame = sys.argv[3]
21 print "Could not open bag {}".format(input_bag_name)
25 name, ext = os.path.splitext(input_bag_name)
27 out_file_name =
"{name}.csv".format(name=name)
28 print "Writing to {}".format(out_file_name)
29 out_file = open(out_file_name,
'w')
32 for topic, msg, t
in input_bag.read_messages(topics=[
'odom',
'/odom']):
34 quat = PyKDL.Rotation.Quaternion(*[ getattr(msg.pose.pose.orientation, i)
for i
in [
'x',
'y',
'z',
'w'] ])
35 yaw = quat.GetRPY()[2]
36 out_file.write(
'{:.12f} {:.12f}\n'.format(msg.header.stamp.to_sec(), yaw))
40 print(
"Wrote {} entries.".format(counter))