]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blobdiff - src/test2.cc
Add method to set dimensions of more cars
[hubacji1/iamcar2.git] / src / test2.cc
index 92e97f4e5d89b82c34c4c9468609539274f661b7..6f4f3793200f7f9228ea64c15c1e9d937f73c6ec 100644 (file)
@@ -1,6 +1,6 @@
 #include <chrono>
 #include <iostream>
-#include <jsoncpp/json/json.h>
+#include <json/json.h>
 
 #include "rrts.h"
 
@@ -109,6 +109,9 @@ int main()
         {
                 jvo["time"] = TDIFF();
         }
+        {
+                jvo["iterations"] = rrts.icnt();
+        }
         {
                 if (rrts.path().size() > 0) {
                         jvo["cost"] = cc(*rrts.path().back());
@@ -148,13 +151,24 @@ int main()
                         jvo["goal"][1] = rrts.path().back()->y();
                         jvo["goal"][2] = rrts.path().back()->h();
                 }
+                unsigned int cu = 0;
+                unsigned int co = 0;
                 unsigned int pcnt = 0;
                 for (auto n: rrts.path()) {
                         jvo["path"][pcnt][0] = n->x();
                         jvo["path"][pcnt][1] = n->y();
                         jvo["path"][pcnt][2] = n->h();
+                        if (n->t(RRTNodeType::cusp))
+                                cu++;
+                        if (n->t(RRTNodeType::connected))
+                                co++;
                         pcnt++;
                 }
+                jvo["cusps-in-path"] = cu;
+                jvo["connecteds-in-path"] = co;
+        }
+        {
+                jvo["nodes"] = (unsigned int) rrts.nodes().size();
         }
 
         std::cout << jvo << std::endl;