#!/bin/python3
import csv
import os
import sys
import math
import numpy
import matplotlib.pyplot as plt
if (len(sys.argv) != 2):
print("error, please specify the filename")
exit(1)
filename = sys.argv[1]
print("filename is {}".format(filename))
frameid, x, y, theta, tx, ty, L, tx_opt, ty_opt, delta_tx, delta_ty = [], [], [], [], [], [], [], [], [], [], []
with open(filename, 'r') as f:
lines = f.readlines()
for line in lines:
try:
temp = line.split(',')
except:
continue
frameid.append(int(temp[0]))
x.append(float(temp[1]))
y.append(float(temp[2]))
theta.append(float(temp[3]))
tx.append(float(temp[4]))
ty.append(float(temp[5]))
L.append(float(temp[6]))
tx_opt.append(float(temp[7]))
ty_opt.append(float(temp[8]))
delta_tx.append(float(temp[4]) - float(temp[7]))
if (float(temp[5]) == 0.0) :
delta_ty.append(float(0.0))
else :
delta_ty.append((float(temp[5]) - float(temp[8])) / float(temp[5]))
plt.figure()
plt.xlabel('x', fontsize = 15)
plt.ylabel('y', fontsize = 15)
plt.plot(x, y, 'red', label = 'xy')
plt.legend()
plt.grid()
plt.show()