]> rtime.felk.cvut.cz Git - hubacji1/rrts.git/commitdiff
Use goal zone in connect
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 3 May 2021 13:03:02 +0000 (15:03 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 3 May 2021 13:03:34 +0000 (15:03 +0200)
src/rrts.cc

index 5a69baec5749f73b65227b3982ba09087b4efb05..438392dabe1a54e4fe020ba30e8591cffa626b53 100644 (file)
@@ -418,11 +418,16 @@ bool RRTS::connect()
                 this->join_tmp_steered(f);
                 f = &this->nodes().back();
         }
-        if (sqrt(
-                pow(f->x() - t->x(), 2)
-                + pow(f->y() - t->y(), 2)
-        ) > 0.2)
-                return false;
+        auto fbc = BicycleCar();
+        fbc.x(f->x());
+        fbc.y(f->y());
+        fbc.h(f->h());
+        auto tbc = BicycleCar();
+        tbc.x(t->x());
+        tbc.y(t->y());
+        tbc.h(t->h());
+        if (!tbc.drivable(fbc))
+            return false;
         // cont.
         this->store_node(this->steered().front());
         t = &this->nodes().back();