]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/blob - qplot.py
Add qplot difference
[hubacji1/iamcar.git] / qplot.py
1 from matplotlib import pyplot as plt
2
3 edist = []
4 rdist = []
5
6 with open("LOG", "r") as f:
7     for l in f:
8         (x, y1, y2) = l.split(" ")
9         edist.append(float(y1))
10         rdist.append(float(y2))
11
12 fig = plt.figure()
13 ax = fig.add_subplot(111)
14 ax.set_aspect("equal")
15
16 ax.set_title("Comparison of Euclidean and Reeds & Shepp distance")
17 ax.set_xlabel("Euclidean distance [m]")
18 ax.set_ylabel("Difference to Reeds & Shepp distance [m]")
19
20 plt.plot(edist, [x - y for (x, y) in zip(rdist, edist)], "o")
21
22 # average of RS
23 MAX = 1000
24 sumy = [[] for i in range(MAX)]
25 for (x, y) in zip(edist, rdist):
26     sumy[int(MAX * x / (2*100**2)**0.5)].append(y - x)
27
28 ax = []
29 ay = []
30 for (x, y) in zip(range(MAX), sumy):
31     if y:
32         ax.append(x * (2*100**2)**0.5 / MAX)
33         ay.append(sum(y)/len(y))
34 #plt.plot(range(MAX), asumy, marker="-", color="orange")
35 plt.plot(ax, ay, linestyle="-", color="orange")
36 plt.show()