]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Add qplot difference feature/e-rs-comparison
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 8 Mar 2019 12:20:07 +0000 (13:20 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 8 Mar 2019 12:20:07 +0000 (13:20 +0100)
qplot.py

index 202ac96ad02438c1ae7b8afff9b3185b3d7f4984..087ef982bb506c1ae321816d057d94c3eaddae9d 100644 (file)
--- a/qplot.py
+++ b/qplot.py
@@ -9,18 +9,28 @@ with open("LOG", "r") as f:
         edist.append(float(y1))
         rdist.append(float(y2))
 
-#edist.sort()
-#rdist.sort()
-
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.set_aspect("equal")
 
 ax.set_title("Comparison of Euclidean and Reeds & Shepp distance")
 ax.set_xlabel("Euclidean distance [m]")
-ax.set_ylabel("Reeds & Shepp distance [m]")
+ax.set_ylabel("Difference to Reeds & Shepp distance [m]")
+
+plt.plot(edist, [x - y for (x, y) in zip(rdist, edist)], "o")
+
+# average of RS
+MAX = 1000
+sumy = [[] for i in range(MAX)]
+for (x, y) in zip(edist, rdist):
+    sumy[int(MAX * x / (2*100**2)**0.5)].append(y - x)
 
-plt.plot(edist, rdist, "o")
-#plt.plot(rdist, label="Reeds & Shepp distance")
-#plt.legend(bbox_to_anchor=(1, 1), loc=1, borderaxespad=0)
+ax = []
+ay = []
+for (x, y) in zip(range(MAX), sumy):
+    if y:
+        ax.append(x * (2*100**2)**0.5 / MAX)
+        ay.append(sum(y)/len(y))
+#plt.plot(range(MAX), asumy, marker="-", color="orange")
+plt.plot(ax, ay, linestyle="-", color="orange")
 plt.show()