33 #define HC_REGULAR false
34 #define CC_REGULAR false
71 double x = (c1.
xc + c2.
xc) / 2;
72 double y = (c1.
yc + c2.
yc) / 2;
103 TT_tangent_circles(c1, c2, q2);
108 return (*cstart)->hc_turn_length(**q1) + (*cend)->hc_turn_length(**q3);
129 double delta_y = 0.0;
164 TcT_tangent_circles(c1, c2, q);
167 return (*cstart)->rs_turn_length(**q) + (*cend)->rs_turn_length(**q);
189 double theta =
angle;
192 double delta_y = sqrt(pow(r, 2) - pow(delta_x, 2));
200 TcT_tangent_circles(c1, tgt1, q1);
201 TcT_tangent_circles(tgt1, c2, q2);
202 TcT_tangent_circles(c1, tgt2, q3);
203 TcT_tangent_circles(tgt2, c2, q4);
210 TcTcT_tangent_circles(c1, c2, &qa, &qb, &qc, &qd);
219 double length1 = (*cstart)->rs_turn_length(*qa) + middle1->
rs_turn_length(*qb) + (*cend)->rs_turn_length(*qb);
220 double length2 = (*cstart)->rs_turn_length(*qc) + middle2->
rs_turn_length(*qd) + (*cend)->rs_turn_length(*qd);
221 if (length1 < length2)
241 return numeric_limits<double>::max();
255 return (distance <= 2 * parent_->radius_ + 2 * fabs(c1.
kappa_inv)) &&
262 double theta =
angle;
264 double r2 = 2 * parent_->
radius_;
265 double delta_x = (pow(r1, 2) + pow(
distance, 2) - pow(r2, 2)) / (2 *
distance);
266 double delta_y = sqrt(pow(r1, 2) - pow(delta_x, 2));
274 TcT_tangent_circles(c1, tgt1, q1);
275 TT_tangent_circles(tgt1, c2, q2);
276 TcT_tangent_circles(c1, tgt2, q3);
277 TT_tangent_circles(tgt2, c2, q4);
284 TcTT_tangent_circles(c1, c2, &qa, &qb, &qc, &qd);
297 if (length1 < length2)
321 return numeric_limits<double>::max();
335 return (distance <= 2 * parent_->radius_ + 2 * fabs(c1.
kappa_inv)) &&
342 double theta =
angle;
343 double r1 = 2 * parent_->
radius_;
345 double delta_x = (pow(r1, 2) + pow(
distance, 2) - pow(r2, 2)) / (2 *
distance);
346 double delta_y = sqrt(pow(r1, 2) - pow(delta_x, 2));
354 TT_tangent_circles(c1, tgt1, q1);
355 TcT_tangent_circles(tgt1, c2, q2);
356 TT_tangent_circles(c1, tgt2, q3);
357 TcT_tangent_circles(tgt2, c2, q4);
364 TTcT_tangent_circles(c1, c2, &qa, &qb, &qc, &qd);
377 if (length1 < length2)
401 return numeric_limits<double>::max();
433 return TiST_exists(c1, c2) || TeST_exists(c1, c2);
484 double theta = atan2(c2.
yc - c1.
yc, c2.
xc - c1.
xc);
519 TiST_tangent_circles(c1, c2, q2, q3);
524 return (*cstart)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) + (*cend)->hc_turn_length(**q4);
530 TeST_tangent_circles(c1, c2, q2, q3);
535 return (*cstart)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) + (*cend)->hc_turn_length(**q4);
541 if (TiST_exists(c1, c2))
543 return TiST_path(c1, c2, cstart, cend, q1, q2, q3, q4);
545 if (TeST_exists(c1, c2))
547 return TeST_path(c1, c2, cstart, cend, q1, q2, q3, q4);
549 return numeric_limits<double>::max();
582 return TiSTcT_exists(c1, c2) || TeSTcT_exists(c1, c2);
589 double theta =
angle;
591 double delta_x = sqrt(pow(2 * c2.
kappa_inv, 2) - pow(delta_y, 2));
597 TiST_tangent_circles(c1, tgt1, q2, q3);
598 TcT_tangent_circles(tgt1, c2, q4);
605 return (*cstart)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) + (*ci)->hc_turn_length(**q4) +
606 (*cend)->rs_turn_length(**q4);
613 double theta =
angle;
621 TeST_tangent_circles(c1, tgt1, q2, q3);
622 TcT_tangent_circles(tgt1, c2, q4);
629 return (*cstart)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) + (*ci)->hc_turn_length(**q4) +
630 (*cend)->rs_turn_length(**q4);
637 if (TiSTcT_exists(c1, c2))
639 return TiSTcT_path(c1, c2, cstart, cend, q1, q2, q3, q4, ci);
641 if (TeSTcT_exists(c1, c2))
643 return TeSTcT_path(c1, c2, cstart, cend, q1, q2, q3, q4, ci);
645 return numeric_limits<double>::max();
678 return TcTiST_exists(c1, c2) || TcTeST_exists(c1, c2);
685 double theta =
angle;
687 double delta_x = sqrt(pow(2 * c2.
kappa_inv, 2) - pow(delta_y, 2));
693 TcT_tangent_circles(c1, tgt1, q1);
694 TiST_tangent_circles(tgt1, c2, q2, q3);
701 return (*cstart)->rs_turn_length(**q1) + (*ci)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) +
702 (*cend)->hc_turn_length(**q4);
709 double theta =
angle;
717 TcT_tangent_circles(c1, tgt1, q1);
718 TeST_tangent_circles(tgt1, c2, q2, q3);
725 return (*cstart)->rs_turn_length(**q1) + (*ci)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) +
726 (*cend)->hc_turn_length(**q4);
733 if (TcTiST_exists(c1, c2))
735 return TcTiST_path(c1, c2, cstart, cend, q1, q2, q3, q4, ci);
737 if (TcTeST_exists(c1, c2))
739 return TcTeST_path(c1, c2, cstart, cend, q1, q2, q3, q4, ci);
741 return numeric_limits<double>::max();
774 return TcTiSTcT_exists(c1, c2) || TcTeSTcT_exists(c1, c2);
781 double theta =
angle;
783 double delta_x = sqrt(pow(2 * c1.
kappa_inv, 2) - pow(delta_y, 2));
791 TcT_tangent_circles(c1, tgt1, q1);
792 TiST_tangent_circles(tgt1, tgt2, q2, q3);
793 TcT_tangent_circles(tgt2, c2, q4);
800 return (*cstart)->rs_turn_length(**q1) + (*ci1)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) +
801 (*ci2)->hc_turn_length(**q4) + (*cend)->rs_turn_length(**q4);
808 double theta =
angle;
818 TcT_tangent_circles(c1, tgt1, q1);
819 TeST_tangent_circles(tgt1, tgt2, q2, q3);
820 TcT_tangent_circles(tgt2, c2, q4);
827 return (*cstart)->rs_turn_length(**q1) + (*ci1)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) +
828 (*ci2)->hc_turn_length(**q4) + (*cend)->rs_turn_length(**q4);
835 if (TcTiSTcT_exists(c1, c2))
837 return TcTiSTcT_path(c1, c2, cstart, cend, q1, q2, q3, q4, ci1, ci2);
839 if (TcTeSTcT_exists(c1, c2))
841 return TcTeSTcT_path(c1, c2, cstart, cend, q1, q2, q3, q4, ci1, ci2);
843 return numeric_limits<double>::max();
857 return (distance <= 4 * parent_->radius_ + 2 * fabs(c1.
kappa_inv));
863 double theta =
angle;
864 double r1, r2, delta_x, delta_y, x, y;
867 if (distance < 4 * parent_->radius_ - 2 * fabs(c1.
kappa_inv))
870 delta_y = sqrt(pow(r2, 2) - pow(delta_x, 2));
875 delta_y = sqrt(pow(r2, 2) - pow(delta_x, 2));
888 TT_tangent_circles(c1, tgt1, q1);
889 TcT_tangent_circles(tgt1, tgt2, q2);
890 TT_tangent_circles(tgt2, c2, q3);
892 TT_tangent_circles(c1, tgt3, q4);
893 TcT_tangent_circles(tgt3, tgt4, q5);
894 TT_tangent_circles(tgt4, c2, q6);
902 TTcTT_tangent_circles(c1, c2, &qa, &qb, &qc, &qd, &qe, &qf);
903 HC_CC_Circle *start1, *start2, *end1, *end2, *middle1, *middle2, *middle3, *middle4;
921 if (length1 < length2)
933 delete start2,
delete end2,
delete middle3;
955 return numeric_limits<double>::max();
976 double theta =
angle;
979 double delta_x = (pow(r1, 2) + pow(
distance / 2, 2) - pow(r2, 2)) /
distance;
980 double delta_y = sqrt(pow(r1, 2) - pow(delta_x, 2));
993 TcT_tangent_circles(c1, tgt1, q1);
994 TT_tangent_circles(tgt1, tgt2, q2);
995 TcT_tangent_circles(tgt2, c2, q3);
997 TcT_tangent_circles(c1, tgt3, q4);
998 TT_tangent_circles(tgt3, tgt4, q5);
999 TcT_tangent_circles(tgt4, c2, q6);
1006 TcTTcT_tangent_circles(c1, c2, &qa, &qb, &qc, &qd, &qe, &qf);
1018 (*cend)->rs_turn_length(*qc);
1020 (*cend)->rs_turn_length(*qf);
1021 if (length1 < length2)
1049 return numeric_limits<double>::max();
1071 double theta =
angle;
1072 double r = 2 * parent_->
radius_;
1074 double delta_y = sqrt(pow(r, 2) - pow(delta_x, 2));
1082 TT_tangent_circles(c1, tgt1, q1);
1083 TT_tangent_circles(tgt1, c2, q2);
1084 TT_tangent_circles(c1, tgt2, q3);
1085 TT_tangent_circles(tgt2, c2, q4);
1092 TTT_tangent_circles(c1, c2, &qa, &qb, &qc, &qd);
1093 HC_CC_Circle *start1, *start2, *end1, *end2, *middle1, *middle2;
1107 if (length1 < length2)
1135 return numeric_limits<double>::max();
1169 return TciST_exists(c1, c2) || TceST_exists(c1, c2);
1176 double delta_x1 = 0.0;
1216 return (*cstart)->rs_turn_length(**q1) +
configuration_distance(**q1, **q2) + (*cend)->hc_turn_length(**q3);
1223 double delta_x1 = 0.0;
1263 return (*cstart)->rs_turn_length(**q1) +
configuration_distance(**q1, **q2) + (*cend)->hc_turn_length(**q3);
1269 if (TciST_exists(c1, c2))
1271 return TciST_path(c1, c2, cstart, cend, q1, q2, q3);
1273 if (TceST_exists(c1, c2))
1275 return TceST_path(c1, c2, cstart, cend, q1, q2, q3);
1277 return numeric_limits<double>::max();
1311 return TiScT_exists(c1, c2) || TeScT_exists(c1, c2);
1320 double delta_x2 = 0.0;
1358 return (*cstart)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) + (*cend)->rs_turn_length(**q3);
1367 double delta_x2 = 0.0;
1405 return (*cstart)->hc_turn_length(**q1) +
configuration_distance(**q2, **q3) + (*cend)->rs_turn_length(**q3);
1411 if (TiScT_exists(c1, c2))
1413 return TiScT_path(c1, c2, cstart, cend, q1, q2, q3);
1415 if (TeScT_exists(c1, c2))
1417 return TeScT_path(c1, c2, cstart, cend, q1, q2, q3);
1419 return numeric_limits<double>::max();
1451 return TciScT_exists(c1, c2) || TceScT_exists(c1, c2);
1458 double delta_x = 0.0;
1495 return (*cstart)->rs_turn_length(**q1) +
configuration_distance(**q1, **q2) + (*cend)->rs_turn_length(**q2);
1501 double theta =
angle;
1502 double delta_x = 0.0;
1535 return (*cstart)->rs_turn_length(**q1) +
configuration_distance(**q1, **q2) + (*cend)->rs_turn_length(**q2);
1541 if (TciScT_exists(c1, c2))
1543 return TciScT_path(c1, c2, cstart, cend, q1, q2);
1545 if (TceScT_exists(c1, c2))
1547 return TceScT_path(c1, c2, cstart, cend, q1, q2);
1549 return numeric_limits<double>::max();
1555 HCpmpm_Reeds_Shepp_State_Space::HCpmpm_Reeds_Shepp_State_Space(
double kappa,
double sigma,
double discretization)
1557 , hcpmpm_reeds_shepp_{ unique_ptr<HCpmpm_Reeds_Shepp>(
new HCpmpm_Reeds_Shepp(
this)) }
1559 rs_circle_param_.set_param(kappa_, numeric_limits<double>::max(), 1 / kappa_, 0.0, 0.0, 1.0, 0.0);
1560 radius_ = hc_cc_circle_param_.radius;
1561 mu_ = hc_cc_circle_param_.mu;
1562 sin_mu_ = hc_cc_circle_param_.sin_mu;
1563 cos_mu_ = hc_cc_circle_param_.cos_mu;
1717 qi3[best_path], qi4[best_path], cstart[best_path], cend[best_path], ci1[best_path],
1718 ci2[best_path],
length[best_path]);
1758 HC_CC_RS_Path *
path[] = {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
1759 nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr };
1761 double lg[] = { numeric_limits<double>::max(), numeric_limits<double>::max(), numeric_limits<double>::max(),
1762 numeric_limits<double>::max(), numeric_limits<double>::max(), numeric_limits<double>::max(),
1763 numeric_limits<double>::max(), numeric_limits<double>::max(), numeric_limits<double>::max(),
1764 numeric_limits<double>::max(), numeric_limits<double>::max(), numeric_limits<double>::max(),
1765 numeric_limits<double>::max(), numeric_limits<double>::max(), numeric_limits<double>::max(),
1766 numeric_limits<double>::max() };
1768 for (
int i = 0; i < 4; i++)
1771 if (i == 0 && state1.
kappa < 0)
1773 else if (i == 1 && state1.
kappa > 0)
1775 else if (i == 2 && state1.
kappa < 0)
1777 else if (i == 3 && state1.
kappa > 0)
1779 for (
int j = 0; j < 4; j++)
1782 if (j == 0 && state2.
kappa < 0)
1784 else if (j == 1 && state2.
kappa > 0)
1786 else if (j == 2 && state2.
kappa < 0)
1788 else if (j == 3 && state2.
kappa > 0)
1791 if (
path[4 * i + j])
1793 lg[4 * i + j] =
path[4 * i + j]->length;
1816 for (
int i = 0; i < 4; i++)
1818 delete start_circle[i];
1819 delete end_circle[i];
1821 for (
int i = 0; i < 16; i++)
1828 return path[best_path];
1841 vector<Control> hc_rs_controls;
1842 hc_rs_controls.reserve(8);
1937 return hc_rs_controls;