std::swap(q, empty);
}
+void ParallelSlot::fipr(BicycleCar *B)
+{
+ // TODO for right parallel parking also
+ // it's only for lpar scenario now
+
+ std::vector<RRTNode *> cusp;
+ cusp.push_back(new RRTNode(B->x(), B->y(), B->h()));
+ // just copied from fip()
+ this->DH(-0.01 / B->out_radi());
+ BicycleCar *c;
+ c = this->flncr(B);
+ while (c->lfx() < 0) {
+ cusp.push_back(new RRTNode(c->x(), c->y(), c->h()));
+ BicycleCar *cc = this->flncr(c);
+ cc->s(c->s() + 1);
+ delete c;
+ c = cc;
+ }
+ cusp.push_back(new RRTNode(c->x(), c->y(), c->h()));
+ std::reverse(cusp.begin(), cusp.end());
+ this->cusp().push_back(cusp);
+}
+
BicycleCar *ParallelSlot::flnc(BicycleCar *B)
{
// TODO find last not colliding
return B->move(cc, (i - 1) * this->DH());
}
+BicycleCar *ParallelSlot::flncr(BicycleCar *B)
+{
+ // TODO find last not colliding
+ // for now just copy flast()
+ RRTNode *cc;
+ if (int(B->s()) % 2 == 0)
+ cc = BicycleCar(B->x(), B->y(), B->h()).ccr();
+ else
+ cc = BicycleCar(B->x(), B->y(), B->h()).ccl();
+ BicycleCar *p;
+ int i = 1;
+ p = B->move(cc, i * this->DH());
+ while (!this->slot().collide(p->frame())
+ && (
+ (this->DH() > 0 && p->x() >= 0)
+ || (this->DH() < 0 && p->lfx() <= 0)
+ )) {
+ delete p;
+ i += 10;
+ p = B->move(cc, i * this->DH());
+ }
+ i -= 10;
+ p = B->move(cc, i * this->DH());
+ while (!this->slot().collide(p->frame())) {
+ if (this->DH() > 0 && p->x() <= 0) {
+ i += 1;
+ break;
+ }
+ if (this->DH() < 0 && p->lfx() >= 0) {
+ i += 1;
+ break;
+ }
+ delete p;
+ i += 1;
+ p = B->move(cc, i * this->DH());
+ }
+ delete p;
+ return B->move(cc, (i - 1) * this->DH());
+}
+
RRTNode *ParallelSlot::fposecenter()
{
return this->slot().bnodes().front();
// other
/** BFS to _Find Init Pose_. */
void fip();
+ /** _Find Init Pose by Reverse_ approach, see Vorobieva2015
+
+ @param B Last pose of vehicle when it is parked.
+ */
+ void fipr(BicycleCar *B);
+ /** _Find Last Not Colliding for Reverse_ BicycleCar pose
+
+ @param B Find from?
+ */
+ BicycleCar *flncr(BicycleCar *B);
/** _Find Last Not Colliding_ BicycleCar pose
@param B Find from?