X-Git-Url: https://rtime.felk.cvut.cz/gitweb/hubacji1/psp.git/blobdiff_plain/ca076144ef3dd4e2bdbe5e8d722c6c183cacdc31..91541605f9ec44d8ad7432c3d39d8747846d8dd9:/api/psp.h diff --git a/api/psp.h b/api/psp.h index 2520dcb..b390a76 100644 --- a/api/psp.h +++ b/api/psp.h @@ -7,6 +7,8 @@ #include "bcar.h" #include "pslot.h" +#define FORWARD_PARKING 0 + /*! \brief Parking Slot Planner basic class. \param cc Current bicycle car. @@ -19,11 +21,17 @@ class PSPlanner { BicycleCar gc_; ParkingSlot ps_; - // find entry to slot by reverse approach + unsigned int c_ = 0; // number of cusps + std::vector cusps_; + + // find entry to slot void fe_parallel(); void fe_perpendicular(); + // find entry to slot by reverse approach void fer_parallel(); void fer_perpendicular(); + // set goal car + void gc_to_4(); public: /*! \brief Return `true` if there is collision. @@ -48,6 +56,12 @@ class PSPlanner { Set the goal car guessed from the parking slot. */ void guess_gc(); + /*! \brief Return last maneuver to the parking slot. + + Return path from entry point towards parking slot, such + that ``cc`` is inside the parking slot at the end. + */ + std::vector last_maneuver(); /*! \brief Has current car `cc` left? Return `true` if the current car `cc` left the parking @@ -68,14 +82,23 @@ class PSPlanner { \param cnt Number of inits. \param dist Distance between inits. */ - std::vector possible_inits( + std::vector possible_goals( unsigned int cnt, double dist ); - std::vector possible_inits() + std::vector possible_goals() { - return this->possible_inits(10, 1); + return this->possible_goals(10, 0.5); } + /*! \brief Shrink parking slot to perfect length. + + Based on goal car dimensions, shrink `p1` and `p2` + towards the `p3` and `p4`. (Because backward parallel + parking). + + NOTE: This function works for parallel parking only. + */ + void shrink_to_perfect_len(); // find entry /*! \brief Find entry to the parking slot. @@ -92,6 +115,9 @@ class PSPlanner { BicycleCar &gc() { return this->gc_; } ParkingSlot &ps() { return this->ps_; } + unsigned int c() const { return this->c_; } + std::vector &cusps() { return this->cusps_; } + PSPlanner(); };