26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_RLR_H_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_RLR_H_
31 namespace curves_eigen {
33 namespace two_theta_x {
36 template <
int xSpec,
int tSpec,
typename Format_t>
48 for (
int i = 0; i < 5; i++) {
57 q1 << get_constraint<xSpec, 0>(h), q0[1], get_constraint<tSpec, 2>(h);
68 Format_t dx = c2[0] - c0[0];
69 Format_t eps =
static_cast<Format_t
>(1e-6);
73 if (std::abs(dx) + eps > 4 * r)
return out[0];
81 Format_t dy = std::sqrt(4 * r * r - (dx / 2) * (dx / 2));
83 c1[0] = (c2[0] + c0[0]) / 2;
91 Format_t beta0 = alpha0;
92 Format_t beta1 =
clampRadian(std::atan2(dc01[1], dc01[0]));
94 Format_t beta3 =
clampRadian(std::atan2(dc12[1], dc12[0]));
96 Format_t beta5 = alpha1;
97 Format_t arc0 =
cwArc(beta0, beta1);
98 Format_t arc1 =
ccwArc(beta2, beta3);
99 Format_t arc2 =
cwArc(beta4, beta5);
100 Format_t dist = r * (arc0 + arc1 + arc2);
113 if (std::abs(dx) + eps < 2 * r) {
115 dy = std::sqrt(4 * r * r - dx * dx);
129 arc1 =
ccwArc(beta2, beta3);
130 arc2 =
cwArc(beta4, beta5);
131 dist_i = r * (arc0 + arc1 + arc2);
151 arc1 =
ccwArc(beta2, beta3);
152 arc2 =
cwArc(beta4, beta5);
153 dist_i = r * (arc0 + arc1 + arc2);
166 if (std::abs(dx) + eps < 2 * r) {
168 dy = std::sqrt(4 * r * r - dx * dx);
173 Format_t dyy = (c0[1] + dy) - c1[1];
184 arc0 =
cwArc(beta0, beta1);
185 arc1 =
ccwArc(beta2, beta3);
187 dist_i = r * (arc0 + arc1 + arc2);
206 arc0 =
cwArc(beta0, beta1);
207 arc1 =
ccwArc(beta2, beta3);
209 dist_i = r * (arc0 + arc1 + arc2);
228 #endif // MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_RLR_H_
__host__ __device__ Format_t cwArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
Path< Format_t > Result_t
HyperRect< Format_t > Hyper_t
interface for variants of solvers, default template is never instantiated
int id
identifies the type of path
A hyper-rectangle in dubins space: A rectangular prism in R^3.
Scalar rightAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the clockwise (right) circle coincident to q...
__host__ __device__ Format_t clampRadian(Format_t a)
wraps the input onto [-pi,pi]
Eigen::Matrix< Scalar, 2, 1 > rightCenter(const Eigen::Matrix< Scalar, 3, 1 > &q, Scalar r)
return the center of a clockwise (right) circle coincident to q with radius r
Encodes a dubins path primitive, which is three connected arc segments.
Eigen::Matrix< Format_t, 2, 1 > Vector2d_t
Eigen::Matrix< Scalar, 2, 1 > leftCenter(const Eigen::Matrix< Scalar, 3, 1 > &q, Scalar r)
return the center of a counter clockwise (left) circle coincident to q with radius r ...