]> rtime.felk.cvut.cz Git - hubacji1/psp.git/commitdiff
Add possible inits ut, skeleton
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 23 Aug 2019 13:48:15 +0000 (15:48 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 23 Aug 2019 14:05:21 +0000 (16:05 +0200)
api/psp.h
src/psp.cc
ut/psp.t.cc

index 223e32947b3ac2b154c294bab53ad7f2c13fa5cd..1122d37c62d7b09f563f9f802fb417fc83667523 100644 (file)
--- a/api/psp.h
+++ b/api/psp.h
@@ -60,6 +60,12 @@ class PSPlanner {
                 parking slot `ps`.
                 */
                 bool parked();
+                /*! \brief Return possible starts of parking maneuver
+
+                When any `BicycleCar` of possible inits is reached, then
+                parking maneuver is a peace of cake.
+                */
+                std::vector<BicycleCar> possible_inits();
 
                 // find entry
                 /*! \brief Find entry to the parking slot.
index 1bd9aed342c54f55be32b23aa999e08c584e89ae..86e65332a93a8927230000e00fcb1f0a6a08768a 100644 (file)
@@ -112,6 +112,12 @@ bool PSPlanner::parked()
                 && inside(this->gc().rfx(), this->gc().rfy(), slot);
 }
 
+std::vector<BicycleCar> PSPlanner::possible_inits()
+{
+        std::vector<BicycleCar> pi;
+        return pi;
+}
+
 // find entry
 void PSPlanner::fe()
 {
index 72aefa49cca54978ad8ad22c73530c11bd231ccb..7a343cd8ca982c5a0bc23179e100222859963f4c 100644 (file)
@@ -126,3 +126,36 @@ WVTEST_MAIN("forward perpendicullar parking slot planner")
         WVPASS(psp.left());
         WVPASS(psp.parked());
 }
+
+WVTEST_MAIN("possible goals test")
+{
+        PSPlanner psp;
+        psp.gc().x(0);
+        psp.gc().y(0);
+        psp.gc().h(0);
+        psp.gc().mtr(10);
+        psp.gc().wb(2);
+        psp.gc().w(1);
+        psp.gc().l(3);
+        psp.gc().he(1.5);
+        psp.gc().df(2 + 0.5);
+        psp.gc().dr(0.5);
+        psp.cc() = BicycleCar(psp.gc());
+        psp.cc().sp(1);
+        psp.cc().st(0);
+        psp.cc().next();
+        WVPASSEQ_DOUBLE(psp.gc().x() + 1, psp.cc().x(), 0.00001);
+        WVPASSEQ_DOUBLE(psp.gc().y(), psp.cc().y(), 0.00001);
+        WVPASSEQ_DOUBLE(psp.gc().h(), psp.cc().h(), 0.00001);
+        WVPASS(psp.possible_inits().size() > 0);
+        double i = 1;
+        for (auto &c: psp.possible_inits()) {
+                WVPASSEQ_DOUBLE(psp.gc().x() + 1 + i, c.x(), 0.00001);
+                WVPASSEQ_DOUBLE(psp.gc().y(), c.y(), 0.00001);
+                WVPASSEQ_DOUBLE(psp.gc().h(), c.h(), 0.00001);
+                i++;
+        }
+        WVPASSEQ_DOUBLE(psp.gc().x() + 1, psp.cc().x(), 0.00001);
+        WVPASSEQ_DOUBLE(psp.gc().y(), psp.cc().y(), 0.00001);
+        WVPASSEQ_DOUBLE(psp.gc().h(), psp.cc().h(), 0.00001);
+}