26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_Y_LRL_H_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_Y_LRL_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) {
83 Format_t dx = std::sqrt(4 * r * r - (dy / 2) * (dy / 2));
85 c1[1] = (c2[1] + c0[1]) / 2;
94 Format_t beta0 = alpha0;
95 Format_t beta1 =
clampRadian(std::atan2(dc01[1], dc01[0]));
97 Format_t beta3 =
clampRadian(std::atan2(dc12[1], dc12[0]));
99 Format_t beta5 = alpha1;
100 Format_t arc0 =
ccwArc(beta0, beta1);
101 Format_t arc1 =
cwArc(beta2, beta3);
102 Format_t arc2 =
ccwArc(beta4, beta5);
103 Format_t dist = r * (arc0 + arc1 + arc2);
117 if (std::abs(dy) + eps < 2 * r) {
119 dx = std::sqrt(4 * r * r - dy * dy);
133 arc1 =
cwArc(beta2, beta3);
134 arc2 =
ccwArc(beta4, beta5);
135 dist_i = r * (arc0 + arc1 + arc2);
155 arc1 =
cwArc(beta2, beta3);
156 arc2 =
ccwArc(beta4, beta5);
157 dist_i = r * (arc0 + arc1 + arc2);
170 if (std::abs(dy) + eps < 2 * r) {
172 dx = std::sqrt(4 * r * r - dy * dy);
177 Format_t dxx = (c0[0] + dx) - c1[0];
188 arc0 =
ccwArc(beta0, beta1);
189 arc1 =
cwArc(beta2, beta3);
191 dist_i = r * (arc0 + arc1 + arc2);
210 arc0 =
ccwArc(beta0, beta1);
211 arc1 =
cwArc(beta2, beta3);
213 dist_i = r * (arc0 + arc1 + arc2);
232 #endif // MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_Y_LRL_H_
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
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
Scalar leftAngleOf(const Scalar q_theta)
return the angle of the vector from the center of the counter clockwise (left) circle coincident to q...
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
Eigen::Matrix< Format_t, 2, 1 > Vector2d_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.
Path< Format_t > Result_t
__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.
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
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 ...
HyperRect< Format_t > Hyper_t