4 std::vector<RRTNode *> RRTExt3::path()
6 if (this->orig_path().size() == 0) {
7 this->orig_path_ = RRTS::path();
9 class DijkstraNode : public RRTNode {
11 DijkstraNode *s = nullptr;
23 using RRTNode::RRTNode;
25 DijkstraNode *p_ = nullptr;
26 DijkstraNode *p() const { return this->p_; }
27 void p(DijkstraNode *p) { this->p_ = p; }
29 class DijkstraNodeComparator {
32 const DijkstraNode &n1,
33 const DijkstraNode &n2
39 std::vector<DijkstraNode> dn;
40 dn.reserve(this->orig_path().size());
41 unsigned int dncnt = 0;
42 for (auto n: this->orig_path()) {
44 n->t(RRTNodeType::cusp)
45 || n->t(RRTNodeType::connected)
47 dn.push_back(DijkstraNode(*n));
48 dn.back().cc = cc(*n);
49 dn.back().s = &dn.back();
51 dn.back().i = dncnt++;
54 dn.push_back(DijkstraNode(*this->orig_path().back()));
55 dn.back().cc = cc(*this->orig_path().back());
56 dn.back().s = &dn.back();
57 dn.back().n = this->orig_path().back();
58 dn.back().i = dncnt++;
61 std::vector<DijkstraNode>,
62 DijkstraNodeComparator
67 DijkstraNode f = pq.top();
69 for (unsigned int i = f.i + 1; i < dncnt; i++) {
70 double cost = f.cc + this->cost_search(f, dn[i]);
71 this->steer(f, dn[i]);
72 if (this->steered().size() == 0)
73 break; // TODO why not continue?
74 if (std::get<0>(this->collide_steered_from(f)))
76 if (cost < dn[i].cc) {
84 DijkstraNode *ln = nullptr;
89 if (ln == nullptr || ln->p() == nullptr)
90 return this->orig_path();
91 std::vector<RRTNode *> path;