]> rtime.felk.cvut.cz Git - hubacji1/psp.git/commitdiff
Check if should continue by forward move
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 3 Jul 2020 13:16:12 +0000 (15:16 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 3 Jul 2020 13:16:15 +0000 (15:16 +0200)
If the car heading points towards parking slot, it should not continue.
Instead, the next iteration should be considered.

src/psp.cc

index 31c71c3d044854dd7e07629a91f04182041ee7cc..aabe5ec1867f424b6584e86a6b9151fff109194d 100644 (file)
@@ -437,7 +437,14 @@ void PSPlanner::fe_parallel()
                         } else {
                             continue;
                         }
-                        // TODO if cc.h < ps.h --> continue
+                        if (::right_side_of_line(
+                            this->cc().x(), this->cc().y(),
+                            this->cc().x() + cos(this->ps().heading()),
+                            this->cc().y() + sin(this->ps().heading()),
+                            this->cc().x() + cos(this->cc().h()),
+                            this->cc().y() + sin(this->cc().h())
+                        ))
+                            continue;
                 } else if (this->ps().right() && this->cc().sp() > 0) {
                         double ccrx = this->cc().ccr().x();
                         double ccry = this->cc().ccr().y();