11 /*! \brief Parking slot basic class.
13 * This class contains some geometrical computations of parking slot. Parking
14 * slot consists of 4 cartesian coordinates `border` representing the border of
19 double offset_ = 0.001; // to avoid collision during init
20 double parking_speed_ = -0.1;
21 unsigned int max_cusp_ = 10;
22 double delta_angle_to_slot_ = 0.001;
29 /*! \brief Set parking slot.
31 \param p Point with `x`, `y` coordinates of entry side's corner.
32 \param h Direction of the entry side.
33 \param W The width of the slot.
34 \param L The length of the slot.
36 ParkingSlot(Point p, double h, double W, double L);
37 ParkingSlot(double lrx, double lry, double rrx, double rry, double rfx,
38 double rfy, double lfx, double lfy);
40 /*! Get slot's length. */
43 /*! Get slot's width. */
46 /*! Get slot's left front x coordinate. */
49 /*! Get slot's left front y coordinate. */
52 /*! Get slot's left rear x coordinate. */
55 /*! Get slot's left rear y coordinate. */
58 /*! Get slot's right rear x coordinate. */
61 /*! Get slot's right rear y coordinate. */
64 /*! Get slot's right front x coordinate. */
67 /*! Get slot's right front y coordinate. */
70 /*! Return parking slot's orientation. */
73 /*! Get parking slot's left front point. */
76 /*! Get parking slot's left rear point. */
79 /*! Get parking slot's right rear point. */
82 /*! Get parking slot's right front point. */
85 /*! Get parking slot's entry side. */
88 /*! Get parking slot's rear side. */
91 /*! Get parking slot's curb side. */
94 /*! Get parking slot's front side. */
97 /*! Car's next iteration distance. (Negative for backward.) */
98 void set_parking_speed(double s);
100 /*! Maximum allowed number of cusp inside the parking slot. */
101 void set_max_cusp(unsigned int m);
103 /*! Angle's increment when creating start positions. */
104 void set_delta_angle_to_slot(double d);
106 /*! Return `true` for the parallel parking slot. */
107 bool parallel() const;
109 /*! Return `true` for the parking slot on the right side. */
112 /*! Change side of the parking slot. */
115 /*! Return `true` if car `c` is parking in slot `this`. */
116 bool parked(BicycleCar const& c) const;
118 /*! Return `true` if `c`'s car frame collide with `this` border. */
119 bool collide(BicycleCar const& c) const;
121 /*! \brief Drive car `c` into the parking slot `this`.
123 * \param c Starting bicycle car.
125 std::vector<BicycleCar> drive_in_slot(BicycleCar c);
127 /*! \brief Steer car `c` into the parking slot `this`.
129 * `steer_in_slot` returns the complete path as the list of `Pose`s, not
130 * just cusp `BicycleCar`s as `drive_to_slot`.
132 * \param c Starting bicycle car.
134 std::vector<Pose> steer_in_slot(BicycleCar c);
136 /*! \brief Find entry.
138 * \param c For which `BicycleCar` should entry be found?
140 PoseRange fe(BicycleCar c);
142 /*! \brief Recompute zero slot's `PoseRange` entry for `this`.
144 * The _zero_ slot is the `ParkingSlot(Point(0.0, 0.0), 0.0, W, L);`.
146 * \param p Computed `PoseRange` entry.
148 PoseRange recompute_entry(PoseRange p);
150 friend std::ostream& operator<<(std::ostream& o, ParkingSlot const& s);
154 #endif /* BCAR_PSLOT_H */