std::vector<RRTNode> goals_;
std::vector<RRTNode> nodes_;
std::vector<RRTNode> samples_;
+ std::vector<RRTNode> steered_;
// RRT procedures
bool collide();
public:
/*! \brief Return path found by RRT*.
*/
- std::vector<std::reference_wrapper<RRTNode>> path();
+ std::vector<RRTNode *> path();
/*! \brief Run next RRT* iteration.
*/
bool next();
std::vector<RRTNode> &goals() { return this->goals_; }
std::vector<RRTNode> &nodes() { return this->nodes_; }
std::vector<RRTNode> &samples() { return this->samples_; }
+ std::vector<RRTNode> &steered() { return this->steered_; }
RRTS();
};
return nv;
}
-bool RRTS::steer(
- RRTNode &f,
- RRTNode &t
-)
+void RRTS::steer(RRTNode &f, RRTNode &t)
{
- bool next = false;
- return next;
+ double angl = atan2(t.y() - f.y(), t.x() - f.x());
+ this->steered().clear();
+ this->steered().push_back(RRTNode());
+ this->steered().back().x(f.x() + ETA * cos(angl));
+ this->steered().back().y(f.y() + ETA * sin(angl));
+ this->steered().back().h(angl);
}
// RRT* procedures