double y_ = 0;
double h_ = 0;
// kinematic constraints
+ double ctc_ = 10.820; // curb-to-curb
+ // FIXME is not mtr; curb-to-curb is 10.820
double mtr_ = 10.820;
double wb_ = 2.450;
// dimensions
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.
+ */
+ double perfect_parking_slot_len() const;
+ /*! \brief Set maximum steering angle.
+ */
+ void set_max_steer();
// car frame
double lfx() const; double lfy() const;
double h() const { return this->h_; }
void h(double h) { this->h_ = h; }
+ double ctc() const { return this->ctc_; }
+ void ctc(double ctc) { this->ctc_ = ctc; }
+
double mtr() const { return this->mtr_; }
void mtr(double mtr) { this->mtr_ = mtr; }
return sqrt(pow(this->mtr() + this->w() / 2, 2) + pow(this->dr(), 2));
}
+double BicycleCar::perfect_parking_slot_len() const
+{
+ // see Simon R. Blackburn *The Geometry of Perfect Parking*
+ // see https://www.ma.rhul.ac.uk/SRBparking
+ double r = this->ctc() / 2;
+ double l = this->wb();
+ double k = this->df() - this->wb();
+ double w = this->w();
+ return
+ this->l()
+ + sqrt(
+ (r*r - l*l)
+ + pow(l + k, 2)
+ - pow(sqrt(r*r - l*l) - w, 2)
+ )
+ - l
+ - k
+ ;
+}
+
+void BicycleCar::set_max_steer()
+{
+ this->st(atan(this->wb() / this->mtr()));
+}
+
// car frame
double BicycleCar::lfx() const
{
// moving
void BicycleCar::next()
{
- if (this->st() > this->wb() / this->mtr())
- this->st(this->wb() / this->mtr());
- if (this->st() < -this->wb() / this->mtr())
- this->st(-this->wb() / this->mtr());
+ // FIXME
+ //if (this->st() > this->wb() / this->mtr())
+ // this->st(this->wb() / this->mtr());
+ //if (this->st() < -this->wb() / this->mtr())
+ // this->st(-this->wb() / this->mtr());
this->h(this->h() + this->sp() / this->wb() * tan(this->st()));
this->x(this->x() + this->sp() * cos(this->h()));
this->y(this->y() + this->sp() * sin(this->h()));
BicycleCar::BicycleCar()
{
+ // TODO according to mtr_ FIXME
+ this->mtr_ = sqrt(
+ pow(10.82 / 2, 2)
+ - pow(this->wb(), 2)
+ )
+ - this->w() / 2
+ ;
}
std::tuple<bool, unsigned int, unsigned int> collide(