]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Add plot for minimum trajectories costs
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Fri, 21 Sep 2018 07:17:16 +0000 (09:17 +0200)
committerJiri Hubacek <hubacji1@fel.cvut.cz>
Fri, 21 Sep 2018 07:18:14 +0000 (09:18 +0200)
gplot.py

index c3e89e30058cddfefe3e4a2ab68af62505e8a06b..f4bbebeb3e1991788623103185bb103f53083876 100644 (file)
--- a/gplot.py
+++ b/gplot.py
@@ -142,5 +142,45 @@ def plot_successrate():
 
     plt.show()
 
+def plot_mintrajcost():
+    """Plot minimum trajectory cost found."""
+    LOGF="logs_inf_sq"
+    ALG=["Karaman2011", "Kuwata2008", "LaValle1998"]
+    ALGT={"Karaman2011": "RRT*",
+            "Kuwata2008": "RRT + heur",
+            "LaValle1998": "RRT"}
+    ST=["3"]
+    STT={"3": "R&S"}
+    CO=["5"]
+    COT={"5": "E2"}
+
+    r={}
+    for a in ALG:
+        for st in ST:
+            for co in CO:
+                r["{}, {}, {}".format(ALGT[a], STT[st], COT[co])] = (
+                        load_trajectories("{}/{}st{}co{}_lpar".format(
+                            LOGF, a, st, co)))
+
+    v={}
+    for a in r.keys():
+        v[a] = get_lasts_if_exist(r[a], "cost")
+
+    #plt.rcParams["font.size"] = 24
+    fig = plt.figure()
+    for i in range(len(r.keys())):
+        ax = fig.add_subplot(3, 1, i + 1)
+        ax.set_title("Minimum trajectory cost found in 10 seconds (sequential)")
+
+        ax.set_ylabel("Framework tested [-]")
+        ax.set_xlabel("Minimum trajectory cost [m]")
+        #ax.set_yticklabels([])
+
+        plt.bar(range(len(v[r.keys()[i]])), v[r.keys()[i]], label=r.keys()[i])
+
+        ax.legend()
+    plt.show()
+    return
+
 if __name__ == "__main__":
-    plot_successrate()
+    plot_mintrajcost()