From: Jiri Vlasak Date: Wed, 19 Jun 2019 11:54:15 +0000 (+0200) Subject: Remove tmp graph plot for slot planner X-Git-Tag: v0.7.0~7^2~1 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar.git/commitdiff_plain/90ecc7e06778a4180c50779ebca22516c3f4edd4?hp=59b6078723c61211f5d86799e0040489f1a9edd5 Remove tmp graph plot for slot planner --- diff --git a/gplot.py b/gplot.py index 0cc1168..1e90051 100644 --- a/gplot.py +++ b/gplot.py @@ -263,139 +263,9 @@ def print_successrate(): print("{}: {}".format(a["f"], v[a["f"]])) if __name__ == "__main__": - plt.rcParams["font.size"] = 29 - res = [] - LOGF = "log-slotplanner" - for d in listdir(LOGF): - r = {} - for sf in [i["f"] for i in LOG]: - r[sf] = load_trajectories("{}/{}/{}".format(LOGF, d, sf)) - res.append({ - "f": d, - "elap": get_val_if_exist(r["T2"], "elap"), - "rrte": get_val_if_exist(r["T2"], "rrte"), - "ppse": get_val_if_exist(r["T2"], "ppse"), - "succ": ( - count_if_exist(r["T2"], "traj") / - count_if_exist(r["T2"], "elap") - ), - }) - res2 = [] - LOGF = "log-rrt" - for d in listdir(LOGF): - r = {} - for sf in [i["f"] for i in LOG]: - r[sf] = load_trajectories("{}/{}/{}".format(LOGF, d, sf)) - res2.append({ - "f": d, - "elap": get_val_if_exist(r["T2"], "elap"), - "rrte": get_val_if_exist(r["T2"], "rrte"), - "ppse": get_val_if_exist(r["T2"], "ppse"), - "succ": ( - count_if_exist(r["T2"], "traj") / - count_if_exist(r["T2"], "elap") - ), - }) - - fig = plt.figure() - # For color scheme - # see https://github.com/vega/vega/wiki/Scales#scale-range-literals - ax = fig.add_subplot(111) - ax.set_title("""Elapsed time for different lengths - of parallel parking slot""") - - ax.set_ylabel("Time [s]") - ax.set_xlabel("Parking slot length [m]") - - # res Slot Planner - coord = [float(r["f"].split("_")[1]) for r in res] - - #val = [sum(r["ppse"])/len(r["ppse"]) for r in res] - #fin = [(x, y) for (x, y) in zip(coord, val)] - #fin.sort() - #plt.plot( - # [x for (x, y) in fin], - # [y for (x, y) in fin], - # color = "g", - # label = "Slot Planner", - #) - - val = [max(r["elap"]) for r in res] - fin = [(x, y) for (x, y) in zip(coord, val)] - fin.sort() - plt.plot( - [x for (x, y) in fin], - [y for (x, y) in fin], - color = "#e6550d", - linestyle = "--", - label = "Elapsed worst", - ) - - #val = [sum(r["rrte"])/len(r["rrte"]) for r in res] - #fin = [(x, y) for (x, y) in zip(coord, val)] - #fin.sort() - #plt.plot( - # [x for (x, y) in fin], - # [y for (x, y) in fin], - # color = "#fd8d3c", - # label = "RRT", - #) - - val = [sum(r["elap"])/len(r["elap"]) for r in res] - fin = [(x, y) for (x, y) in zip(coord, val)] - fin.sort() - plt.plot( - [x for (x, y) in fin], - [y for (x, y) in fin], - color = "#e6550d", - label = "Elapsed average", - ) - - val = [r["succ"] for r in res] - fin = [(x, y) for (x, y) in zip(coord, val)] - fin.sort() - plt.plot( - [x for (x, y) in fin], - [y for (x, y) in fin], - #color = "#fd8d3c", - color = "#fdae6b", - label = "Success rate", - ) - - # res2 RRT - coord = [float(r["f"].split("_")[1]) for r in res2] - - val = [max(r["elap"]) for r in res2] - fin = [(x, y) for (x, y) in zip(coord, val)] - fin.sort() - plt.plot( - [x for (x, y) in fin], - [y for (x, y) in fin], - color = "#3182bd", - linestyle = "--", - label = "Elapsed worst", - ) - - val = [sum(r["elap"])/len(r["elap"]) for r in res2] - fin = [(x, y) for (x, y) in zip(coord, val)] - fin.sort() - plt.plot( - [x for (x, y) in fin], - [y for (x, y) in fin], - color = "#3182bd", - label = "Elapsed average", - ) - - val = [r["succ"] for r in res2] - fin = [(x, y) for (x, y) in zip(coord, val)] - fin.sort() - plt.plot( - [x for (x, y) in fin], - [y for (x, y) in fin], - #color = "#6baed6", - color = "#9ecae1", - label = "Success rate", - ) - - plt.legend(bbox_to_anchor=(1, 1), loc=1, borderaxespad=0) - plt.show() + r = {} + for sf in [i["f"] for i in LOG]: + r[sf] = load_trajectories("{}/{}".format(LOGF, sf)) + print_successrate() + plot_maxtime() + plot_costdist()