From: Jiri Vlasak Date: Fri, 8 Mar 2019 12:20:07 +0000 (+0100) Subject: Add qplot difference X-Git-Tag: feature/e-rs-comparison X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar.git/commitdiff_plain/refs/tags/feature/e-rs-comparison Add qplot difference --- diff --git a/qplot.py b/qplot.py index 202ac96..087ef98 100644 --- 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()