26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_LSR_H_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_LSR_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 < 3; i++) {
57 q1 << get_constraint<xSpec, 0>(h), q0[1], get_constraint<tSpec, 2>(h);
63 const Format_t dx = c1[0] - c0[0];
66 Format_t dist, dist_i, d1, arc0, arc1;
76 arc0 =
ccwArc(q0[2], target);
77 arc1 =
cwArc(target, q1[2]);
78 dist = r * (arc0 + arc1) + d1;
87 Format_t cosTheta = std::cos(q0[2]);
88 if ((dx > 0 && cosTheta > 0) || (dx < 0 && cosTheta < 0)) {
89 d1 = (dx - 2 * r * std::cos(q0[2] - M_PI / 2)) / cosTheta;
92 arc1 =
cwArc(q0[2], q1[2]);
93 dist_i = r * (arc0 + arc1) + d1;
103 cosTheta = std::cos(q1[2]);
105 if ((dx > 0 && cosTheta > 0) || (dx < 0 && cosTheta < 0)) {
106 d1 = (dx - 2 * r * std::cos(q1[2] - M_PI / 2)) / cosTheta;
108 arc0 =
ccwArc(q0[2], q1[2]);
110 dist_i = r * (arc0 + arc1) + d1;
130 #endif // MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_LSR_H_
__host__ __device__ Format_t cwArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
Eigen::Matrix< Format_t, 2, 1 > Vector2d_t
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
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.
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.
HyperRect< Format_t > Hyper_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 ...
Path< Format_t > Result_t