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()