]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Fix repeating cusp in opt
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 17 Jun 2019 08:39:06 +0000 (10:39 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 17 Jun 2019 08:39:07 +0000 (10:39 +0200)
When two nodes are near themselves, do not use both.

base/rrtbase.cc

index 0234fd450c562caadb46bb7ee2cf853806ca1dc6..130b1385b64753cc7bd4c685f8e1fd8554d5b2b1 100644 (file)
@@ -923,7 +923,10 @@ bool RRTBase::opt_path()
                 return false;
         std::vector<RRTNode *> cusps;
         for (unsigned int i = 0; i < tmp_cusps.size(); i++) {
-                if (tmp_cusps[i] != tmp_cusps[(i + 1) % tmp_cusps.size()])
+                if (!IS_NEAR(
+                        tmp_cusps[i],
+                        tmp_cusps[(i + 1) % tmp_cusps.size()]
+                ))
                         cusps.push_back(tmp_cusps[i]);
         }
         std::reverse(cusps.begin(), cusps.end());