]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Add method find trajectory (backward) from node
authorJiri Hubacek <hubacji1@fel.cvut.cz>
Fri, 24 Aug 2018 13:56:10 +0000 (15:56 +0200)
committerJiri Hubacek <hubacji1@fel.cvut.cz>
Mon, 17 Sep 2018 14:21:59 +0000 (16:21 +0200)
base/rrtbase.cc
incl/rrtbase.h

index 83fa5f27d8055314418406fba4a6e25a87e33653..0dc1ac9b5c166822f864c66a5b1fca47ec2bf9bb 100644 (file)
@@ -290,11 +290,16 @@ bool RRTBase::collide(RRTNode *init, RRTNode *goal)
 }
 
 std::vector<RRTNode *> RRTBase::findt()
+{
+        return this->findt(this->goal_);
+}
+
+std::vector<RRTNode *> RRTBase::findt(RRTNode *n)
 {
         std::vector<RRTNode *> nodes;
-        if (!this->goal_->parent())
+        if (!n->parent())
                 return nodes;
-        RRTNode *tmp = this->goal_;
+        RRTNode *tmp = n;
         while (tmp != this->root_) {
                 nodes.push_back(tmp);
                 if (!tmp->parent())
index ae0f11a1cc536f8a208bdf6693f63ccb1321699b..cee16318dc48c0615ac16ce87f12433557e3c215 100644 (file)
@@ -83,6 +83,7 @@ class RRTBase {
                                 float (*cost)(RRTNode *, RRTNode *));
                 bool collide(RRTNode *init, RRTNode *goal);
                 std::vector<RRTNode *> findt();
+                std::vector<RRTNode *> findt(RRTNode *n);
 
                 // virtuals - implemented by child classes
                 virtual bool next() = 0;