]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/blobdiff - incl/pslot.hh
Add max cusp getter
[hubacji1/bcar.git] / incl / pslot.hh
index c669d23e7e81d653bce5f18558bc373819a4aa6d..c8962cb2c5d3ff7f4c96c6c037da5c8433aa15f4 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * SPDX-FileCopyrightText: 2021 Jiri Vlasak <jiri.vlasak.2@cvut.cz>
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
 /*! \file */
 #ifndef BCAR_PSLOT_H
 #define BCAR_PSLOT_H
@@ -17,6 +23,9 @@ namespace bcar {
 class ParkingSlot {
 private:
        double offset_ = 0.001; // to avoid collision during init
+       double parking_speed_ = -0.1;
+       unsigned int max_cusp_ = 10;
+       double delta_angle_to_slot_ = 0.001;
        Point border_[4];
        Line entry_;
        Line rear_;
@@ -67,6 +76,40 @@ public:
        /*! Return parking slot's orientation. */
        double h() const;
 
+       /*! Get parking slot's left front point. */
+       Point lf() const;
+
+       /*! Get parking slot's left rear point. */
+       Point lr() const;
+
+       /*! Get parking slot's right rear point. */
+       Point rr() const;
+
+       /*! Get parking slot's right front point. */
+       Point rf() const;
+
+       /*! Get parking slot's entry side. */
+       Line entry() const;
+
+       /*! Get parking slot's rear side. */
+       Line rear() const;
+
+       /*! Get parking slot's curb side. */
+       Line curb() const;
+
+       /*! Get parking slot's front side. */
+       Line front() const;
+
+       /*! Car's next iteration distance. (Negative for backward.) */
+       void set_parking_speed(double s);
+
+       /*! Maximum allowed number of cusp inside the parking slot. */
+       unsigned int get_max_cusp() const;
+       void set_max_cusp(unsigned int m);
+
+       /*! Angle's increment when creating start positions. */
+       void set_delta_angle_to_slot(double d);
+
        /*! Return `true` for the parallel parking slot. */
        bool parallel() const;
 
@@ -85,12 +128,37 @@ public:
        /*! \brief Drive car `c` into the parking slot `this`.
         *
         * \param c Starting bicycle car.
-        * \param max Maximum number of backward-forward direction changes.
         */
-       std::vector<BicycleCar> drive_in_slot(BicycleCar c, unsigned int& max);
+       std::vector<BicycleCar> drive_in_slot(BicycleCar c);
 
-       /*! Find entry. */
-       PoseRange fe();
+       /*! \brief Drive car `c` from slot.
+        *
+        * \param c Starting bicycle car.
+        */
+       std::vector<BicycleCar> drive_of_slot(BicycleCar c);
+
+       /*! \brief Steer car `c` into the parking slot `this`.
+        *
+        * `steer_in_slot` returns the complete path as the list of `Pose`s, not
+        * just cusp `BicycleCar`s as `drive_to_slot`.
+        *
+        * \param c Starting bicycle car.
+        */
+       std::vector<Pose> steer_in_slot(BicycleCar c);
+
+       /*! \brief Find entry.
+        *
+        * \param c For which `BicycleCar` should entry be found?
+        */
+       PoseRange fe(BicycleCar c);
+
+       /*! \brief Recompute zero slot's `PoseRange` entry for `this`.
+        *
+        * The _zero_ slot is the `ParkingSlot(Point(0.0, 0.0), 0.0, W, L);`.
+        *
+        * \param p Computed `PoseRange` entry.
+        */
+       PoseRange recompute_entry(PoseRange p);
 
        friend std::ostream& operator<<(std::ostream& o, ParkingSlot const& s);
 };