2 This file is part of I am car.
4 I am car is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 I am car is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with I am car. If not, see <http://www.gnu.org/licenses/>.
24 #define BCAR_HEIGHT 1.450
25 #define BCAR_LENGTH 3.760
26 #define BCAR_SAFETY_DIST 0
27 #define BCAR_TURNING_RADIUS 10.820
28 #define BCAR_WHEEL_BASE 2.450
29 #define BCAR_WIDTH 1.625
31 #define MAXSTEER(wb, tr) ((wb) / (tr))
33 class BicycleCar: public RRTNode {
35 // see https://en.wikipedia.org/wiki/Fiat_Punto
36 const float height_ = BCAR_HEIGHT;
37 const float length_ = BCAR_LENGTH;
38 const float safety_dist_ = BCAR_SAFETY_DIST;
39 const float turning_radius_ = BCAR_TURNING_RADIUS;
40 const float wheel_base_ = BCAR_WHEEL_BASE;
41 const float width_ = BCAR_WIDTH;
46 BicycleCar *bcparent_;
48 using RRTNode::RRTNode;
72 /** Return circle center on the left side of the car */
74 /** Return circle center on the right side of the car */
80 BicycleCar *bcparent() const;
86 void bcparent(BicycleCar *bcp);
89 std::vector<RRTEdge *> frame();
91 bool next(float speed, float steer);
93 /** Return distance from wheelbase center to top corner */
95 /** Outer radius of the farthest point */
97 /** Angle between wheelbase line and outer radius */
99 /** Return true if `n` not inside of `ccl`, `ccr` */
100 bool drivable(RRTNode *n);
101 /** Return node rotated by `dh` around `c` */
102 BicycleCar *move(RRTNode *c, float dh);