]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Update is inside slot check
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Sun, 10 Mar 2019 16:51:38 +0000 (17:51 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 29 Mar 2019 15:51:38 +0000 (16:51 +0100)
decision_control/slotplanner.cc
incl/slotplanner.h

index 5e719a0e4871026102e5328ee74f2b6c70e5cd6d..6b378cb883dedcde3d03b546330587529a69aa50 100644 (file)
@@ -152,9 +152,7 @@ void ParallelSlot::fip()
         while (!q.empty()) {
                 c = q.front();
                 q.pop();
-                if (this->DH() > 0 && c->rfx() <= 0 && c->rrx() <= 0) {
-                        goto createcuspandfinish;
-                } else if (this->DH() < 0 && c->lfx() >= 0 && c->lrx() >= 0) {
+                if (this->isInside(c)) {
                         goto createcuspandfinish;
                 } else if (c->s() < 9) {
                         BicycleCar *cc = this->flnc(c);
@@ -389,6 +387,29 @@ void ParallelSlot::fpose()
         }
 }
 
+bool ParallelSlot::isInside(BicycleCar *c)
+{
+        bool inside = true;
+        RRTNode *tmpn;
+        tmpn = new RRTNode(c->lfx(), c->lfy(), 0);
+        if (!this->slot().collide(tmpn))
+                inside = false;
+        delete tmpn;
+        tmpn = new RRTNode(c->lrx(), c->lry(), 0);
+        if (!this->slot().collide(tmpn))
+                inside = false;
+        delete tmpn;
+        tmpn = new RRTNode(c->rrx(), c->rry(), 0);
+        if (!this->slot().collide(tmpn))
+                inside = false;
+        delete tmpn;
+        tmpn = new RRTNode(c->rfx(), c->rfy(), 0);
+        if (!this->slot().collide(tmpn))
+                inside = false;
+        delete tmpn;
+        return inside;
+}
+
 struct SamplingInfo ParallelSlot::getSamplingInfo()
 {
         struct SamplingInfo si;
index 8ff643128a0df1465235ce040e4a41d9ee1f744f..8bc80ee11cb46b8fbe6fc878247858fe11b731cc 100644 (file)
@@ -93,6 +93,8 @@ class ParallelSlot {
                 );
                 /** Test possible init poses */
                 void fpose();
+                /** Return true if car is inside slot */
+                bool isInside(BicycleCar *c);
                 /** Return values to set sampling function of RRT */
                 struct SamplingInfo getSamplingInfo();
 };