]> rtime.felk.cvut.cz Git - hubacji1/bcar.git/commitdiff
Move methods from bicycle car to car size
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 13 Jul 2021 14:30:06 +0000 (16:30 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Tue, 13 Jul 2021 14:30:06 +0000 (16:30 +0200)
incl/bcar.hh
src/bcar.cc

index e35f9641c70fe34e88851ceafffe0121577bb18b..9f7a3697d06efb2b5756f59c7c500234af7158aa 100644 (file)
@@ -216,6 +216,39 @@ public:
         * radius.
         */
        double mtr() const;
+
+       /*! \brief Return inner radius.
+        *
+        * The inner radius is the distance from minimum turning radius circle
+        * center to the nearest point on the car. In this case, the nearest
+        * points on the car are rear axle endpoints.
+        */
+       double iradi() const;
+
+       /*! \brief Return outer front radius.
+        *
+        * The outer front radius is the distance from minimum turning radius
+        * circle center to the farthest point on the front (from the rear axle
+        * view) part of the car.
+        */
+       double ofradi() const;
+
+       /*! \brief Return outer rear radius.
+        *
+        * The outer rear radius is the distance from minimum turning radius
+        * circle center to the farthest point on the rear (from the rear axle
+        * view) part of the car.
+        */
+       double orradi() const;
+
+       /*! \brief Return length of perfect parking slot.
+        *
+        * The width of the slot is the same as the width of the car.
+        *
+        * \see Simon R. Blackburn *The Geometry of Perfect Parking*
+        * \see https://www.ma.rhul.ac.uk/SRBparking
+        */
+       double perfect_parking_slot_len() const;
 };
 
 /*! Store car motion. */
@@ -254,39 +287,6 @@ public:
        bool drivable(PoseRange const& p) const;
        bool drivable(Pose const& p) const;
 
-       /*! \brief Return inner radius.
-        *
-        * The inner radius is the distance from minimum turning radius circle
-        * center to the nearest point on the car. In this case, the nearest
-        * points on the car are rear axle endpoints.
-        */
-       double iradi() const;
-
-       /*! \brief Return outer front radius.
-        *
-        * The outer front radius is the distance from minimum turning radius
-        * circle center to the farthest point on the front (from the rear axle
-        * view) part of the car.
-        */
-       double ofradi() const;
-
-       /*! \brief Return outer rear radius.
-        *
-        * The outer rear radius is the distance from minimum turning radius
-        * circle center to the farthest point on the rear (from the rear axle
-        * view) part of the car.
-        */
-       double orradi() const;
-
-       /*! \brief Return length of perfect parking slot.
-        *
-        * The width of the slot is the same as the width of the car.
-        *
-        * \see Simon R. Blackburn *The Geometry of Perfect Parking*
-        * \see https://www.ma.rhul.ac.uk/SRBparking
-        */
-       double perfect_parking_slot_len() const;
-
        /*! Set maximum steering angle. */
        void set_max_steer();
 
index 6b264c9c1dae972732d1fd9b445464a304524808..ef7300e2ecdee573a3d951dab061b3a0f387b392 100644 (file)
@@ -373,6 +373,40 @@ CarSize::mtr() const
        return sqrt(ctc2 - wb2) - this->w() / 2.0;
 }
 
+double
+CarSize::iradi() const
+{
+       return this->mtr() - this->w() / 2;
+}
+
+double
+CarSize::ofradi() const
+{
+       auto mtrw2 = pow(this->mtr() + this->w() / 2.0, 2.0);
+       auto df2 = pow(this->df(), 2.0);
+       return sqrt(mtrw2 + df2);
+}
+
+double
+CarSize::orradi() const
+{
+       auto mtrw2 = pow(this->mtr() + this->w() / 2.0, 2.0);
+       auto dr2 = pow(this->dr(), 2.0);
+       return sqrt(mtrw2 + dr2);
+}
+
+double
+CarSize::perfect_parking_slot_len() const
+{
+       auto r = this->ctc() / 2.0;
+       auto l = this->wb();
+       auto k = this->df() - this->wb();
+       auto w = this->w();
+       auto r2l2 = r * r - l * l;
+       auto s = r2l2 + pow(l + k, 2.0) - pow(sqrt(r2l2) - w, 2.0);
+       return this->len() + sqrt(s) - l - k;
+}
+
 double
 CarMove::sp() const
 {
@@ -493,40 +527,6 @@ BicycleCar::drivable(PoseRange const& p) const
        return false;
 }
 
-double
-BicycleCar::iradi() const
-{
-       return this->mtr() - this->w() / 2;
-}
-
-double
-BicycleCar::ofradi() const
-{
-       auto mtrw2 = pow(this->mtr() + this->w() / 2.0, 2.0);
-       auto df2 = pow(this->df(), 2.0);
-       return sqrt(mtrw2 + df2);
-}
-
-double
-BicycleCar::orradi() const
-{
-       auto mtrw2 = pow(this->mtr() + this->w() / 2.0, 2.0);
-       auto dr2 = pow(this->dr(), 2.0);
-       return sqrt(mtrw2 + dr2);
-}
-
-double
-BicycleCar::perfect_parking_slot_len() const
-{
-       auto r = this->ctc() / 2.0;
-       auto l = this->wb();
-       auto k = this->df() - this->wb();
-       auto w = this->w();
-       auto r2l2 = r * r - l * l;
-       auto s = r2l2 + pow(l + k, 2.0) - pow(sqrt(r2l2) - w, 2.0);
-       return this->len() + sqrt(s) - l - k;
-}
-
 void
 BicycleCar::set_max_steer()
 {