26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_Y_RLR_H_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_Y_RLR_H_
31 namespace curves_eigen {
33 namespace two_theta_y {
36 template <
int ySpec,
int tSpec,
typename Format_t>
48 for (
int i = 0; i < 5; i++) {
57 q1 << q0[0], get_constraint<ySpec, 1>(h), get_constraint<tSpec, 2>(h);
68 Format_t dy = c2[1] - c0[1];
69 Format_t eps =
static_cast<Format_t
>(1e-6);
73 if (std::abs(dy) + eps > 4 * r)
return out[0];
81 Format_t dx = std::sqrt(4 * r * r - (dy / 2) * (dy / 2));
83 c1[1] = (c2[1] + c0[1]) / 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(dy) + eps < 2 * r) {
115 dx = std::sqrt(4 * r * r - dy * dy);
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(dy) + eps < 2 * r) {
168 dx = std::sqrt(4 * r * r - dy * dy);
173 Format_t dxx = (c0[0] + dx) - c1[0];
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_Y_RLR_H_
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
__host__ __device__ Format_t cwArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
Path< Format_t > Result_t
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
HyperRect< Format_t > Hyper_t
Eigen::Matrix< Format_t, 3, 1 > Vector3d_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]
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
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< 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 ...
Eigen::Matrix< Format_t, 2, 1 > Vector2d_t